private void CustomControl_UpDown_SizeChanged(object sender, EventArgs e) { // 角丸長方形のGraphicsPathを作成します。 GraphicsPath path = CommonProc.GetRoundRect(DisplayRectangle, 5); //Panelの形を角丸長方形に変更 this.Region = new Region(path); }
private void buttonText_Paint(object sender, PaintEventArgs e) { Rectangle rect = new Rectangle(0, 0, this.Width, this.Height); GraphicsPath path = CommonProc.GetRoundRect(rect, 5); //ペン作成 Pen linePen = new Pen(Color.Black, 2); // フォームに描画します。 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawPath(linePen, path); //ペン削除 linePen.Dispose(); }
private void CustomControl_UpDown_Paint(object sender, PaintEventArgs e) { // フォームに描画します。 e.Graphics.SmoothingMode = SmoothingMode.AntiAlias; e.Graphics.DrawPath(new Pen(Color.Black, 2.0f), CommonProc.GetRoundRect(DisplayRectangle, 5)); }