Results 1 to 3 of 3

Thread: What are custom controls and how are they made?

  1. #1
    VitzzViperzz is offline C# Forum Newbie
    .NET Framework
    .NET 4.5
    Join Date
    Jan 2017
    Posts
    21
    Rep Power
    5

    What are custom controls and how are they made?

    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.

  2. #2
    JuggaloBrotha's Avatar
    JuggaloBrotha is offline C# Forum Moderator
    .NET Framework
    .NET 4.0
    Join Date
    Apr 2011
    Location
    Lansing, MI; USA
    Posts
    85
    Rep Power
    76
    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

  3. #3
    VitzzViperzz is offline C# Forum Newbie
    .NET Framework
    .NET 4.5
    Join Date
    Jan 2017
    Posts
    21
    Rep Power
    5
    Quote Originally Posted by JuggaloBrotha View Post
    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.co...est#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



Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •