Click here to Skip to main content
15,913,115 members
Home / Discussions / C#
   

C#

 
GeneralRe: help in treeview needed Pin
Anand Amirineni5-Mar-02 14:12
Anand Amirineni5-Mar-02 14:12 
QuestionHow to use SSL Pin
Felix Nielsen4-Mar-02 9:19
Felix Nielsen4-Mar-02 9:19 
QuestionHow to sublass visually a C# class Pin
4-Mar-02 6:03
suss4-Mar-02 6:03 
AnswerRe: How to sublass visually a C# class Pin
James T. Johnson4-Mar-02 14:12
James T. Johnson4-Mar-02 14:12 
GeneralRe: How to sublass visually a C# class Pin
5-Mar-02 3:19
suss5-Mar-02 3:19 
GeneralRe: How to sublass visually a C# class Pin
James T. Johnson5-Mar-02 7:37
James T. Johnson5-Mar-02 7:37 
GeneralRe: How to sublass visually a C# class Pin
6-Mar-02 2:44
suss6-Mar-02 2:44 
GeneralRe: How to sublass visually a C# class Pin
James T. Johnson6-Mar-02 9:02
James T. Johnson6-Mar-02 9:02 
My SMTP server is having problems right now so I'll just post it here.

Sample Project

Here’s what I did to create the sample.

Create a new Windows Application, right click on the project in the solution explorer and choose Add UserControl, call it BaseUserControl.cs.

On the BaseUserControl set the ForeColor to the System palettes Highlight color. Resize the canvas so it is 232x40 pixels. Now add a new label control to it and place it at (8, 8) with the default size. Change the Text on the label to say “base”.

Build the project.

Now Add another UserControl to the project (right click on the project choose Add UserControl). Call it ExtendedUserControl.cs.

Now close the designer for it, right click on ExtendedUserControl in the solution explorer and choose View Code.

Now change the class declaration so that it inherits from BaseUserControl instead of System.Windows.Forms.UserControl.

public class ExtendedUserControl : System.Windows.Forms.UserControl

changes to

public class ExtendedUserControl : BaseUserControl

Build the project again. Now open up the designer for the ExtendedUserControl (double click ExtendedUserControl in the solution explorer).

When you open up the designer for the ExtendedUserControl you should see the BaseUserControl, now add another label placing it at (120, 8) with the default size. Change the Text to read “extended”.

Now click on the background of the UserControl, and set the ForeColor to the System palette’s ControlText color.

Build the project again.

Now open up Form1 by double-clicking on it in the Solution Explorer. In the toolbox you should see two new entries at the bottom; these are the new UserControls you just created. Drag one of each onto the form.

VS.NET will tell you when you make a change that requires a build for you to see it; but to be on the safe side I always do a build.

If you have any other questions feel free to ask.


James

Sonork ID: 100.11138 - Hasaki
"Smile your little smile, take some tea with me awhile.
And every day we'll turn another page.
Behind our glass we'll sit and look at our ever-open book,
One brown mouse sitting in a cage."
"One Brown Mouse" from Heavy Horses, Jethro Tull 1978

GeneralRe: How to sublass visually a C# class Pin
6-Mar-02 10:59
suss6-Mar-02 10:59 
GeneralRe: How to sublass visually a C# class Pin
James T. Johnson6-Mar-02 12:42
James T. Johnson6-Mar-02 12:42 
GeneralRe: How to sublass visually a C# class Pin
7-Mar-02 3:31
suss7-Mar-02 3:31 
GeneralRe: How to sublass visually a C# class Pin
James T. Johnson7-Mar-02 6:06
James T. Johnson7-Mar-02 6:06 
QuestionAre ownerdrawn buttons available? Pin
4-Mar-02 3:53
suss4-Mar-02 3:53 
AnswerRe: Are ownerdrawn buttons available? Pin
James T. Johnson4-Mar-02 14:23
James T. Johnson4-Mar-02 14:23 
GeneralAccessing the shell Pin
4-Mar-02 1:51
suss4-Mar-02 1:51 
GeneralRe: Accessing the shell Pin
James T. Johnson4-Mar-02 14:30
James T. Johnson4-Mar-02 14:30 
GeneralRe: Accessing the shell Pin
4-Mar-02 21:19
suss4-Mar-02 21:19 
GeneralRe: Accessing the shell Pin
James T. Johnson4-Mar-02 22:13
James T. Johnson4-Mar-02 22:13 
GeneralRe: Accessing the shell Pin
5-Mar-02 1:37
suss5-Mar-02 1:37 
GeneralRe: Accessing the shell Pin
James T. Johnson5-Mar-02 8:21
James T. Johnson5-Mar-02 8:21 
GeneralRe: Accessing the shell Pin
5-Mar-02 20:57
suss5-Mar-02 20:57 
GeneralC# question Pin
Jon Newman4-Mar-02 1:05
Jon Newman4-Mar-02 1:05 
GeneralRe: C# question Pin
Michael P Butler4-Mar-02 1:25
Michael P Butler4-Mar-02 1:25 
GeneralRe: C# question Pin
Jon Newman4-Mar-02 1:32
Jon Newman4-Mar-02 1:32 
GeneralRe: C# question Pin
Michael P Butler4-Mar-02 1:42
Michael P Butler4-Mar-02 1:42 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.