Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > Avalon

Vista - WPF Custom Drawing

 
 
Old 08-23-2006   #1 (permalink)
Weston Weems


 
 

WPF Custom Drawing

I plan on implementing the equivalent of something along the lines of
the bandwidth meter or performance meter in task manager in a wpf
control and was wondering where I should start.

In the windows world, I'd inherit from UserControl, override onPaint,
get a graphics context and starting painting.

I'm having a bit of a problem grasping where to start in custom drawing
my own control from scratch and was wondering if anyone could give me a
few hints.

I dont mind writing my own code, I know the actual painting part, I'll
just change my pens stroke fill color etc... and draw the geometrys, but
I dont have a reference to a surface to draw.

Thanks in advance
Weston

My System SpecsSystem Spec
Old 08-24-2006   #2 (permalink)
=?Utf-8?B?VGhlUkhvZ3Vl?=


 
 

RE: WPF Custom Drawing

karsten has already done this for you, and he updated it to latest bits.

http://blogs.msdn.com/karstenj/archi...08/622982.aspx



"Weston Weems" wrote:

> I plan on implementing the equivalent of something along the lines of
> the bandwidth meter or performance meter in task manager in a wpf
> control and was wondering where I should start.
>
> In the windows world, I'd inherit from UserControl, override onPaint,
> get a graphics context and starting painting.
>
> I'm having a bit of a problem grasping where to start in custom drawing
> my own control from scratch and was wondering if anyone could give me a
> few hints.
>
> I dont mind writing my own code, I know the actual painting part, I'll
> just change my pens stroke fill color etc... and draw the geometrys, but
> I dont have a reference to a surface to draw.
>
> Thanks in advance
> Weston
>

My System SpecsSystem Spec
Old 08-24-2006   #3 (permalink)
Weston Weems


 
 

Re: WPF Custom Drawing

Well actually that was exactly along the lines of what I was looking
for, except I was looking to wrap this into my own custom control. So
equivalent of onRender or onPaint I dont need to worry abotu getting a
canvas and drawing everything manually by hand?

I can just take base element, get drawing context and then start drawing
geometry?

Thanks
Weston


TheRHogue wrote:
> karsten has already done this for you, and he updated it to latest bits.
>
> http://blogs.msdn.com/karstenj/archi...08/622982.aspx
>
>
>
> "Weston Weems" wrote:
>
>> I plan on implementing the equivalent of something along the lines of
>> the bandwidth meter or performance meter in task manager in a wpf
>> control and was wondering where I should start.
>>
>> In the windows world, I'd inherit from UserControl, override onPaint,
>> get a graphics context and starting painting.
>>
>> I'm having a bit of a problem grasping where to start in custom drawing
>> my own control from scratch and was wondering if anyone could give me a
>> few hints.
>>
>> I dont mind writing my own code, I know the actual painting part, I'll
>> just change my pens stroke fill color etc... and draw the geometrys, but
>> I dont have a reference to a surface to draw.
>>
>> Thanks in advance
>> Weston
>>

My System SpecsSystem Spec
Old 08-24-2006   #4 (permalink)
=?Utf-8?B?VGhlUkhvZ3Vl?=


 
 

Re: WPF Custom Drawing

If you need to draw on a per frame level, like in DirectX, you would go this
route:

CompositionTarget.Rendering += new EventHandler(CompositeRendering);

The CompositeRendering callback is called on a per frame basis. You can draw
whatever you like into your canvas at this point using WPF geometry API's.

You should find SDK material on the API. I have a 3D sample that uses this
for per frame z-order sorting in my sample pack at
http://www.therhogue.com/WinFX .


"Weston Weems" wrote:

> Well actually that was exactly along the lines of what I was looking
> for, except I was looking to wrap this into my own custom control. So
> equivalent of onRender or onPaint I dont need to worry abotu getting a
> canvas and drawing everything manually by hand?
>
> I can just take base element, get drawing context and then start drawing
> geometry?
>
> Thanks
> Weston
>
>
> TheRHogue wrote:
> > karsten has already done this for you, and he updated it to latest bits.
> >
> > http://blogs.msdn.com/karstenj/archi...08/622982.aspx
> >
> >
> >
> > "Weston Weems" wrote:
> >
> >> I plan on implementing the equivalent of something along the lines of
> >> the bandwidth meter or performance meter in task manager in a wpf
> >> control and was wondering where I should start.
> >>
> >> In the windows world, I'd inherit from UserControl, override onPaint,
> >> get a graphics context and starting painting.
> >>
> >> I'm having a bit of a problem grasping where to start in custom drawing
> >> my own control from scratch and was wondering if anyone could give me a
> >> few hints.
> >>
> >> I dont mind writing my own code, I know the actual painting part, I'll
> >> just change my pens stroke fill color etc... and draw the geometrys, but
> >> I dont have a reference to a surface to draw.
> >>
> >> Thanks in advance
> >> Weston
> >>

>

My System SpecsSystem Spec
 

Thread Tools


Similar Threads
Thread Forum
Custom Control - OnPaint - not drawing .NET General
Accessing custom types output from custom cmdlet's in C# GUI PowerShell
types.custom.ps1xml for custom members PowerShell
paintshop drawing etc Vista General


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46