Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
IDE Toolbox
Message
De
15/09/2005 13:26:04
 
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
Divers
Thread ID:
01049376
Message ID:
01049996
Vues:
18
Hi John,

>Would you sub-class all the controls from the tool box into this class library<

Yep. No reason not to. Except maybe Form stuff ... we have our Form sub-classes in separate classes ... and that's mainly because they *can* be subclassed visually, unlike the TextBox, etc.

~~Bonnie



>Hi Bonnie
>
>Would you sub-class all the controls from the tool box into this class library including the Form, MainMenu, DataGrid, ListView, TreeView, Tabcontrol, DateTimePicker and all the others?
>
>Thanks
>
>John
>
>>Pete,
>>
>>I've posted on this subject before ... here's my typical response to this question:
>>
>>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.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
>>
>>
>>>thanks Bonnie, while we're on the subject of creating my own classes, is there a quick and dirty way of creating a subclass definition of all the Windows.Forms controls and output them to a text file ?
>>>
>>>*/ Output file would look like this
>>>
>>>
>>>class MyTextBox : TextBox
>>>{
>>>    public MyTextBox()
>>>    {
>>>    }
>>>}
>>>
>>>etc...
>>>
>>>
>>>thanks again
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform