开发者

Need design advice for custom list control in .NET Windows Forms

开发者 https://www.devze.com 2023-02-06 23:12 出处:网络
First of all, here\'s some concept art for how this custom list control must look: http://img816.imageshack.us/img816/1088/customlistctrl.png

First of all, here's some concept art for how this custom list control must look:

http://img816.imageshack.us/img816/1088/customlistctrl.png

Each list item is fairly complex and turns into an "edit interface" when the mouse hovers over it. I also have PNG im开发者_如何学Pythonage files for every skinning detail of this thing, including the scroll bar.

What is the best approach to get started implementing this? Would I create a custom control and simply render all of this in GDI?

Could I make the list control a transparent clip region with a scroll bar? For the individual list items, would I simply use a textured panel as the backdrop for each item and place existing .NET forms (like combo boxes, buttons, edit fields, etc) as children of that?

I've never had to create something this detailed before.


If you want your control to look exactly like the given picture (which is nice), you will end up drawing much of it, if not all of it, yourself. One possibility is to subclass each control being used and override the OnPaint method to do your custom drawing. This assumes a design where everything in your picture is an individual control.

I myself might make each row a separate UserControl-derived class, perhaps with an internal constructor so users of your control can't create the row directly. Within your SkinnedListRow class (or whatever name), you could have each of the subcontrols. By the looks of things, the row contains three controls that display numbers and one that displays any kind of text.

For the editing portion, derive another UserControl that contains all the controls you picture. Both the display controls and the editing control are owned by the SkinnedListRow from above, so it knows how to load data from one set into another.

You have a good amount of work in front of you, but your idea looks nice. Good luck.

0

精彩评论

暂无评论...
验证码 换一张
取 消