Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / WinForm General / July 2007

Tip: Looking for answers? Try searching our database.

Panel with Close button custom control

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Kevin S Gallagher - 05 Jul 2007 16:34 GMT
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
Bob Powell [MVP] - 05 Jul 2007 20:31 GMT
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.

Signature

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.

> I am a novice on creating controls and with that said looking for advice on
> how to;
[quoted text clipped - 7 lines]
> Thanks for any input!!!
> Kevin
Kevin S Gallagher - 06 Jul 2007 14:44 GMT
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

> Firstly I wonder what style of application you're creating. Opening and
> closing panels like they were windows is probably not a superb idea.
[quoted text clipped - 16 lines]
>> Thanks for any input!!!
>> Kevin
Bob Powell [MVP] - 07 Jul 2007 10:24 GMT
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.

Signature

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.

> Bob,
>
[quoted text clipped - 24 lines]
>>> Thanks for any input!!!
>>> Kevin
kevininstructor@state.or.us - 09 Jul 2007 13:48 GMT
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.

> Just create a user control with the button on it that you want.
>
[quoted text clipped - 37 lines]
>>>> Thanks for any input!!!
>>>> Kevin

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.