Пример #1
0
 protected override void OnClick(EventArgs e)
 {
     this.pressed = true;
     Rectangle rec = new Rectangle();
     System.Windows.Forms.PaintEventArgs paintEvent
         = new System.Windows.Forms.PaintEventArgs(this.CreateGraphics(),rec);
     this.OnPaint(paintEvent);
     base.OnClick(e);
 }
Пример #2
0
        internal void Draw(PaintEventArgs pe, int nX, int nY, int nSide)
        {
            nX += 8;
            nY += 8;

            int nPenWidth = Math.Max (nSide / 15, 1);

            Color clr =Color.Blue;

            Brush brsh = brush == Selected.YES ? not_selected_color : selected_color;

            using (Pen aPen = new Pen(clr, nPenWidth)) {
                pe.Graphics.DrawEllipse (aPen, nX, nY, nSide, nSide);
                pe.Graphics.FillEllipse (brsh, nX, nY, nSide, nSide);
            }
        }
Пример #3
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            if (inOnPaint)
            {
                Console.WriteLine("Was in onpaint Gmap th:" + System.Threading.Thread.CurrentThread.Name + " in " + otherthread);
                return;
            }

            otherthread = System.Threading.Thread.CurrentThread.Name;

            inOnPaint = true;

            try
            {
                base.OnPaint(e);
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); }

            inOnPaint = false;
        }
Пример #4
0
        private void m_colorSample_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Rectangle r = m_colorSample.ClientRectangle;

            r.Inflate(-4, -4);

            int width = r.Width;

            r.Width /= 2;

            Color c = Color.FromArgb(m_selectedColor.R, m_selectedColor.G, m_selectedColor.B);

            e.Graphics.FillRectangle(c, r);

            r.X += r.Width;

            e.Graphics.FillRectangle(Color.White, r);
            c = Color.FromArgb(255, m_selectedColor);
            e.Graphics.FillRectangle(c, r);
        }
Пример #5
0
        protected override void CalculateBounds(System.Windows.Forms.PaintEventArgs e)
        {
            if (tools.Count == 1)
            {
                PaintLibrary.Button(e, new Point(0, 0), Size, this.Text, highlightedButton == tools[0]);
            }
            else if (tools.Count > 1)
            {
                const int PADDING = 4;

                Size  size     = new Size((Size.Width / tools.Count) - PADDING, Size.Height);
                Point location = new Point(0, 0);

                foreach (ToolButton tool in tools)
                {
                    tool.Bounds = new Rectangle(location, size);
                    location.X += PADDING + size.Width;
                }
            }
        }
Пример #6
0
        protected override void  OnPaint(System.Windows.Forms.PaintEventArgs g_EventArg)
        {
            System.Drawing.Graphics g = null;
            if (g_EventArg != null)
            {
                g = g_EventArg.Graphics;
            }
            System.Drawing.Size sz = Size;
            //UPGRADE_WARNING: Data types in Visual C# might be different.  Verify the accuracy of narrowing conversions. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1042'"
            //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Dimension.getWidth' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            //UPGRADE_TODO: The equivalent in .NET for method 'java.awt.Dimension.getHeight' may return a different value. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1043'"
            int width = (int)sz.Width, height = (int)sz.Height;

            SupportClass.GraphicsManager.manager.SetColor(g, Color.White);
            g.FillRectangle(SupportClass.GraphicsManager.manager.GetPaint(g), 0, 0, width, height);
            SupportClass.GraphicsManager.manager.SetColor(g, Color.Black);
            g.DrawRectangle(SupportClass.GraphicsManager.manager.GetPen(g), 0, 0, width, height);

            base.OnPaint(g_EventArg);
        }
Пример #7
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs pe)
        {
            var graphics = pe.Graphics;

            graphics.Clear(this.BackColor);

            Image temp_Image = null;

            Job.Status status = job.get_Status(DateTime.Now);
            switch (status)
            {
            case Job.Status.Beyond_The_Limit:
                temp_Image = Form_Reminder.white_Border;
                break;

            case Job.Status.End:
                temp_Image = Form_Reminder.red_Border;
                break;

            case Job.Status.Middle:
                temp_Image = Form_Reminder.pink_Border;
                break;

            case Job.Status.Start:
                temp_Image = Form_Reminder.green_Border;
                break;
            }
            graphics.DrawImage(temp_Image, 0, 0, this.Width, this.Height);
            //graphics.DrawImage(image, 2*border_In_Horizontal, 2*border_In_Vertical, this.Width-(4*border_In_Horizontal), (Convert.ToInt32(this.Height * 0.6))-(2*border_In_Vertical));
            graphics.DrawImage(image, 2 * border_In_Horizontal, 2 * border_In_Vertical, this.Width - (4 * border_In_Horizontal), (Convert.ToInt32(this.Height * 0.6)) - (2 * border_In_Vertical));

            System.Drawing.SolidBrush   solid_Brush = new SolidBrush(string_Color);
            System.Drawing.Font         temp_Font   = new System.Drawing.Font("Verdana", 8, FontStyle.Bold);
            System.Drawing.SizeF        temp_Size   = graphics.MeasureString(job.subject, temp_Font);
            System.Drawing.StringFormat temp_Format = new System.Drawing.StringFormat();
            temp_Format.FormatFlags = StringFormatFlags.LineLimit;
            temp_Format.Alignment   = System.Drawing.StringAlignment.Center;
            System.Drawing.RectangleF temp_Rectangle = new System.Drawing.RectangleF(border_In_Horizontal, (float)(this.Height * 0.6) + border_In_Vertical, (float)this.Width - (2 * border_In_Horizontal), (float)(this.Height * 0.4) - (2 * border_In_Vertical));

            graphics.DrawString(job.subject, temp_Font, solid_Brush, temp_Rectangle, temp_Format);
        }
