Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclass
Message
From
26/04/2008 10:22:34
 
 
To
25/04/2008 16:20:10
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Title:
Environment versions
Environment:
C# 3.0
OS:
Vista
Miscellaneous
Thread ID:
01313200
Message ID:
01313265
Views:
7
>How do I subclass a MM form or MM control?

The same way you would sub-class the base .NET controls. I typically have a project that's included in all my apps that contains most of these sub-classes. Things like Forms can be sub-classed visually ... add a Form to your project (right-click, add new Item, choose a Form), then simply go to the code and change:
public partial class MyForm : System.Windows.Forms.Form
to
public partial class MyForm : MMForm
(I don't use MM, so I don't know what the proper name of the form is).

Other things, like TextBoxes, Buttons, etc., can't be sub-classed visually. So basically, you'll want one big class library (one file) that contains your sub-classed UI controls. 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 : MMComboBox
	{
		// code here
	}

	public class MyTextBox : MMTextBox
	{
		// code here
	}

	public class MyButton : MMButton
	{
		// code here
	}
}
That's it.

~~Bonnie
Bonnie Berent DeWitt
NET/C# MVP since 2003

http://geek-goddess-bonnie.blogspot.com
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform