Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Few newbie questions on WinForms
Message
 
 
To
08/03/2008 11:53:43
General information
Forum:
ASP.NET
Category:
Forms
Environment versions
OS:
Windows XP
Miscellaneous
Thread ID:
01299299
Message ID:
01300173
Views:
10
>Even if you're just playing around, start out by sub-classing the controls. Yeah, there's some threads around here somewhere that talk about how to do it, but here's a little blurb that I always post when asked about it:
>
>Basically, you'll want a class library that contains your sub-classed UI controls, like textbox, button, etc. Something like this:
>
>using System;
>using System.Drawing;
>using System.Collections;
>using System.ComponentModel;
>using System.Windows.Forms;
>using System.Data;
>
>namespace MyCompany.MyFramework.WinUI.MyClasses
>{
>	public class MyComboBox : System.Windows.Forms.ComboBox
>	{
>		// code here
>	}
>
>	public class MyTextBox : System.Windows.Forms.TextBox
>	{
>		// code here
>	}
>
>	public class MyButton : System.Windows.Forms.Button
>	{
>		// code here
>	}
>}
>
>That's it. These controls can't be sub-classed visually, but as you can see, it's easy enough to do it in code. I have all the basic controls sub-classed in one class library file. Once they're added to the ToolBox, then can be dragged onto any design surface in the IDE.
>
>~~Bonnie
>

I see, thanks a lot.
If it's not broken, fix it until it is.


My Blog
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform