Click here to Skip to main content
15,891,473 members
Home / Discussions / C#
   

C#

 
AnswerRe: c# Pin
rasoolfazeli27-Aug-11 4:47
rasoolfazeli27-Aug-11 4:47 
GeneralRe: c# Pin
Shameel27-Aug-11 4:55
professionalShameel27-Aug-11 4:55 
AnswerRe: c# Pin
Hari Om Prakash Sharma27-Aug-11 8:23
Hari Om Prakash Sharma27-Aug-11 8:23 
AnswerRe: c# Pin
Abhinav S27-Aug-11 21:05
Abhinav S27-Aug-11 21:05 
Questionprogramming Event Logic Pin
rasoolfazeli27-Aug-11 0:36
rasoolfazeli27-Aug-11 0:36 
AnswerRe: programming Event Logic Pin
MicroVirus27-Aug-11 2:43
MicroVirus27-Aug-11 2:43 
GeneralRe: programming Event Logic Pin
rasoolfazeli27-Aug-11 4:39
rasoolfazeli27-Aug-11 4:39 
AnswerRe: programming Event Logic Pin
MicroVirus27-Aug-11 5:58
MicroVirus27-Aug-11 5:58 
Which is best depends on your situation.

1) Inheriting from an existing control. Use this approach if there already exists a control which does most of what you want, and you want to add to it and/or change some of its functionality. A lot of the standard controls in .NET allow most of their functionality to be overwritten by virtual functions, in effect allowing a great deal of customisation, building on existing blocks. It requires you to familiarise yourself with the control in question. A great advantage to this approach is that a lot of the functionality you want is already implemented and you only need to work on the parts you want added or different. How far you can go in customisation (and how easy) depends on the specific control.

2) Inheriting from UserControl allows you to begin with 'a clean slate'. It has basic functionality to help you start a new control, such as auto-scrollbars and it's a control container out of the box. You create a custom control from this typically by combining existing controls. Since you express interest in mostly changing the look of the controls, this is probably not the best for you.

3) This allows you the most power, starting from scratch. Some functionality is right out of the box, but most you're going to have to build yourself. It's very powerful, but also the most work of the three. Best suited if you are creating an entirely new control that 1) doesn't behave like an existing control, or a group of existing controls and 2) has a unique look, so it needs to do all of its own drawing. This is the most advanced of the three.

I'm guessing you're best of with method Nr 1 - inheriting from existing controls. You can override the paint event to do your own drawing. That way, you can change the looks while preserving the functionality. But it's up to you to decide.
There are plenty of articles about creating a custom control, also here on CodeProject. Look for articles like "Custom <name> control", where name is the name of an existing control, e.g. "Custom progressbar control".

Good luck!
AnswerRe: programming Event Logic Pin
GParkings1-Sep-11 6:55
GParkings1-Sep-11 6:55 
QuestionIs there a use for... [modified] Pin
Narf the Mouse26-Aug-11 14:39
Narf the Mouse26-Aug-11 14:39 
AnswerRe: Is there a use for... Pin
PIEBALDconsult26-Aug-11 14:46
mvePIEBALDconsult26-Aug-11 14:46 
GeneralRe: Is there a use for... Pin
Narf the Mouse26-Aug-11 15:05
Narf the Mouse26-Aug-11 15:05 
AnswerRe: Is there a use for... Pin
Narf the Mouse26-Aug-11 15:18
Narf the Mouse26-Aug-11 15:18 
GeneralRe: Is there a use for... Pin
BillWoodruff27-Aug-11 18:16
professionalBillWoodruff27-Aug-11 18:16 
GeneralRe: Is there a use for... Pin
Narf the Mouse27-Aug-11 19:36
Narf the Mouse27-Aug-11 19:36 
AnswerRe: Is there a use for... Pin
jschell28-Aug-11 8:03
jschell28-Aug-11 8:03 
GeneralRe: Is there a use for... Pin
Narf the Mouse28-Aug-11 8:56
Narf the Mouse28-Aug-11 8:56 
AnswerRe: Is there a use for... Pin
Narf the Mouse28-Aug-11 11:33
Narf the Mouse28-Aug-11 11:33 
GeneralRe: Is there a use for... [modified] Pin
BillWoodruff28-Aug-11 19:37
professionalBillWoodruff28-Aug-11 19:37 
AnswerRe: Is there a use for... Pin
BobJanova30-Aug-11 0:20
BobJanova30-Aug-11 0:20 
GeneralRe: Is there a use for... Pin
Narf the Mouse30-Aug-11 0:38
Narf the Mouse30-Aug-11 0:38 
GeneralRe: Is there a use for... Pin
BobJanova30-Aug-11 6:52
BobJanova30-Aug-11 6:52 
AnswerRe: Is there a use for... Pin
GParkings1-Sep-11 7:04
GParkings1-Sep-11 7:04 
GeneralRe: Is there a use for... Pin
Narf the Mouse1-Sep-11 7:16
Narf the Mouse1-Sep-11 7:16 
GeneralRe: Is there a use for... Pin
GParkings1-Sep-11 7:23
GParkings1-Sep-11 7:23 

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.