winfrom 绘制圆形按钮

private void Button_Paint(object sender, PaintEventArgs e)

{

    Button btn = sender as Button;

    System.Drawing.Drawing2D.GraphicsPath btnPath = new System.Drawing.Drawing2D.GraphicsPath();

    System.Drawing.Rectangle newRectangle = btn.ClientRectangle;

    newRectangle.Inflate(-1, -1);

    e.Graphics.DrawEllipse(System.Drawing.Pens.BlanchedAlmond, newRectangle);

    newRectangle.Inflate(-1, -1);

    btnPath.AddEllipse(newRectangle);

    btn.Region = new System.Drawing.Region(btnPath);

}

使用按钮的Paint事件

你可能感兴趣的:(ROM)