473,322 Members | 1,614 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

Creating a "base" button

Can I create a "base" button that all the buttons in my Windows Forms can
inherit from?

Thanks.
VS2005
Jul 13 '07 #1
6 1545
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.
VS2005

Jul 13 '07 #2
How co I create a custom button?
"Alex Meleta" <am*****@gmail.comwrote in message
news:20**************************@msnews.microsoft .com...
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.
VS2005


Jul 13 '07 #3
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/quickst...gControls.aspx

Regards, Alex
[TechBlog] http://devkids.blogspot.com
How co I create a custom button?
"Alex Meleta" <am*****@gmail.comwrote in message
news:20**************************@msnews.microsoft .com...
>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.
VS2005

Jul 13 '07 #4
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no rights.

Jul 16 '07 #5
.... or implement IButtonControl.
http://www.dotnetrix.co.uk/buttons.html

--
Mick Doherty
http://www.dotnetrix.co.uk/nothing.html
"Linda Liu [MSFT]" <v-****@online.microsoft.comwrote in message
news:Ku**************@TK2MSFTNGHUB02.phx.gbl...
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/subscripti...ult.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/subscripti...t/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.

Jul 16 '07 #6
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

Jul 18 '07 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

21
by: Alex Martelli | last post by:
I hesitate a bit to post this, but... on the Italian Python NG, somebody was asking whether there was any way to convert an integer number x into a string which represents it in an arbitrary base N...
11
by: Joseph Turian | last post by:
Fellow hackers, I have a class BuildNode that inherits from class Node. Similarly, I have a class BuildTree that inherits from class Tree. Tree includes a member variable: vector<Node>...
4
by: Gecko | last post by:
I noticed that every time I override a class member, the intellisense behavior is to automatically add a call to the base class of the overridden member such as: public override void...
2
by: Wade | last post by:
Hi all, We have created some "Base" class pages for our WebForms and UserControls. For instance, when we create a WebForm called "WebForm1.aspx", instead of inheriting from "System.Web.UI.Page"...
7
by: relient | last post by:
Question: Why can't you access a private inherited field from a base class in a derived class? I have a *theory* of how this works, of which, I'm not completely sure of but makes logical sense to...
2
by: qazmlp1209 | last post by:
class base { public: base() { } base(int number) { priNumber = number ;
3
by: Rob | last post by:
I have these classes (elided methods): class Base { public: Base(string name) {...} }; class Derived : public Base {
3
by: Ravi | last post by:
Is this the correct way to think of "base class"? The "base class" is a class from which other classes are derived. The "base class" will never be derived from another class.
18
by: Stephan Beal | last post by:
Hi, all! Before i ask my question, i want to clarify that my question is not about the code i will show, but about what the C Standard says should happen. A week or so ago it occurred to me...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.