Пример #8
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Receives a call when the control that the designer is managing has painted its
        /// surface so the designer can paint any additional adornments on top of the control.
        /// </summary>
        /// <param name="pe">A <see cref="T:System.Windows.Forms.PaintEventArgs"></see> the
        /// designer can use to draw on the control.</param>
        /// ------------------------------------------------------------------------------------
        protected override void OnPaintAdornments(System.Windows.Forms.PaintEventArgs pe)
        {
            base.OnPaintAdornments(pe);

            Rectangle progressBarRectangle = Control.ClientRectangle;
            int       valueToPaint         = (int)(0.5 * (double)progressBarRectangle.Width);

            Color foreColor2            = (Color)ShadowProperties["ForeColor2"];
            LinearGradientMode gradMode = (LinearGradientMode)ShadowProperties["LinearGradientMode"];

            using (Brush backBrush = new SolidBrush(Control.BackColor))
            {
                Brush foreBrush;
                if (foreColor2 == Color.Transparent)
                {
                    foreBrush = new SolidBrush(Control.ForeColor);
                }
                else
                {
                    foreBrush = new LinearGradientBrush(
                        new Rectangle(0, 0, valueToPaint, Control.Height),
                        Control.ForeColor, foreColor2, gradMode);
                }

                try
                {
                    // Paint the progress
                    progressBarRectangle.Width = valueToPaint;
                    pe.Graphics.FillRectangle(foreBrush, progressBarRectangle);

                    // Paint the rest of our control
                    progressBarRectangle.Width = Control.ClientRectangle.Width - valueToPaint;
                    progressBarRectangle.X     = valueToPaint + 1;
                    pe.Graphics.FillRectangle(backBrush, progressBarRectangle);
                }
                finally
                {
                    foreBrush.Dispose();
                }
            }
        }
Пример #9
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs args)
        {
            base.OnPaint(args);

            var tmpGradientBounds = new System.Drawing.Rectangle(0, 0, this.Width, this.Height);
            var tmpGradientBrush  = new LinearGradientBrush(tmpGradientBounds, this.startColor, this.endColor, 0, true);

            tmpGradientBrush.GammaCorrection = true;
            args.Graphics.FillRectangle(tmpGradientBrush, 0, 0, this.Width, this.Height);

            tmpGradientBounds = new System.Drawing.Rectangle(0, 0, 8, this.Height);
            tmpGradientBrush  = new LinearGradientBrush(tmpGradientBounds, this.BackColor, Color.Transparent, 0, true);
            tmpGradientBrush.GammaCorrection = true;

            if (showFlashBars)
            {
                var tmpRandom = new System.Random(unchecked ((int)System.DateTime.Now.Ticks));
                for (int index = 0; index < this.splashBars; index++)
                {
                    args.Graphics.FillRectangle(tmpGradientBrush, tmpRandom.Next(this.Width - 20), 0, tmpRandom.Next(10) + 10, this.Height);
                }
            }
            else
            {
                args.Graphics.FillRectangle(tmpGradientBrush, 0, 0, 0, this.Height);
            }

            args.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
            args.Graphics.DrawString(this.flashBarTitle, this.titleFont, new SolidBrush(this.ForeColor), this.TextStartPosition);

            this.DrawMessage(args.Graphics);

            if (this.imageObject != null)
            {
                this.DrawImage(args.Graphics);
            }
            else if (this.iconObject != null)
            {
                this.DrawIcon(args.Graphics);
            }
        }
Пример #10
0
        private void Form4_Paint(object sender, System.Windows.Forms.PaintEventArgs e)

        {
            Graphics g = e.Graphics;



            PointF[] cur1 = new PointF[150];

            for (int i = 0; i < cur1.Length; i++)

            {
                double x = (double)i / 5;

                double y = Math.Sin(x) * 3 + Math.Cos(3 * x);

                cur1[i] = new PointF((float)i, (float)(y * 10 + 100));
            }

            g.DrawLines(Pens.Blue, cur1);



            PointF[] cur2 = new PointF[100];

            for (int i = 0; i < cur2.Length; i++)

            {
                double theta = Math.PI / 50 * i;

                double r = Math.Cos(theta * 16);

                cur2[i] = new PointF(

                    (float)(r * Math.Cos(theta) * 50 + 230),

                    (float)(r * Math.Sin(theta) * 50 + 100));
            }

            g.DrawLines(Pens.Blue, cur2);
        }
