Re: Panel with Close button custom control



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.



"Kevin S Gallagher" <kevin.s.gallagher@xxxxxxxxxxx> wrote in message
news:OwFGKP9vHHA.4544@xxxxxxxxxxxxxxxxxxxxxxx
Bob,

The panel never closes, the close button click event closes the form not
the panel.

Here is an image and short description
http://home.comcast.net/~kevininstructor/dotnet_temp.html




"Bob Powell [MVP]" <bob@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:u7svPszvHHA.4736@xxxxxxxxxxxxxxxxxxxxxxx
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.





Kevin S Gallagher wrote:
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





.


Loading