![]() |
![]() | ![]() | ![]() | ![]() | ![]() | ![]() | ![]() |
| 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. |
| |||||||
| |
| | #1 (permalink) |
| | 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 Specs![]() |
| | #2 (permalink) |
| | 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 Specs![]() |
| | #3 (permalink) |
| | 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 Specs![]() |
| | #4 (permalink) |
| | 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 Specs![]() |
| 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 | |||