What are custom controls and how are they made?

VitzzViperzz

Well-known member
Joined
Jan 16, 2017
Messages
75
Location
United Kingdom
Programming Experience
1-3
Hello,

I have recently seen some pretty good looking UIs that were made in VS and using C#. However, with some research, I have found out that they are actually custom controls that have been made by indivuduals.

My questions, is how are these controls even made? The MSDN website suggests that they are programmed, but how can you program a pie chart or a bar chart that shows numerical data? Is there a graphical side to it, which you have to actually create the designs? and how are all these parts of the development brought together?

It would be great of someone shared some of their knowledge.
 
The term "custom control" is a pretty broad general term, because "custom control" could be something as simple as inheriting an existing control and changing it (adding on to it usually) or it could be something complex where you're inheriting the Control class and building your control from there, which would more than likely mean you're doing all the control's painting and everything.
Plus it makes a difference to what type of control you're making as you go about making a "custom control" one way in a winforms app, a completely different way for asp.net, yet a 3rd way for WPF.
So for a pie chart type control, and for this I'm just going to assume it's a WinForms app, you'll probably want to start with making a class that inherits System.Windows.Forms.Control and add all the properties & events you'll need. Since this is probably something that would actually display a pie chart on the screen you'll need to handle the control's Paint event and draw that chart on the screen.

There's a lot more info here: Developing Custom Windows Forms Controls with the .NET Framework
 
The term "custom control" is a pretty broad general term, because "custom control" could be something as simple as inheriting an existing control and changing it (adding on to it usually) or it could be something complex where you're inheriting the Control class and building your control from there, which would more than likely mean you're doing all the control's painting and everything.
Plus it makes a difference to what type of control you're making as you go about making a "custom control" one way in a winforms app, a completely different way for asp.net, yet a 3rd way for WPF.
So for a pie chart type control, and for this I'm just going to assume it's a WinForms app, you'll probably want to start with making a class that inherits System.Windows.Forms.Control and add all the properties & events you'll need. Since this is probably something that would actually display a pie chart on the screen you'll need to handle the control's Paint event and draw that chart on the screen.

There's a lot more info here: Developing Custom Windows Forms Controls with the .NET Framework

Thanks for the reply.

I was actually talking about custom controls in WPF applications. However, with some research, I have found out how they are made.

Have a look at: https://winrtxamltoolkit.codeplex.com/SourceControl/latest#ReadMe.txt

They should have some interesting functions that you can just paste in the class and use it (I am not doing that, just saying that you can)

And also, you can just simply make a pie chart then create a pass in chart data, then you create Paths to draw the chart in a canvas.

Rep Power?? LOL

Thanks


 
Back
Top Bottom