What WPF C# Control is similar to a CWnd in C++?
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?
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.
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.
链接地址: http://www.djcxy.com/p/64722.html