Пример #11
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            index = (index % 8);
            System.Drawing.Image tmp = new System.Drawing.Bitmap(1, 1);
            switch (index)
            {
            case 0:
                tmp = All.Properties.Resources._1;
                break;

            case 1:
                tmp = All.Properties.Resources._2;
                break;

            case 2:
                tmp = All.Properties.Resources._3;
                break;

            case 3:
                tmp = All.Properties.Resources._4;
                break;

            case 4:
                tmp = All.Properties.Resources._5;
                break;

            case 5:
                tmp = All.Properties.Resources._6;
                break;

            case 6:
                tmp = All.Properties.Resources._7;
                break;

            case 7:
                tmp = All.Properties.Resources._8;
                break;
            }
            e.Graphics.DrawImage(tmp, new System.Drawing.Rectangle(0, 0, this.Width, this.Height), new System.Drawing.Rectangle(0, 0, tmp.Width, tmp.Height), System.Drawing.GraphicsUnit.Pixel);
            base.OnPaint(e);
        }
Пример #12
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            Graphics g = e.Graphics;

            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            PointF[] drawPoint = new PointF[3];

            //TRIANGLE_DIRECTIONに応じて三角形を描画
            switch (TRIANGLE_DIRECTION)
            {
            case TriangleDirection.Up:
                drawPoint[0] = new PointF((this.ClientSize.Width - 1.0f) / 2.0f, (this.ClientSize.Height - 1.0f) / 4.0f);
                drawPoint[1] = new PointF((this.ClientSize.Width - 1.0f) / 6.0f, (this.ClientSize.Height - 1.0f) * 3.0f / 4.0f);
                drawPoint[2] = new PointF((this.ClientSize.Width - 1.0f) * 5.0f / 6.0f, (this.ClientSize.Height - 1.0f) * 3.0f / 4.0f);
                g.FillPolygon(new SolidBrush(TRIANGLE_COLOR), drawPoint);
                break;

            case TriangleDirection.Down:
                drawPoint[0] = new PointF((this.ClientSize.Width - 1.0f) / 2.0f, (this.ClientSize.Height - 1.0f) * 3.0f / 4.0f);
                drawPoint[1] = new PointF((this.ClientSize.Width - 1.0f) / 6.0f, (this.ClientSize.Height - 1.0f) / 4.0f);
                drawPoint[2] = new PointF((this.ClientSize.Width - 1.0f) * 5.0f / 6.0f, (this.ClientSize.Height - 1.0f) / 4.0f);
                g.FillPolygon(new SolidBrush(TRIANGLE_COLOR), drawPoint);
                break;

            case TriangleDirection.Left:
                drawPoint[0] = new PointF((this.ClientSize.Width - 1.0f) * 3.0f / 4.0f, (this.ClientSize.Height - 1.0f) / 6.0f);
                drawPoint[1] = new PointF((this.ClientSize.Width - 1.0f) * 3.0f / 4.0f, (this.ClientSize.Height - 1.0f) * 5.0f / 6.0f);
                drawPoint[2] = new PointF((this.ClientSize.Width - 1.0f) / 4.0f, (this.ClientSize.Height - 1.0f) / 2.0f);
                g.FillPolygon(new SolidBrush(TRIANGLE_COLOR), drawPoint);
                break;

            case TriangleDirection.Right:
                drawPoint[0] = new PointF((this.ClientSize.Width - 1.0f) / 4.0f, (this.ClientSize.Height - 1.0f) / 6.0f);
                drawPoint[1] = new PointF((this.ClientSize.Width - 1.0f) / 4.0f, (this.ClientSize.Height - 1.0f) * 5.0f / 6.0f);
                drawPoint[2] = new PointF((this.ClientSize.Width - 1.0f) * 3.0f / 4.0f, (this.ClientSize.Height - 1.0f) / 2.0f);
                g.FillPolygon(new SolidBrush(TRIANGLE_COLOR), drawPoint);
                break;
            }
        }
Пример #13
0
        public override void Ciz(System.Windows.Forms.PaintEventArgs e, Point?bas, Point ana)
        {
            Brush br = new SolidBrush(renk);

            if (bas != null)
            {
                //merkez : bas olsun. ana'dan çıkaralım onu 3'e 60 derecelik açılarla bölelim.
                //int x = Math.Min(bas.Value.X, ana.X);
                int x  = bas.Value.X;
                int y  = bas.Value.Y;
                int rx = Math.Abs(bas.Value.X - ana.X);
                int ry = Math.Abs(bas.Value.Y - ana.Y);
                Sinir.SinirCek(ref x, ref y);
                var x_0   = x;
                var y_0   = y;
                var shape = new PointF[6];
                var r     = rx;
                for (int a = 0; a < 6; a++)
                {
                    shape[a] = new PointF(
                        x_0 + r * (float)Math.Cos(a * 60 * Math.PI / 180f),
                        y_0 + r * (float)Math.Sin(a * 60 * Math.PI / 180f));
                    Point ch = (new Point(Convert.ToInt16(shape[a].X), Convert.ToInt16(shape[a].Y)));
                    if (!Sinir.Tasmadi(ch))
                    {
                        a = -1;
                        if (r <= 0)
                        {
                            r = rx; break;
                        }
                        else
                        {
                            r--;
                        }
                        continue;
                    }
                }
                SekilYerGoster(new Point(x, y), ana.X, ana.Y);
                e.Graphics.FillPolygon(br, shape);
            }
        }
