tags:

views:

380

answers:

3

What would be the best WPF control in C# (VS 2008) that you can place on a form that would allow you to do drawing similar to the "Paint" function for the CWnd class in C++? Also, that could display bitmaps, have a scroll bar, and the ability to accept user inputs (ie. MouseMove, Button Clicks, etc...). Basically all the functionality of a CWnd in a control on a WPF form?

+2  A: 

The UIElement is the lowest level element that supports input and drawing. Although, using WPF, you really have to do a lot less manual drawing. Are you sure that you need to do this? Also, the scroll bar will never be inherit in your element. If you need scrolling behavior, just wrap your element in a ScrollViewer.

Abe Heidebrecht
A: 

I basically want to create my own control that I can do drawing functions in just like the the View window in a MFC application.

Yttrium
+2  A: 

UIElement is the place to start and OnRender is the method to override. Be warned that WPF is heavily geared toward composing UI as opposed to the WM_PAINT ways of Win32. Unless you are creating new low level primitives there is almost always a more productive alternative.

Ifeanyi Echeruo