Exemple #1
0
        /// <summary>
        /// 描画オーバーライド
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(PaintEventArgs e)
        {
            if (Enabled)
            {
                base.OnPaint(e);
            }
            else
            {
                e.Graphics.FillRectangle(new SolidBrush(disabledBackColor), DisplayRectangle);
                StringFormat strform = CommonProc.ConvertAlignmentProperty(TextAlign);
                e.Graphics.DrawString(Text, Font, new SolidBrush(disabledForeColor), DisplayRectangle, strform);
            }
            if (RoundFrame)
            {
                Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
                // 角丸長方形のGraphicsPathを作成します。
                GraphicsPath path = CommonProc.GetRoundRect(rect, 5);

                //Panelの形を角丸長方形に変更
                //this.Region = new Region(path);
                e.Graphics.DrawPath(new Pen(Color.Black, 2.0f), path);
            }
            else
            {
                Rectangle rect = new Rectangle(0, 0, this.Width, this.Height);
                e.Graphics.DrawRectangle(new Pen(Color.Black, 2.0f), rect);
            }
        }
Exemple #2
0
        private void CustomControl_TextBoxBase_SizeChanged(object sender, EventArgs e)
        {
            //Panelの形を角丸長方形に変更
            GraphicsPath rpath = CommonProc.GetRoundRect(DisplayRectangle, 5);

            this.Region = new Region(rpath);
        }
Exemple #3
0
        private void CustomControl_UpDown_SizeChanged(object sender, EventArgs e)
        {
            // 角丸長方形のGraphicsPathを作成します。
            GraphicsPath path = CommonProc.GetRoundRect(DisplayRectangle, 5);

            //Panelの形を角丸長方形に変更
            this.Region = new Region(path);
        }
Exemple #4
0
        private void refreshFrame()
        {
            if (roundFrame)
            {
                // 角丸長方形のGraphicsPathを作成します。
                GraphicsPath path = CommonProc.GetRoundRect(DisplayRectangle, 5);

                //形を角丸長方形に変更
                this.Region = new Region(path);
            }
            else
            {//普通の長方形
                this.Region = new Region(DisplayRectangle);
            }
        }
Exemple #5
0
        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();
        }
Exemple #6
0
 /// <summary>
 /// 描画オーバーライド
 /// </summary>
 /// <param name="pe"></param>
 protected override void OnPaint(PaintEventArgs pe)
 {
     if (Enabled)
     {
         base.OnPaint(pe);
     }
     else
     {//非活性のときだけ自分で描く・・・
         pe.Graphics.FillRectangle(new SolidBrush(disabledBackColor), DisplayRectangle);
         StringFormat strform = CommonProc.ConvertAlignmentProperty(TextAlign);
         pe.Graphics.DrawString(Text, Font, new SolidBrush(disabledForeColor), DisplayRectangle, strform);
     }
     if (BorderStyle == BorderStyle.None)
     {//BorderStyle != Noneのときは描かない
         //Panelの形を角丸長方形に変更
         Rectangle dstRect = new Rectangle(0, 0, this.Width - 1, this.Height - 1);
         pe.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
         GraphicsPath path = CommonProc.GetRoundRect(dstRect, 5);
         pe.Graphics.DrawPath(new Pen(borderColor, 1.5f), path);
     }
 }
Exemple #7
0
 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));
 }