Пример #14
0
        private static void OnPaint_Label(System.Windows.Forms.Label pLabel, System.Windows.Forms.PaintEventArgs e)
        {
            if (pLabel.Tag == null || (pLabel.Tag != null && !pLabel.Tag.Equals("SemRenderizacao")))
            {
                using (GradualAntiAlias xaa = new GradualAntiAlias(e.Graphics))
                {
                    using (System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(pLabel.ClientRectangle, StyleSettings.Label_BackGround_Color_Start, StyleSettings.Label_BackGround_Color_Finish, 45F))
                    {
                        e.Graphics.FillRectangle(brush, pLabel.ClientRectangle);

                        e.Graphics.DrawRectangle(
                            new System.Drawing.Pen(
                                new System.Drawing.SolidBrush(StyleSettings.Panel_BackGround_Color_Start), 0.5F),
                            e.ClipRectangle);

                        Int32 numAlign = (Int32)Math.Log((Double)pLabel.TextAlign, 2);
                        System.Drawing.StringFormat formatoLabel = new System.Drawing.StringFormat()
                        {
                            Alignment = (System.Drawing.StringAlignment)(numAlign % 4), LineAlignment = (System.Drawing.StringAlignment)(numAlign / 4)
                        };

                        if (pLabel.Image != null)
                        {
                            if (string.IsNullOrEmpty(pLabel.Text))
                            {
                                e.Graphics.DrawImage(pLabel.Image, new System.Drawing.Rectangle(pLabel.ClientRectangle.X + StyleSettings.DeslocaImagem_Label, pLabel.ClientRectangle.Y + StyleSettings.DeslocaImagem_Label, pLabel.Image.Width, pLabel.Image.Height));
                            }
                            else
                            {
                                //e.Graphics.DrawImage(pLabel.Image, new System.Drawing.Rectangle(pLabel.ClientRectangle.X + StyleSettings.DeslocaImagem_Label, pLabel.ClientRectangle.Y + StyleSettings.DeslocaImagem_Label, pLabel.Image.Width, pLabel.Image.Height));
                                e.Graphics.DrawString(pLabel.Text, pLabel.Font, StyleSettings.Brush_Txt_Botao, pLabel.ClientRectangle, formatoLabel);
                            }
                        }
                        else
                        {
                            e.Graphics.DrawString(pLabel.Text, pLabel.Font, StyleSettings.Brush_Txt_Label, pLabel.ClientRectangle, formatoLabel);
                        }
                    }
                }
            }
        }
Пример #15
0
        protected override void OnDrawBackground(
            System.Windows.Forms.PaintEventArgs e)
        {
            float    bbp = 4 * AnchorPoint.Radius + 5;
            Graphics g   = e.Graphics;

            g.FillPath(sHeadBrush, this.mHeadPath);
            g.FillPath(sBodyBrush, this.mBodyPath);
            sBorderPen.Color = this.Selected
                ? sBorderSelectColor : (this.InEditMode
                ? sBorderInEditColor : sBorderNormalColor);
            g.DrawPath(sBorderPen, this.mBorderPath);
            RectangleF bbox = this.BoundingBox;

            bbox.X      = 2.5f;
            bbox.Y      = 2.5f;
            bbox.Width  = bbox.Width - bbp;
            bbox.Height = this.mHeadMGH;
            if (!string.IsNullOrEmpty(this.mParamString))
            {
                g.DrawString(this.mParamString, sHeadFont,
                             sHeadTextBrush, bbox, TextFormat);
            }
            bbox.Y      = bbox.Y + this.mHeadMGH;
            bbox.Height = this.mBodyMGH;
            if (this.mCaseCount > 0)
            {
                string caseString;

                for (int i = 0; i < this.mCaseCount; i++)
                {
                    caseString = this.mCaseStrings[i];
                    if (!string.IsNullOrEmpty(caseString))
                    {
                        g.DrawString(caseString, sBodyFont,
                                     sBodyTextBrush, bbox, TextFormat);
                    }
                    bbox.Y = bbox.Y + this.mBodyMGH;
                }
            }
        }
Пример #16
0
        private void ASCOnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            G = e.Graphics;
            G.SmoothingMode = Smoothing;
            G.Clear(Parent.BackColor);

            Height = 17;

            Rectangle boxRect = new Rectangle(1, 1, Height - 3, Height - 3);

            G.DrawEllipse(new Pen(Color.FromArgb(30, 140, 240), 2), boxRect);

            int textY = ((Height - 1) / 2) - Convert.ToInt32((G.MeasureString(Text, Font).Height / 2));

            G.DrawString(Text, Font, new SolidBrush(ForeColor), new Point((Height - 1) + 4, textY));

            if (_checked)
            {
                G.DrawString("a", new Font("Marlett", 17), new SolidBrush(Color.FromArgb(120, 180, 255)), new Point(-3, -5));
            }
        }
