I'm in the middle of writing my project and I have this problem: I try to write a library and I want to use it in my application. In library I ha开发者_运维技巧ve a form with menu strip, tool bar, list view, tree view and etc. Everything in library is protected. In my application I have created the form which inherit form the library. I can change and add new functionality to list view and tree view using designer panel in VS 2008 but I don't have access to menu strip and tool bar, even though they are protected. Why is that so? I will be thankful for some advice.
That was done intentionally in designers for the MenuStrip and ToolStrip controls. The subject of this feedback article. You could write code instead of using the designer. Or consider merging strips after the InitializeComponent() call, tricky to get right. Your best bet is probably to avoid putting them on your base form.
I guess that the protected members are fields.
The PropertyGrid
in visual studio designer shows only properties, try to expose the desired field as properties.
Additionally - I think the properties should be declared as public
for the designer to show them in the properties window.
This is because of the limitations of Visual Inheritence. You need to implement a workaround to get it working. Basically, you can expose a control to derived classes, but you will lose designer support.
The DataGridView also has this problem, and it what my blog post talks about.
精彩评论