Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Subclass
Message
From
26/04/2008 15:24:11
 
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:
01313299
Views:
9
>I'm not sure that's the right answer, although I don't know for sure myself. Maybe Kevin will answer us better.
>
>I know that when you use MM and create a form you create it from an MM template which is an MM class. I think the real question is is how to subclass the MM classes.


OK, Jeff ... good points. I didn't realize that there was templating available.

So, my next suggestion is to use the Template to create a form in the project that you will be using for all your sub-classes. Then use *that* form as your sub-class. Wouldn't that work for you? I'd then probably create another Template, based on the existing MM template.

Kevin may certainly have a better suggestion though.

~~Bonnie





>
>>>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
Reply
Map
View

Click here to load this message in the networking platform