Пример #17
0
        //重写OnPaint
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Drawing2D.GraphicsPath path = new System.Drawing.Drawing2D.GraphicsPath();
            path.AddEllipse(0, 0, Diameter, Diameter);
            this.Region = new Region(path);

            Graphics g = e.Graphics;

            g.InterpolationMode  = InterpolationMode.HighQualityBilinear;
            g.CompositingQuality = CompositingQuality.HighQuality;
            g.PixelOffsetMode    = PixelOffsetMode.HighQuality;
            g.SmoothingMode      = SmoothingMode.AntiAlias;
            //g.Clear(Color.White);


            DrawImage(g);

            DrawBorder(g);

            //base.OnPaint(e);
        }
Пример #18
0
        private void Form1_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            int w = this.Width;

            System.Drawing.Pen pen = System.Drawing.Pens.Black;
            e.Graphics.Clear(System.Drawing.Color.White);
            if (0 <= this.originY && this.originY <= this.Height)
            {
                e.Graphics.DrawLine(System.Drawing.Pens.Blue, 0, (float)this.originY, w, (float)this.originY);
            }
            if (0 <= this.originX && this.originX <= this.Width)
            {
                e.Graphics.DrawLine(System.Drawing.Pens.Blue, (float)this.originX, 0, (float)this.originX, this.Height);
            }
            System.Drawing.PointF[] points = new System.Drawing.PointF[w];
            foreach (Function func in funcs)
            {
                FunctionToPoints(points, func.Calculate);
                e.Graphics.DrawLines(func.pen, points);
            }
        }
Пример #19
0
 internal override void Draw(System.Windows.Forms.PaintEventArgs e)
 {
     if (nod != null)
     {
         nod.Clear();
     }
     foreach (var node in Nodes)
     {
         nod.Add(layer.map.MapToScreen(node));
     }
     pen.Width = Style.Fatness;
     if (selected)
     {
         pen.Color = layer.map.SelectedColour;
     }
     else
     {
         pen.Color = Style.LColour;
     }
     e.Graphics.DrawLines(pen, nod.ToArray());
 }
Пример #20
0
        internal override void Draw(System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Point loc = layer.map.MapToScreen(location);
            string symbol            = Convert.ToChar(Style.Number).ToString();

            System.Drawing.Font font = new System.Drawing.Font(Style.Name, Style.Size);
            var size = e.Graphics.MeasureString(symbol, font);

            loc.X -= (int)(size.Width / 2);
            loc.Y -= (int)(size.Height / 2);
            System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(Style.SColour);
            if (selected)
            {
                brush.Color = layer.map.SelectedColour;
            }
            else
            {
                brush.Color = Style.SColour;
            }
            e.Graphics.DrawString(symbol, font, brush, loc);
        }
Пример #21
0
        protected override void OnViewerDoubleBufferPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnViewerDoubleBufferPaint(e);

            System.Drawing.Rectangle visibleRectangle = System.Drawing.Rectangle.Intersect(e.ClipRectangle, _bitmapViewer.GetViewportBounds());

            System.Drawing.Region prevClip = e.Graphics.Clip.Clone();
            System.Drawing.Region newClip  = new System.Drawing.Region(visibleRectangle);
            try
            {
                e.Graphics.Clip = newClip;
                _vObjectHost.DrawContent(e.Graphics, visibleRectangle, (ICoordinateMapper)_bitmapViewer);
            }
            finally
            {
                e.Graphics.Clip = prevClip;
                newClip.Dispose();
            }

            _vObjectHost.CurrentDesigner.Draw(e.Graphics);
        }
Пример #22
0
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            Color      labelColor          = this.BackColor;
            Pen        labelBorderPen      = new Pen(labelColor, 0);
            SolidBrush labelBackColorBrush = new SolidBrush(labelColor);
            SolidBrush labelForeColorBrush = new SolidBrush(base.ForeColor);

            float sngControlWidth  = Width;
            float sngControlHeight = Height;

            e.Graphics.DrawRectangle(labelBorderPen, 0, 0, sngControlWidth, sngControlHeight);
            e.Graphics.FillRectangle(labelBackColorBrush, 0, 0, sngControlWidth, sngControlHeight);
            float sngTransformX = 0;
            float sngTransformY = sngControlHeight;

            e.Graphics.TranslateTransform(sngTransformX, sngTransformY);
            e.Graphics.RotateTransform(270);

            e.Graphics.DrawString(_labelText, Font, labelForeColorBrush, 0, 0);
            base.OnPaint(e);
        }
Пример #23
0
        public override void paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            Graphics g = e.Graphics;


            Color penColor = pColor.Color;

            if (Logic.cProperties.getPropertyBool("enable_alpha"))
            {
                penColor = pColor.ColorAlpha;
            }

            if (pFilled)
            {
                g.FillRectangle(new SolidBrush(penColor), pX, pY, pWidth, pHeight);
            }
            else
            {
                g.DrawRectangle(new Pen(penColor, pLineWidth), pX, pY, pWidth, pHeight);
            }
        }
