Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Newbie class creation question
Message
From
21/07/2004 09:35:31
John Baird
Coatesville, Pennsylvania, United States
 
 
To
21/07/2004 09:25:50
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
ASP.NET
Category:
Other
Miscellaneous
Thread ID:
00926521
Message ID:
00926523
Views:
24
Hi MIke... you can't design your base control classes visually in .net. You must do it programmatically. Once you have done this, you can add them to the toobox and drag them onto forms, controls, etc.

Here is a sample of mine ( I have removed a lot of it for space sake).
using System ;
using System.Drawing;
using System.Windows.Forms;
using System.ComponentModel;
using System.Collections;
using System.Diagnostics;
using System.Data;

namespace Quay.Base
{
	/// <summary>
	/// Summary description for Class1.
	/// </summary>
	public class frmBase : System.Windows.Forms.Form
	{
		#region Properties
		private bool _IsLoggedIn = false;
		private string _ServerName = "";
		private string _ServerCatalog = "";
		private char _Mode = ' ';

		public char Mode	
		{
			get	{return _Mode;}
			set	{_Mode = value;}
		}

		public bool IsLoggedIn	
		{
			get	{return _IsLoggedIn;}
			set	{_IsLoggedIn = value;}
		}

		public string ServerName	
		{
			get	{return _ServerName;}
			set	{_ServerName = value;}
		}
	
		public string ServerCatalog	
		{
			get	{return _ServerCatalog;}
			set	{_ServerCatalog = value;}
		}
		#endregion

		public frmBase() 
		{ 
			this.Font = new Font("Arial", 8);
		}
	}

	public class cboBase : System.Windows.Forms.ComboBox
	{
		public cboBase() 
		{
			this.Font = new Font("Arial", 8);
		}	
	}

	public class chkBase : System.Windows.Forms.CheckBox
	{
		public chkBase() 
		{
			this.Font = new Font("Arial", 8);
		}
	}

	public class lblBase : System.Windows.Forms.Label 
	{
		public lblBase() 
		{
			this.Font = new Font("Arial", 8);
			this.TextAlign = ContentAlignment.MiddleRight;

			//this.BackColor = Color.White;
		}
	}	
}
>Hi,
>
>I have a VFP background and I'm dipping my toes into the C# world and have immediately stumbled :)
>
>I am accustomed to designing my base classes visually. For example, I subclass a native VFP button by dropping one on a form in the form designer, set the button's properties for Font, ForeColor, BackColor, Flat, etc. then save the button as a class. The button class is now available for drag and drop to other form. Simple and easy for me.
>
>How do I go about doing this (or somthing like it) in the C# .NET IDE? I can't seem to find a way to do the class design visually.
>
>
>TIA
>
>
>Mike
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform