コード例 #1
0
ファイル: CCheckBox.cs プロジェクト: weinre/ChurSkin
        //Alpha alpha = Alpha.Normal;
        //Color bdcolor { get { return Color.FromArgb((int)Alpha.a180, bgColor.R, bgColor.G, bgColor.B); } }
        //Color color { get { return Color.FromArgb((int)alpha, bgColor.R, bgColor.G, bgColor.B); } }
        //Color bgColor = Share.BackColor;
        //public Color BgColor { get { return bgColor; } set { bgColor = value; this.Invalidate(); } }

        protected override void OnPaint(PaintEventArgs pevent)
        {
            if (!DesignMode && !Visible)
            {
                return;
            }
            var g = pevent.Graphics;

            //g.SmoothingMode = SmoothingMode.AntiAlias;
            //g.TextRenderingHint = TextRenderingHint.AntiAlias;
            Share.GraphicSetup(g);
            if (!Checked)
            {
                using (var sb = new SolidBrush(BgColor))
                {
                    g.FillPath(sb, radioPath);
                }
                using (var p = new Pen(borderColor, 1))
                {
                    g.DrawPath(p, radioPath);
                }
                //g.DrawPath(new Pen(Color.White, 1.8f), gp);
            }
            else
            {
                using (var sb = new SolidBrush(Share.FocusBackColor))
                {
                    g.FillPath(sb, radioPath);
                    var p = new Pen(Share.FocusBackColor, 1);
                    g.DrawPath(p, radioPath);
                    p.Dispose();
                }
                using (var p = new Pen(Share.BackColor, 1.55f))
                {
                    g.DrawPath(p, CheckPath);
                }
            }
            var TextRect = new Rectangle(radioRect.Width + 3, (int)(Height - g.MeasureString(Text, Font).Height) / 2,
                                         Width - radioRect.Width - 3, Height);

            //TextRenderer.DrawText(g, base.Text, base.Font, TextRect, base.ForeColor, TextFormatFlags.VerticalCenter |
            //                       TextFormatFlags.Left |
            //                       TextFormatFlags.SingleLine);
            if (Text != "")
            {
                DrawHelper.DrawCaptionText(g, TextRect, Text, Font, true, Color.White, 3, ForeColor);
            }

            radioPath.Dispose();
            CheckPath.Dispose();
        }
コード例 #2
0
ファイル: CGroupBox.cs プロジェクト: weinre/ChurSkin
        //protected override CreateParams CreateParams
        //{
        //    get
        //    {
        //        CreateParams cp = base.CreateParams;
        //        cp.ExStyle |= 0x02000000;
        //        return cp;
        //    }
        //}
        protected override void OnPaint(PaintEventArgs e)
        {
            Share.GraphicSetup(e.Graphics);
            // SolidBrush sb = new SolidBrush(color);

            // e.Graphics.FillPath(sb, gp);
            //sb.Dispose();
            //sb = null;
            var r       = 8;
            var arcRect = new Rectangle(1, 7, r, r);

            var pen = new Pen(borderColor, 1);
            //e.Graphics.DrawString(base.Text, base.Font, Brushes.Black, 10, 1);
            var sz       = TextRenderer.MeasureText(Text, Font);
            var textRect = new Rectangle(10, 1, sz.Width, sz.Height);

            if (Text != "")
            {
                DrawHelper.DrawCaptionText(e.Graphics, textRect, Text, Font, true, Color.White, 3, ForeColor);
            }

            // 左上角
            e.Graphics.DrawArc(pen, arcRect, 180, 90);

            //// 右上角
            arcRect.X = Width - r - 1;
            e.Graphics.DrawArc(pen, arcRect, 270, 90);

            //// 右下角
            arcRect.Y = Height - r - 1;
            e.Graphics.DrawArc(pen, arcRect, 0, 90);

            // 左下角
            arcRect.X = 1;
            e.Graphics.DrawArc(pen, arcRect, 90, 90);

            e.Graphics.DrawLine(pen, 4, 7, 8, 7);                                                      //左上横
            e.Graphics.DrawLine(pen, e.Graphics.MeasureString(Text, Font).Width + 8, 7, Width - 6, 7); //右上横
            e.Graphics.DrawLine(pen, 1, 11, 1, Height - 6);                                            //左竖
            e.Graphics.DrawLine(pen, 6, Height - 1, Width - 6, Height - 1);                            //下横
            e.Graphics.DrawLine(pen, Width - 1, 11, Width - 1, Height - 6);                            //右竖
            pen.Dispose();
            //pen = null;
        }
コード例 #3
0
ファイル: CLabel.cs プロジェクト: weinre/ChurSkin
        protected override void OnPaint(PaintEventArgs e)
        {
            //base.OnPaint(e);
            if (showBorder)
            {
                Share.GraphicSetup(e.Graphics);
                e.Graphics.SetClip(rectPath);
                var pen = new Pen(Share.BorderColor);
                var sb  = new SolidBrush(Share.BackColor);
                e.Graphics.FillPath(sb, rectPath);
                e.Graphics.DrawPath(pen, rectPath);
                pen.Dispose();
                sb.Dispose();
            }
            var sz = TextRenderer.MeasureText(Text, Font);

            //Rectangle textRect = new Rectangle(base.Padding.Left, base.Padding.Top,
            //    base.Padding.Left + base.Padding.Right + sz.Width + base.Margin.Left,
            //   base.Padding.Left + sz.Height);
            //if (base.Text != "")
            DrawHelper.DrawCaptionText(e.Graphics, ClientRectangle, Text, Font, true, Color.White, 3, ForeColor);
        }
コード例 #4
0
ファイル: CRadioButton.cs プロジェクト: weinre/ChurSkin
        protected override void OnPaint(PaintEventArgs pevent)
        {
            var g = pevent.Graphics;

            Share.GraphicSetup(g);

            var sb = new SolidBrush(Share.FocusBackColor);
            var p  = new Pen(Share.FocusBackColor);

            if (Checked)
            {
                g.FillEllipse(sb, radioRect);
                g.DrawEllipse(p, radioRect);
                sb.Color = Share.BackColor;
                g.FillEllipse(sb, innerRadioRect);
            }
            else
            {
                sb.Color = bgColor;
                g.FillEllipse(sb, radioRect);
                p.Color = borderColor;
                g.DrawEllipse(p, radioRect);
            }
            sb.Dispose();
            p.Dispose();
            //TextRenderer.DrawText(g, base.Text, base.Font, TextRect, base.ForeColor, TextFormatFlags.VerticalCenter |
            //                       TextFormatFlags.Left |
            //                       TextFormatFlags.SingleLine);
            if (Text != "")
            {
                var TextRect = new RectangleF(radioRect.Width + 3f,
                                              ((float)Height - g.MeasureString(Text, Font).Height) / 2f + .5f,
                                              Width - radioRect.Width - 3f, Height);
                DrawHelper.DrawCaptionText(g, TextRect, Text, Font, true, Color.White, 3, ForeColor);
            }
        }