Пример #24
0
 static void newMessageBox_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
 {
     System.Drawing.Graphics  g             = e.Graphics;
     System.Drawing.Rectangle frmTitleL     = new System.Drawing.Rectangle(0, 0, (newMessageBox.Width / 2 + 2), 35);
     System.Drawing.Rectangle frmTitleR     = new System.Drawing.Rectangle((newMessageBox.Width / 2 + 2), 0, (newMessageBox.Width / 2 + 2), 35);
     System.Drawing.Rectangle frmMessageBox = new System.Drawing.Rectangle(0, 0, (newMessageBox.Width - 2), (newMessageBox.Height - 2));
     //LinearGradientBrush frmLGBL = new LinearGradientBrush(frmTitleL, Color.FromArgb(87, 148, 160), Color.FromArgb(209, 230, 243), LinearGradientMode.Horizontal);
     //LinearGradientBrush frmLGBR = new LinearGradientBrush(frmTitleR, Color.FromArgb(209, 230, 243), Color.FromArgb(87, 148, 160), LinearGradientMode.Horizontal);
     System.Drawing.Drawing2D.LinearGradientBrush frmLGBL = new System.Drawing.Drawing2D.LinearGradientBrush(frmTitleL,
                                                                                                             System.Drawing.SystemColors.InactiveCaptionText,
                                                                                                             System.Drawing.SystemColors.InactiveCaptionText,
                                                                                                             System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
     System.Drawing.Drawing2D.LinearGradientBrush frmLGBR = new System.Drawing.Drawing2D.LinearGradientBrush(frmTitleR,
                                                                                                             System.Drawing.SystemColors.InactiveCaptionText,
                                                                                                             System.Drawing.SystemColors.InactiveCaptionText,
                                                                                                             System.Drawing.Drawing2D.LinearGradientMode.Horizontal);
     System.Drawing.Pen frmPen = new System.Drawing.Pen(System.Drawing.Color.FromArgb(63, 119, 143), 1);
     g.FillRectangle(frmLGBL, frmTitleL);
     g.FillRectangle(frmLGBR, frmTitleR);
     g.DrawRectangle(frmPen, frmMessageBox);
 }
Пример #25
0
        private void BoardCtrl_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (_boardGr == null)
            {
                return;
            }

            _boardGr.Draw(e.Graphics);

            //Draw chess piece
            foreach (var chessPiece in _chessPieces)
            {
                chessPiece.Draw(e.Graphics);
            }

            //Draw HP & Cooldown
            foreach (var chessPiece in _chessPieces)
            {
                chessPiece.DrawExt(e.Graphics);
            }
        }
Пример #26
0
        private static void OnPaint_Panel(System.Windows.Forms.Panel pPanel, System.Windows.Forms.PaintEventArgs e)
        {
            if (pPanel.ClientRectangle.X > 0 && pPanel.ClientRectangle.Y > 0)
            {
                if (pPanel.Tag == null || (pPanel.Tag != null && pPanel.Tag != "SemRenderizacao"))
                {
                    using (GradualAntiAlias xaa = new GradualAntiAlias(e.Graphics))
                    {
                        using (System.Drawing.Drawing2D.LinearGradientBrush brush = new System.Drawing.Drawing2D.LinearGradientBrush(pPanel.ClientRectangle, StyleSettings.Panel_BackGround_Color_Start, StyleSettings.Panel_BackGround_Color_Finish, 90F))
                        {
                            e.Graphics.FillRectangle(brush, pPanel.ClientRectangle);

                            e.Graphics.DrawRectangle(
                                new System.Drawing.Pen(
                                    new System.Drawing.SolidBrush(System.Drawing.Color.FromArgb(42, 42, 42)), 0.5F),
                                e.ClipRectangle);
                        }
                    }
                }
            }
        }
