How to Override my controls using C#?
Need to set button property like
Font(Name => Segoe UI, style => Regular, size => 10), height => 50px, width => 250px, back color => green
by default.
How to use override method for respected button properties.
Note: I am going to use windows control library controls, to my projects. Thanks in advance.
you can make your custom control for overriding with your default properties.
Sample button code for custom button:
using System.ComponentModel;
using System.Drawing;
using System.Windows.Forms;
namespace DemoControls
{
[ToolboxItem(true)]
public class SimpleButton : Button
{
public SimpleButton()
{
Font = new Font("Segoe UI", 10, FontStyle.Regular);
Height = 50;
BackColor = DefaultBackColor;
}
}
}
It will show control in your toolbox when you build your project then you have to use this SimpleButton in your project where you want
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.