DrawFrame() публичный статический Метод

public static DrawFrame ( Graphics dc, RectangleF r, float cornerRadius, Color color ) : void
dc System.Drawing.Graphics
r System.Drawing.RectangleF
cornerRadius float
color Color
Результат void
Пример #1
0
        protected override void OnPaint(PaintEventArgs e)
        {
            using (SolidBrush b = new SolidBrush(BackColor))
            {
                e.Graphics.FillRectangle(b, ClientRectangle);
            }
            RectangleF wheelrect = WheelRectangle;

            Util.DrawFrame(e.Graphics, wheelrect, 6, m_frameColor);

            wheelrect = ColorWheelRectangle;
            PointF center = Util.Center(wheelrect);

            e.Graphics.SmoothingMode = SmoothingMode.HighSpeed;
            if (m_brush == null)
            {
                m_brush                = new PathGradientBrush(m_path.ToArray(), WrapMode.Clamp);
                m_brush.CenterPoint    = center;
                m_brush.CenterColor    = Color.White;
                m_brush.SurroundColors = m_colors.ToArray();
            }
            e.Graphics.FillPie(m_brush, Util.Rect(wheelrect), 0, 360);
            DrawColorSelector(e.Graphics);

            if (Focused)
            {
                RectangleF r = WheelRectangle;
                r.Inflate(-2, -2);
                ControlPaint.DrawFocusRectangle(e.Graphics, Util.Rect(r));
            }
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            //base.OnPaint(e);
            Rectangle r = WindowRectangle;

            r.Width--;
            r.Height--;
            Util.DrawFrame(e.Graphics, r, 6, Color.CadetBlue);

            e.Graphics.DrawImage(PopupContainerImages.Image(PopupContainerImages.eIndexes.Close), CancelButtonRect);
            e.Graphics.DrawImage(PopupContainerImages.Image(PopupContainerImages.eIndexes.Check), AcceptButtonRect);
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Rectangle rr = ClientRectangle;

            if (m_snapshot != null)
            {
                e.Graphics.InterpolationMode = InterpolationMode.NearestNeighbor;
                RectangleF r = RectangleF.Empty;
                r.Width  = m_snapshot.Size.Width * Zoom;
                r.Height = m_snapshot.Size.Height * Zoom;
                r.X      = 0;
                r.Y      = 0;
                e.Graphics.DrawImage(m_snapshot, r);

                if (iscapturing)
                {
                    PointF    center     = Util.Center(r);
                    Rectangle centerrect = new Rectangle(Util.Point(center), new Size(0, 0));
                    centerrect.X     -= ((int)Zoom / 2 - 1);
                    centerrect.Y     -= ((int)Zoom / 2 - 1);
                    centerrect.Width  = (int)Zoom;
                    centerrect.Height = (int)Zoom;
                    e.Graphics.DrawRectangle(Pens.Black, centerrect);
                }
                else
                {
                    int offset = 3;
                    e.Graphics.FillRectangle(SystemBrushes.Control, new Rectangle(new Point(offset, offset), m_icon.Size));
                    e.Graphics.DrawImage(m_icon, offset, offset);
                }
            }
            Pen pen = new Pen(BackColor, 3);

            rr.Inflate(-1, -1);
            e.Graphics.DrawRectangle(pen, rr);
            Util.DrawFrame(e.Graphics, rr, 6, Color.CadetBlue);
        }
Пример #4
0
        protected override void OnPaint(PaintEventArgs e)
        {
            using (SolidBrush b = new SolidBrush(BackColor))
            {
                e.Graphics.FillRectangle(b, ClientRectangle);
            }

            RectangleF lr       = ClientRectangleF;
            Pen        framepen = new Pen(m_frameColor, 1);

            Util.DrawFrame(e.Graphics, lr, 6, m_frameColor);
            if (Text.Length > 0)
            {
                StringFormat format    = new StringFormat();
                string       alignment = TextAlign.ToString();

                if (((int)TextAlign & (int)(ContentAlignment.BottomLeft | ContentAlignment.MiddleLeft | ContentAlignment.TopLeft)) != 0)
                {
                    format.Alignment = StringAlignment.Near;
                }

                if (((int)TextAlign & (int)(ContentAlignment.BottomCenter | ContentAlignment.MiddleCenter | ContentAlignment.TopCenter)) != 0)
                {
                    format.Alignment = StringAlignment.Center;
                }

                if (((int)TextAlign & (int)(ContentAlignment.BottomRight | ContentAlignment.MiddleRight | ContentAlignment.TopRight)) != 0)
                {
                    format.Alignment = StringAlignment.Far;
                }

                if (((int)TextAlign & (int)(ContentAlignment.BottomLeft | ContentAlignment.BottomCenter | ContentAlignment.BottomRight)) != 0)
                {
                    format.LineAlignment = StringAlignment.Far;
                }

                if (((int)TextAlign & (int)(ContentAlignment.MiddleLeft | ContentAlignment.MiddleCenter | ContentAlignment.MiddleRight)) != 0)
                {
                    format.LineAlignment = StringAlignment.Center;
                }

                if (((int)TextAlign & (int)(ContentAlignment.TopLeft | ContentAlignment.TopCenter | ContentAlignment.TopRight)) != 0)
                {
                    format.LineAlignment = StringAlignment.Near;
                }

                Rectangle r = ClientRectangle;
                r.X      += Padding.Left;
                r.Y      += Padding.Top;
                r.Width  -= Padding.Right;
                r.Height -= Padding.Bottom;

                using (SolidBrush b = new SolidBrush(ForeColor))
                {
                    if (TextAngle == 0)
                    {
                        e.Graphics.DrawString(Text, Font, b, r, format);
                    }
                    else
                    {
                        PointF center = Util.Center(ClientRectangle);
                        switch (RotatePointAlignment)
                        {
                        case ContentAlignment.TopLeft:
                            center.X = r.Left;
                            center.Y = r.Top;
                            break;

                        case ContentAlignment.TopCenter:
                            center.Y = r.Top;
                            break;

                        case ContentAlignment.TopRight:
                            center.X = r.Right;
                            center.Y = r.Top;
                            break;

                        case ContentAlignment.MiddleLeft:
                            center.X = r.Left;
                            break;

                        case ContentAlignment.MiddleCenter:
                            break;

                        case ContentAlignment.MiddleRight:
                            center.X = r.Right;
                            break;

                        case ContentAlignment.BottomLeft:
                            center.X = r.Left;
                            center.Y = r.Bottom;
                            break;

                        case ContentAlignment.BottomCenter:
                            center.Y = r.Bottom;
                            break;

                        case ContentAlignment.BottomRight:
                            center.X = r.Right;
                            center.Y = r.Bottom;
                            break;
                        }
                        center.X += Padding.Left;
                        center.Y += Padding.Top;
                        center.X -= Padding.Right;
                        center.Y -= Padding.Bottom;

                        e.Graphics.TranslateTransform(center.X, center.Y);
                        e.Graphics.RotateTransform(TextAngle);

                        e.Graphics.DrawString(Text, Font, b, new PointF(0, 0), format);
                        e.Graphics.ResetTransform();
                    }
                }
            }
            RaisePaintEvent(this, e);
        }