Пример #27
0
        public override void paint(object sender, System.Windows.Forms.PaintEventArgs e)
        {
            if (cProperties.getPropertyBool("skinned_widget"))
            {
                new sGraphicRectangel(pAttr, false, (float)1.0, new sColor(Color.Yellow)).paint(sender, e);
            }

            //Unfortunatyl we have more tahn on instance of the base attributes,
            //so update all here
            if (((sAttributeWidget)pAttr).pRender.ToLower() == "label" || ((sAttributeWidget)pAttr).pRender.ToLower() == "fixedlabel")
            {
                updateObject(pAttr, ((sAttributeWidget)pAttr).pLabel);
                new sGraphicLabel((sAttributeLabel)((sAttributeWidget)pAttr).pLabel).paint(sender, e);
            }
            else if (((sAttributeWidget)pAttr).pRender.ToLower() == "pixmap")
            {
                updateObject(pAttr, ((sAttributeWidget)pAttr).pPixmap);
                new sGraphicPixmap((sAttributePixmap)((sAttributeWidget)pAttr).pPixmap).paint(sender, e);
            }
            else if (((sAttributeWidget)pAttr).pRender.ToLower() == "picon" || ((sAttributeWidget)pAttr).pRender.ToLower() == "xpicon")
            {
                updateObject(pAttr, ((sAttributeWidget)pAttr).pPixmap);
                new sGraphicPixmap((sAttributePixmap)((sAttributeWidget)pAttr).pPixmap).paint(sender, e);
            }
            else if (((sAttributeWidget)pAttr).pRender.ToLower() == "progress")
            {
                updateObject(pAttr, ((sAttributeWidget)pAttr).pProgress);
                new sGraphicProgress((sAttributeProgress)((sAttributeWidget)pAttr).pProgress).paint(sender, e);
            }
            else if (((sAttributeWidget)pAttr).pRender.ToLower() == "listbox")
            {
                updateObject(pAttr, ((sAttributeWidget)pAttr).pListbox);
                new sGraphicListbox((sAttributeListbox)((sAttributeWidget)pAttr).pListbox).paint(sender, e);
            }

            if (pAttr.pBorder)
            {
                new sGraphicRectangel(pAttr, false, (float)pAttr.pBorderWidth, pAttr.pBorderColor).paint(sender, e);
            }
        }
        void Ubuntu_PaintHook(System.Windows.Forms.PaintEventArgs e)
        {
            Bitmap    B         = new Bitmap(Width, Height);
            Graphics  G         = Graphics.FromImage(B);
            Rectangle TopBar    = new Rectangle(0, 0, Width - 1, 30);
            Rectangle FixBottom = new Rectangle(0, 26, Width - 1, 0);
            Rectangle Body      = new Rectangle(0, 5, Width - 1, Height - 6);

            G.Clear(Color.Fuchsia);

            G.SmoothingMode = SmoothingMode.HighSpeed;

            LinearGradientBrush lbb = new LinearGradientBrush(Body, Color.FromArgb(242, 241, 240), Color.FromArgb(240, 240, 238), 90);

            G.FillPath(lbb, Utilities.Draw.RoundRect(Body, 1));
            G.DrawPath(new Pen(new SolidBrush(Color.FromArgb(60, 60, 60))), Utilities.Draw.RoundRect(Body, 1));

            LinearGradientBrush lgb = new LinearGradientBrush(TopBar, Color.FromArgb(87, 86, 81), Color.FromArgb(60, 59, 55), 90);

            //Dim tophatch As New HatchBrush(HatchStyle.DarkUpwardDiagonal, Color.FromArgb(20, 20, 20), Color.Transparent)
            G.FillPath(lgb, Utilities.Draw.RoundRect(TopBar, 4));
            //G.FillPath(tophatch, Draw.RoundRect(TopBar, 4))
            G.DrawPath(Pens.Black, Utilities.Draw.RoundRect(TopBar, 3));
            G.DrawPath(Pens.Black, Utilities.Draw.RoundRect(FixBottom, 1));
            G.FillRectangle(Brushes.White, 1, 27, Width - 2, Height - 29);

            Font drawFont = new Font("Tahoma", 10, FontStyle.Regular);

            G.DrawString(Text, drawFont, new SolidBrush(Color.WhiteSmoke), new Rectangle(25, 0, Width - 1, 27), new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Center
            });

            G.DrawIcon(Parent.FindForm().Icon, new Rectangle(5, 5, 16, 16));

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
            G.Dispose();
            B.Dispose();
        }
        /// <summary>
        /// Perplexes the on paint.
        /// </summary>
        /// <param name="e">The <see cref="System.Windows.Forms.PaintEventArgs"/> instance containing the event data.</param>
        private void PerplexOnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            B = new Bitmap(Width, Height);
            G = Graphics.FromImage(B);
            dynamic radioBtnRectangle = new Rectangle(0, 0, Height - 1, Height - 1);

            G.SmoothingMode      = Smoothing;
            G.CompositingQuality = CompositingQuality.HighQuality;

            G.Clear(Parent.BackColor);

            LinearGradientBrush bgGrad = new LinearGradientBrush(radioBtnRectangle, Color.FromArgb(174, 195, 30), Color.FromArgb(141, 153, 16), 90);

            G.FillEllipse(bgGrad, radioBtnRectangle);

            //G.DrawEllipse(New Pen(Color.Gray), New Rectangle(1, 1, Height - 3, Height - 3))
            G.DrawEllipse(new Pen(Color.Black), radioBtnRectangle);

            if (Checked)
            {
                LinearGradientBrush chkGrad = new LinearGradientBrush(new Rectangle(4, 4, Height - 9, Height - 9), Color.FromArgb(250, 15, 15, 15), Color.FromArgb(250, 15, 15, 15), 90);
                G.FillEllipse(chkGrad, new Rectangle(4, 4, Height - 9, Height - 9));
            }

            Font  drawFont = new Font("Tahoma", 10, FontStyle.Bold);
            Brush nb       = new SolidBrush(Color.FromArgb(205, 205, 205));

            G.DrawString(Text, drawFont, Brushes.Black, new Point(Height, (Height / 2) - 7), new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Near
            });
            G.DrawString(Text, drawFont, nb, new Point(Height, (Height / 2) - 8), new StringFormat
            {
                Alignment     = StringAlignment.Near,
                LineAlignment = StringAlignment.Near
            });

            e.Graphics.DrawImage((Bitmap)B.Clone(), 0, 0);
        }
