I'm using C# and .net 3.5 to make a Winforms application.
I need to have a pane that displays a tree of connected geometric items. I want to be able to click-drag to move the view around, use the mouse wheel to zoom in and out, and click to select the item开发者_C百科s.
I can see that it would be possible to code all this using a pictureBox and a bunch of event processing and math. I'm not against doing this. But if there is a pre-existing solution for this (or even a recommendation on a control better suited to the task), I would rather not have to go through all the trouble of writing this GUI stuff.
I mentioned this earlier in a comment, but probably the best solution is to create a custom UserControl. You can specifically handle the events that you want to handle (MouseDown, MouseMove, MouseUp, keyboard events, etc.).
Draw an image and set it as the Background to the control. You can then add the control (or multiple controls!) to your form for your purpose.
精彩评论