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 / Languages / C# / July 2007

Tip: Looking for answers? Try searching our database.

Creating a "base" button

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Doc John - 13 Jul 2007 20:28 GMT
Can I create a "base" button that all the buttons in my Windows Forms can
inherit from?

Thanks.
VS2005
Alex Meleta - 13 Jul 2007 20:36 GMT
Hi,

Why not? Create the custom button and place it (or many) onto the form.

Regards, Alex
[TechBlog] http://devkids.blogspot.com

> Can I create a "base" button that all the buttons in my Windows Forms
> can inherit from?
>
> Thanks.
> VS200
Doc John - 13 Jul 2007 20:57 GMT
How co I create a custom button?
> Hi,
>
[quoted text clipped - 8 lines]
>> Thanks.
>> VS2005
Alex Meleta - 13 Jul 2007 21:18 GMT
Hi,

Just like any custom controls (in your case as inherited class of Button):

public class CustomButton : Button
   {
/// ....        
   }

You can learn a bit there: http://samples.gotdotnet.com/quickstart/winforms/doc/WinFormsCreatingControls.aspx

Regards, Alex
[TechBlog] http://devkids.blogspot.com

> How co I create a custom button?
>> Hi,
[quoted text clipped - 9 lines]
>>> Thanks.
>>> VS2005
Linda Liu [MSFT] - 16 Jul 2007 03:09 GMT
Hi Doc,

It's easy to create a custom button.

To do this, create a new class inherited from the
System.Windows.Forms.Button class and add some custom properites or
override some methods in the new class, if necessary.

After you finish the custom button, build the project.

To create a button that is derived from the custom button in the same
project, make the new class inherited from the custom button. The following
is a sample.

public class MyButton:CustomButton
{
   ....
}

If you'd like to inherit a new class from the custom button in a new
project, add a reference to the project or assembly that contains the
custom button in the new project and then make the new class inherited from
the custom button.

Hope this helps.
If you have anything unclear, please feel free to let me know.

Sincerely,
Linda Liu
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.
Mick Doherty - 16 Jul 2007 09:19 GMT
... or implement IButtonControl.
http://www.dotnetrix.co.uk/buttons.html

Signature

Mick Doherty
http://www.dotnetrix.co.uk/nothing.html

> Hi Doc,
>
[quoted text clipped - 49 lines]
> This posting is provided "AS IS" with no warranties, and confers no
> rights.
Linda Liu [MSFT] - 18 Jul 2007 11:46 GMT
Hi Doc,

How about the problem now?

If you have any question, please feel free to let me know.

Thank you for using our MSDN Managed Newsgroup Support Service!

Sincerely,
Linda Liu
Microsoft Online Community Support

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.