本文整理匯總了C#中System.Windows.Forms.ControlPaint類的典型用法代碼示例。如果您正苦於以下問題:C# ControlPaint類的具體用法?C# ControlPaint怎麽用?C# ControlPaint使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ControlPaint類屬於System.Windows.Forms命名空間,在下文中一共展示了ControlPaint類的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: Button
//引入命名空間
using System;
using System.Drawing;
using System.Windows.Forms;
public class Form1 : Form
{
private Button _button1 = new Button();
private Button _button2 = new Button();
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
public Form1()
{
_button2.Location = new Point(0, _button1.Height + 10);
this.Click += Button2_Click;
this.Controls.Add(_button1);
this.Controls.Add(_button2);
}
private void Button2_Click(object sender, System.EventArgs e)
{
// Draws a flat button on button1.
ControlPaint.DrawButton(
System.Drawing.Graphics.FromHwnd(_button1.Handle), 0, 0,
_button1.Width, _button1.Height,
ButtonState.Flat);
}
}