Panel with Close button custom control

  • Thread starter Thread starter Kevin S Gallagher
  • Start date Start date
K

Kevin S Gallagher

I am a novice on creating controls and with that said looking for advice on
how to;

Create a custom panel were there is a button anchored bottom,right with text
= "Exit", panel docked bottom, button click event has Close() method.

I seem to keep having to add panels with a button on them all the time and
rather simply have a custom control to do this.

Thanks for any input!!!
Kevin
 
Firstly I wonder what style of application you're creating. Opening and
closing panels like they were windows is probably not a superb idea.

An equivalent however would be to create a UserControl and use it as a
SmartPart in a CAB based application or possibly created with SCSF. This
application style enables the kind of granularity I think you're looking
for.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Just create a user control with the button on it that you want.

You can make the user control's Dock property default to Bottom and then use
the ParentForm property to find the form onto which the user control was
dropped.

Although I don't reccommend Visual Inheritance often you could also use this
form as a base for your other ones.

Finally, although the idea is possible, the use of a UI mechanism that
duplicates the familiar close button on the tip-right of the form title
still isn't a great idea.

--
Bob Powell [MVP]
Visual C#, System.Drawing

Ramuseco Limited .NET consulting
http://www.ramuseco.com

Find great Windows Forms articles in Windows Forms Tips and Tricks
http://www.bobpowell.net/tipstricks.htm

Answer those GDI+ questions with the GDI+ FAQ
http://www.bobpowell.net/faqmain.htm

All new articles provide code in C# and VB.NET.
Subscribe to the RSS feeds provided and never miss a new article.
 
Thanks Bob.

In regards to duplicating the system close button, this is not the case.
Instead the close button would have more functionality to it in respects to
the actual application.
 
Back
Top