Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Changing forecolor of disabled controls
Message
De
01/10/2008 16:51:01
 
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Versions des environnements
Environment:
C# 2.0
OS:
Windows Server 2003
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01345277
Message ID:
01352121
Vues:
46
>Indeed it does mean that. I guess I need to move that up on my priority list. When I started out, I was feeling a bit overwhelmed and that was just one less thing to deal with. I'll be paying for that decision for a while.

One less thing to deal with perhaps, but a pretty important one to dismiss, unfortunately. And, to make you feel even worse about it ... ;-) ... here's how easy it is to do:

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. And you could have started off with no code in them at all, and added as needed. 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
Bonnie Berent DeWitt
NET/C# MVP since 2003

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

Click here to load this message in the networking platform