Hi there,
I'm doing this custom user control but I'm having a little issue. This UC has a ToolStrip added to it and I'm working with control designers which allowed me to create the following:
When you click on "Insert New Page", a method will be called which will create a new button that will be added to the ToolStrip and a Panel will also be added to the UC which will be associated with the the ToolStrip button. So, if we had a bunch of "Pages", whenever you click a button, the Panel associated will turn visible while the others not visible. So far so good?
Now, what I want... Let's say that this UC is almost coded. I compile to a dll file and then I can use it wherever I want. To use it, I just add the dll file to the project and then, drag the UC (which is called PageStrip by the way) from the ToolBox to a form. Now, there's a functionality that I want to be here... When you drag the UC to the form, there won't be any buttons or panels (let's call it "pages" from now on), you'll have to add them manually (like explained in the paragraph above). What I want is a couple of "pages" to be added automatically when the UC is added to the form. Just the way the TabControl works. When you add a TabControl to a form, you'll have 2 tabs already added. How can I achieve the same thing?
How can I call twice the same method that is called on "Insert New Page" one time only, and that is, when the UC is added to the form. I have no clue on how to do that.
My first and only try was overriding the OnPaint event of the UC and call the method there, then, I would assigned the "true" value to a variable so this would only be called once. However, this would only work while the project was opened. If I closed the project and reopened it, the variable that controlled if a "page" was already added would be "false", the default value.
There must be someway to accomplish this without having to workaround like I did using the OnPaint event. Any hints?
I hope this detailed post is enough to explain my problem and not to confuse you.
I'm doing this custom user control but I'm having a little issue. This UC has a ToolStrip added to it and I'm working with control designers which allowed me to create the following:
When you click on "Insert New Page", a method will be called which will create a new button that will be added to the ToolStrip and a Panel will also be added to the UC which will be associated with the the ToolStrip button. So, if we had a bunch of "Pages", whenever you click a button, the Panel associated will turn visible while the others not visible. So far so good?
Now, what I want... Let's say that this UC is almost coded. I compile to a dll file and then I can use it wherever I want. To use it, I just add the dll file to the project and then, drag the UC (which is called PageStrip by the way) from the ToolBox to a form. Now, there's a functionality that I want to be here... When you drag the UC to the form, there won't be any buttons or panels (let's call it "pages" from now on), you'll have to add them manually (like explained in the paragraph above). What I want is a couple of "pages" to be added automatically when the UC is added to the form. Just the way the TabControl works. When you add a TabControl to a form, you'll have 2 tabs already added. How can I achieve the same thing?
How can I call twice the same method that is called on "Insert New Page" one time only, and that is, when the UC is added to the form. I have no clue on how to do that.
My first and only try was overriding the OnPaint event of the UC and call the method there, then, I would assigned the "true" value to a variable so this would only be called once. However, this would only work while the project was opened. If I closed the project and reopened it, the variable that controlled if a "page" was already added would be "false", the default value.
There must be someway to accomplish this without having to workaround like I did using the OnPaint event. Any hints?
I hope this detailed post is enough to explain my problem and not to confuse you.