Пример #30
0
        //Draw
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            base.OnPaint(e);

            e.Graphics.SmoothingMode      = SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.AntiAlias;
            e.Graphics.PixelOffsetMode    = PixelOffsetMode.HighQuality;
            e.Graphics.InterpolationMode  = InterpolationMode.HighQualityBilinear;
            e.Graphics.CompositingQuality = CompositingQuality.HighQuality;


            Rectangle rect = new Rectangle(0, 0, 20, 20);


            for (int i = 0; i <= 8; i++)
            {
                //The background (depending on status)
                Pen   p;
                Brush brsh;
                if (!this.Rule.Contains(i.ToString()))
                {
                    brsh = new SolidBrush(Color.LightBlue);
                    p    = Pens.DarkGray;
                }
                else
                {
                    brsh = new SolidBrush(Color.Blue);
                    p    = Pens.Black;
                }
                e.Graphics.FillRectangle(brsh, rect);
                e.Graphics.DrawRectangle(p, rect);


                //Text
                SizeF sz = new SizeF(e.Graphics.MeasureString(i.ToString(), this.Font));
                e.Graphics.DrawString(i.ToString(), this.Font, Brushes.White, rect.X + (rect.Width - sz.Width) / 2, rect.Y + (rect.Height - sz.Height) / 2);

                rect.Offset(rect.Width + 4, 0);
            }
        }
    protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
    {
        if (ProgressBarRenderer.IsSupported)
        {
            ProgressBarRenderer.DrawVerticalBar(e.Graphics, ClientRectangle);

            const int HORIZ_OFFSET = 3;
            const int VERT_OFFSET  = 2;

            if (this.Minimum == this.Maximum || (this.Value - Minimum) == 0 ||
                this.Height < 2 * VERT_OFFSET || this.Width < 2 * VERT_OFFSET)
            {
                return;
            }

            int barHeight = (this.Value - this.Minimum) * this.Height / (this.Maximum - this.Minimum);
            barHeight = Math.Min(barHeight, this.Height - 2 * VERT_OFFSET);
            int barWidth = this.Width - 2 * HORIZ_OFFSET;

            if (this.RightToLeftLayout && this.RightToLeft == System.Windows.Forms.RightToLeft.No)
            {
                ProgressBarRenderer.DrawVerticalChunks(e.Graphics,
                                                       new Rectangle(HORIZ_OFFSET, VERT_OFFSET, barWidth, barHeight));
            }
            else
            {
                int blockHeight    = 10;
                int wholeBarHeight = Convert.ToInt32(barHeight / blockHeight) * blockHeight;
                int wholeBarY      = this.Height - wholeBarHeight - VERT_OFFSET;
                int restBarHeight  = barHeight % blockHeight;
                int restBarY       = this.Height - barHeight - VERT_OFFSET;
                ProgressBarRenderer.DrawVerticalChunks(e.Graphics,
                                                       new Rectangle(HORIZ_OFFSET, wholeBarY, barWidth, wholeBarHeight));
                ProgressBarRenderer.DrawVerticalChunks(e.Graphics,
                                                       new Rectangle(HORIZ_OFFSET, restBarY, barWidth, restBarHeight));
            }
        }

        base.OnPaint(e);
    }
Пример #32
0
        /// <summary></summary>
        /// <param name="e"></param>
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            if (device != null && !DesignMode && HandleDeviceReset() && application.IsInitailised)
            {
                // Draw the control using the GraphicsDevice.
                winFormWrapper.RunMainLoop();

                Rectangle sourceRectangle = new Rectangle(0, 0, ClientSize.Width,
                                                          ClientSize.Height);
                try
                {
                    if (device != null)
                    {
                        device.GraphicsDevice.Present(sourceRectangle, null, this.Handle);
                    }
                }
                catch (InvalidOperationException)
                {
                }
                catch (DeviceLostException)
                {
                }
                catch (DeviceNotResetException)
                {
                }
                catch (DriverInternalErrorException)
                {
                }

                if (autoRedraw)
                {
                    Invalidate();
                }
            }
            else
            {
                // If not in a drawable state, show a message using System.Drawing.
                PaintUsingSystemDrawing(e.Graphics);
            }
        }
Пример #33
0
        protected override void OnKeyDown(System.Windows.Forms.KeyEventArgs e)
        {
            base.OnKeyDown(e);
            if (e.KeyCode == System.Windows.Forms.Keys.S)
            {
                System.Windows.Forms.SaveFileDialog saveDialog = new System.Windows.Forms.SaveFileDialog();
                saveDialog.Filter = "bmp files (*.bmp)|*.bmp";
                if (saveDialog.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                {
                    Bitmap bitmap = new Bitmap(this.Width, this.Height, System.Drawing.Imaging.PixelFormat.Format24bppRgb);
                    using (Graphics g = Graphics.FromImage(bitmap))
                    {
                        g.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                        //g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias; // HighSpeed;
                        //g.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
                        System.Windows.Forms.PaintEventArgs evt = new System.Windows.Forms.PaintEventArgs(g, new Rectangle(0, 0, this.Width, this.Height));
                        this.OnPaint(evt);
                    }

                    bitmap.Save(saveDialog.FileName,System.Drawing.Imaging.ImageFormat.Bmp);
                }
            }
        }