Windows Vista Forums
Vista Forums Home Join Vista Forums Donate Vista Tutorials Tags

Welcome to Vista Forums we are your forum to discuss Windows Vista x64 and x86 systems. Whether you need help or just want to post an idea you have on Vista, this is the forum for you.
Register at Vista forums...the world biggest Windows Vista resource Join Vista Forums Now

Go Back   Vista Forums > Microsoft Technical Newsgroups > Avalon

WPF Custom Drawing

Closed Thread
 
Thread Tools Display Modes
Old 08-23-2006   #1 (permalink)
Weston Weems
Guest


 

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
Old 08-24-2006   #2 (permalink)
=?Utf-8?B?VGhlUkhvZ3Vl?=
Guest


 

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
>

Old 08-24-2006   #3 (permalink)
Weston Weems
Guest


 

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
>>

Old 08-24-2006   #4 (permalink)
=?Utf-8?B?VGhlUkhvZ3Vl?=
Guest


 

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
> >>

>

Closed Thread

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
types.custom.ps1xml for custom members hasten PowerShell 0 02-25-2008 08:30 PM
paintshop drawing etc Mudnox Vista General 0 10-30-2007 07:17 AM
Drawing Packages Andrew Aitchison Vista General 1 05-05-2007 05:16 PM
Drawing over title bar Keith Patrick Avalon 5 03-31-2007 03:38 PM
Custom Dependency Property in custom class hierarchy not workingcorrectly?! MueMeister Avalon 0 03-02-2006 06:19 PM








Vistax64.com 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 2005-2008

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 47 48 49 50