Dispose() public method

public Dispose ( ) : void
return void
Ejemplo n.º 1
0
        private void UserSetPassword_Paint(object sender, PaintEventArgs e)
        {
            if (!textBoxPassword.Text.Equals(textBoxVerifyPassword.Text))
            {
                if (iconHit)
                {
                    toolTip1.SetToolTip(this, "Passwords do not match!");
                }

                toggle = !toggle;
                if (toggle)
                {
                    e.Graphics.DrawIcon(warn, iconPoint.X, iconPoint.Y);
                }
                else
                {
                    e.Graphics.DrawIcon(blank, iconPoint.X, iconPoint.Y);
                }
                e.Dispose();
                timer1.Start();
            }
            else
            {
                toolTip1.SetToolTip(textBoxVerifyPassword, "");
                e.Graphics.DrawIcon(blank, iconPoint.X, iconPoint.Y);
                e.Dispose();
                timer1.Stop();
            }
        }
Ejemplo n.º 2
0
        public void Dispose_Invoke_Success()
        {
            var      image    = new Bitmap(10, 10);
            Graphics graphics = Graphics.FromImage(image);
            var      e        = new PaintEventArgs(graphics, new Rectangle(1, 2, 3, 4));

            e.Dispose();
            e.Dispose();
        }
Ejemplo n.º 3
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            e.Graphics.Clear(Color.FromArgb(246, 246, 246));
            e.Graphics.SmoothingMode = SmoothingMode.AntiAlias;

            // Fill the body of the ellipse with a gradient
            LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)), Color.FromArgb(250, 250, 250), Color.FromArgb(240, 240, 240), 90);

            e.Graphics.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(14, 14)));

            GraphicsPath GP = new GraphicsPath();

            GP.AddEllipse(new Rectangle(0, 0, 14, 14));
            e.Graphics.SetClip(GP);
            e.Graphics.ResetClip();

            // Draw ellipse border
            e.Graphics.DrawEllipse(new Pen(Color.FromArgb(160, 160, 160)), new Rectangle(new Point(0, 0), new Size(14, 14)));

            if (_Checked) // Draw an ellipse inside the body
            {
                SolidBrush EllipseColor = new SolidBrush(Color.FromArgb(142, 142, 142));
                e.Graphics.FillEllipse(EllipseColor, new Rectangle(new Point(4, 4), new Size(6, 6)));
            }
            e.Graphics.DrawString(Text, Font, new SolidBrush(Color.FromArgb(142, 142, 142)), 16, 8, new StringFormat()
            {
                LineAlignment = StringAlignment.Center
            });
            e.Dispose();
        }
Ejemplo n.º 4
0
        private void Form3_Paint(object sender, PaintEventArgs e)
        {
            // background
            // teams degraded backgrounds
            DrawTeamDegraded(e.Graphics, team1.Color,
                             (team1.Side == "left") ? 0 : (this.Size.Width / 5) * 3);
            DrawTeamDegraded(e.Graphics, team2.Color,
                             (team2.Side == "right") ? (this.Size.Width / 5) * 3 : 0);

            // black border around the scoreboard
            e.Graphics.DrawRectangle(System.Drawing.Pens.Black,
                                     new Rectangle(0, 0, this.Size.Width - 1,
                                                   this.Size.Height - 1));

            // team names
            DrawInfoScoreBoard(e.Graphics, team1.Name, Color.Black,
                               (team1.Side == "left") ? 0.5F : 3.5F, true);
            DrawInfoScoreBoard(e.Graphics, team2.Name, Color.Black,
                               (team2.Side == "right") ? 3.5F : 0.5F, true);

            // period
            DrawInfoScoreBoard(e.Graphics, Period, Color.White, 2, false);

            e.Dispose();
        }
Ejemplo n.º 5
0
        protected override void OnPaint(PaintEventArgs e)
        {
            int x = this.Location.X;
            int y = this.Location.Y;

            if (OpenEnterBorder)
            {
                Pen BorderPen = new Pen(Mouse_Enter ? EnterBorderColor : LeaveBorderColor, BorderSize);
                e.Graphics.DrawRectangle(BorderPen, x, y, Width, Height);
                BorderPen.Dispose();
            }
            if (OpenEnterForeColor)
            {
                this.ForeColor = Mouse_Enter ? EnterForeColor : LeaveForeColor;
            }
            if (OpenLeftText)
            {
                e.Graphics.DrawString(LeftText, Font, new SolidBrush(Mouse_Enter && OpenLeftTextColor ? EnterLeftTextColor : LeaveLeftTextColor), x - Convert.ToInt32(GetTextWidth(LeftText)), y);
            }
            if (OpenFocusBorder && IS_Focus)
            {
                Pen BorderPen = new Pen(OpenFocusBorder ? FocusGotBorderColol : LeaveForeColor, BorderSize);
                e.Graphics.DrawRectangle(BorderPen, x, y, Width, Height);
                BorderPen.Dispose();
            }
            if (OpenFocusForeColor)
            {
                this.ForeColor = IS_Focus ? FocusGotForeColor : LeaveForeColor;
            }
            e.Dispose();
            base.OnPaint(e);
        }
        private void Draw(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            Polygon polygon = new Polygon(size, adjMatrix, points);

            polygon.traingulate();

            Pen pen1 = new Pen(Color.FromArgb(50, 130, 184), 3);
            Pen pen2 = new Pen(Color.FromArgb(27, 38, 44), 2);

            List <System.Drawing.Point> coordinates = new List <System.Drawing.Point>();

            points.ForEach(x => coordinates.Add(new System.Drawing.Point(x.X, x.Y)));
            g.DrawPolygon(pen1, coordinates.ToArray());

            for (int i = 0; i < size; i++)
            {
                for (int j = 0; j < size; j++)
                {
                    if (polygon.Diagonals[i, j] == 1)
                    {
                        Point p1 = points[i], p2 = points[j];
                        g.DrawLine(pen2, p1.X, p1.Y, p2.X, p2.Y);
                    }
                }
            }


            e.Dispose();
            MessageBox.Show("Cost is :" + polygon.TriangulationCost, "Cost", MessageBoxButtons.OK, MessageBoxIcon.Information);
        }
Ejemplo n.º 7
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            var MyDrawer = e.Graphics;

            MyDrawer.Clear(BackColor);
            MyDrawer.SmoothingMode = SmoothingMode.AntiAlias;

            MyDrawer.FillPath(GB, Shape);
            // Fill the body of the CheckBox
            MyDrawer.DrawPath(new Pen(_CheckedBorderColor), Shape);
            // Draw the border

            MyDrawer.DrawString(Text, Font, new SolidBrush(ForeColor), new Rectangle(17, 0, Width, Height - 1), new StringFormat {
                LineAlignment = StringAlignment.Center
            });

            if (Checked)
            {
                MyDrawer.DrawString("ü", new Font("Wingdings", 12), new SolidBrush(_CheckedColor), new Rectangle(-2, 1, Width, Height + 2), new StringFormat {
                    LineAlignment = StringAlignment.Center
                });
            }
            e.Dispose();
        }
        private void Draw(object sender, PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            // creating graph coordinates
            var    angle  = Math.PI * 2 / vertices;
            PointF center = new PointF(400F, 400F);

            var points = Enumerable.Range(0, vertices).Select(i => PointF.Add(center, new SizeF(Convert.ToSingle(Math.Sin(i * angle) * 100.0),
                                                                                                Convert.ToSingle(Math.Cos(i * angle) * 100.0)))).ToArray();

            // drawing edges
            for (int i = 0; i < edges.Count; i++)
            {
                if (contractedVertices.Contains(edges[i].Src) && contractedVertices.Contains(edges[i].Dest))
                {
                    graphics.DrawLine(Pens.Black, points[edges[i].Src], points[edges[i].Dest]);
                }
                else
                {
                    graphics.DrawLine(Pens.Red, points[edges[i].Src], points[edges[i].Dest]);
                }
            }

            // drawing vertices
            foreach (var p in points.ToArray())
            {
                graphics.DrawEllipse(Pens.Yellow, p.X - _radius, p.Y - _radius, 2 * _radius, 2 * _radius);
                graphics.FillEllipse(Brushes.Yellow, p.X - _radius, p.Y - _radius, 2 * _radius, 2 * _radius);
            }

            e.Dispose();
        }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pevent"></param>
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            //Simulate Transparency
            if (BackColor == Color.Transparent || BackColor.A < 255)
            {
                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = this;
                }

                System.Drawing.Drawing2D.GraphicsContainer g = pevent.Graphics.BeginContainer();
                Rectangle translateRect = this.Bounds;
                pevent.Graphics.TranslateTransform(-Left, -Top);
                PaintEventArgs pe = new PaintEventArgs(pevent.Graphics, translateRect);
                this.InvokePaintBackground(Parent, pe);
                this.InvokePaint(Parent, pe);
                pevent.Graphics.ResetTransform();
                pevent.Graphics.EndContainer(g);
                pe.Dispose();

                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = null;
                }
            }

            ControlRenderer.FillRectAccordingToGradientStyle(pevent.Graphics, this.ClientRectangle, BackColor, ForeColor,
                                                             ControlStyle.NoBorder, false, GradientColor, GradientStyle);

            if (TransparentChild != null && DesignMode)
            {
                ControlRenderer.RenderOwnerDrawnControlsOfParent(pevent.Graphics, TransparentChild);
            }
        }
Ejemplo n.º 10
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            //Simulate Transparency
            if (BackColor == Color.Transparent)
            {
                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = this;
                }

                System.Drawing.Drawing2D.GraphicsContainer g = e.Graphics.BeginContainer();
                Rectangle translateRect = this.Bounds;
                int       borderWidth   = (this.Width - this.ClientSize.Width) / 2;
                e.Graphics.TranslateTransform(-(Left + borderWidth), -(Top + borderWidth));
                PaintEventArgs pe = new PaintEventArgs(e.Graphics, translateRect);
                this.InvokePaintBackground(Parent, pe);
                this.InvokePaint(Parent, pe);
                e.Graphics.ResetTransform();
                e.Graphics.EndContainer(g);
                pe.Dispose();

                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = null;
                }
            }
            else
            {
                base.OnPaintBackground(e);
            }
        }
 // Draw border around Sinai image
 private void SinaiBorder_Paint(object sender, PaintEventArgs e)
 {
     e.Graphics.DrawLine(new Pen(Color.FromArgb(227, 227, 227)), 0, 0, _sinaiPanel.Width - 2, 0);   //1st layer of border
     e.Graphics.DrawLine(new Pen(Color.FromArgb(227, 227, 227)), 0, 0, 0, _sinaiPanel.Height - 2);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(105, 105, 105)), _sinaiPanel.Width - 1, 0, _sinaiPanel.Width - 1, _sinaiPanel.Height - 1);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(105, 105, 105)), 0, _sinaiPanel.Height - 1, _sinaiPanel.Width - 1, _sinaiPanel.Height - 1);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(255, 255, 255)), 1, 1, _sinaiPanel.Width - 3, 1);   //2nd layer of border
     e.Graphics.DrawLine(new Pen(Color.FromArgb(255, 255, 255)), 1, 1, 1, _sinaiPanel.Height - 3);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160)), _sinaiPanel.Width - 2, 1, _sinaiPanel.Width - 2, _sinaiPanel.Height - 2);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(160, 160, 160)), 1, _sinaiPanel.Height - 2, _sinaiPanel.Width - 2, _sinaiPanel.Height - 2);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(240, 240, 240)), 2, 2, _sinaiPanel.Width - 4, 2);   //3rd layer of border
     e.Graphics.DrawLine(new Pen(Color.FromArgb(240, 240, 240)), 2, 2, 2, _sinaiPanel.Height - 4);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(240, 240, 240)), _sinaiPanel.Width - 3, 2, _sinaiPanel.Width - 3, _sinaiPanel.Height - 3);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(240, 240, 240)), 2, _sinaiPanel.Height - 3, _sinaiPanel.Width - 3, _sinaiPanel.Height - 3);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 3, 3, _sinaiPanel.Width - 5, 3);   //4th layer of border
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 3, 3, 3, _sinaiPanel.Height - 5);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), _sinaiPanel.Width - 4, 3, _sinaiPanel.Width - 4, _sinaiPanel.Height - 4);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 3, _sinaiPanel.Height - 4, _sinaiPanel.Width - 4, _sinaiPanel.Height - 4);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 4, 4, _sinaiPanel.Width - 6, 4);   //5th layer of border
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 4, 4, 4, _sinaiPanel.Height - 6);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), _sinaiPanel.Width - 5, 4, _sinaiPanel.Width - 5, _sinaiPanel.Height - 5);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 4, _sinaiPanel.Height - 5, _sinaiPanel.Width - 5, _sinaiPanel.Height - 5);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 9, 9, _sinaiPanel.Width - 11, 9);   //1st layer border of sinai image
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 9, 9, 9, _sinaiPanel.Height - 11);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), _sinaiPanel.Width - 10, 9, _sinaiPanel.Width - 10, _sinaiPanel.Height - 10);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 9, _sinaiPanel.Height - 10, _sinaiPanel.Width - 10, _sinaiPanel.Height - 10);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 10, 10, _sinaiPanel.Width - 12, 10);   //2nd layer border of sinai image
     e.Graphics.DrawLine(new Pen(Color.FromArgb(67, 67, 67)), 10, 10, 10, _sinaiPanel.Height - 12);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), _sinaiPanel.Width - 11, 10, _sinaiPanel.Width - 11, _sinaiPanel.Height - 11);
     e.Graphics.DrawLine(new Pen(Color.FromArgb(223, 223, 223)), 10, _sinaiPanel.Height - 11, _sinaiPanel.Width - 11, _sinaiPanel.Height - 11);
     e.Dispose();
 }
Ejemplo n.º 12
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="pevent"></param>
        protected override void OnPaintBackground(PaintEventArgs pevent)
        {
            //Simulate Transparency
            if (BackColor == Color.Transparent || BackColor.A < 255)
            {
                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = this;
                }

                System.Drawing.Drawing2D.GraphicsContainer g = pevent.Graphics.BeginContainer();
                Rectangle translateRect = this.Bounds;
                pevent.Graphics.TranslateTransform(-Left, -Top);
                PaintEventArgs pe = new PaintEventArgs(pevent.Graphics, translateRect);
                this.InvokePaintBackground(Parent, pe);
                this.InvokePaint(Parent, pe);
                pevent.Graphics.ResetTransform();
                pevent.Graphics.EndContainer(g);
                pe.Dispose();

                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = null;
                }
            }

            DrawBackground(pevent.Graphics, ClientRectangle);
        }
Ejemplo n.º 13
0
        /// <summary>
        /// Draw EPLAN files
        /// </summary>
        public void DrawEplan()
        {
            int width  = Convert.ToInt16(_previewControl.PreviewBorder.ActualWidth);
            int height = Convert.ToInt16(_previewControl.PreviewBorder.ActualHeight);

            if (width > 0 && height > 0)
            {
                Bitmap         bitmap         = new Bitmap(width, height);
                Graphics       graphics       = Graphics.FromImage(bitmap);
                Rectangle      rectangle      = new Rectangle(0, 0, width, height);
                PaintEventArgs paintEventArgs = new PaintEventArgs(graphics, rectangle);

                DrawingService.DrawDisplayList(paintEventArgs);

                IntPtr       hBitmap      = bitmap.GetHbitmap();
                BitmapSource bitmapSource = Imaging.CreateBitmapSourceFromHBitmap(hBitmap,
                                                                                  IntPtr.Zero, Int32Rect.Empty, BitmapSizeOptions.FromEmptyOptions());

                _previewControl.PreviewBorder.Background = new ImageBrush(bitmapSource);

                bitmap.Dispose();
                graphics.Dispose();
                paintEventArgs.Dispose();
                DeleteObject(hBitmap);
            }
            else
            {
                _previewControl.PreviewBorder.Background = null;
            }
        }
Ejemplo n.º 14
0
        private void DrawPanel_Paint(object sender, PaintEventArgs e)
        {
            // Draw map
            Color drawColor;

            for (int row = 0; row < Map.Ydim; row++)
            {
                for (int col = 0; col < Map.Xdim; col++)
                {
                    if (Game.WhichCivsMapShown == 8 || Map.Visibility[col, row][Game.WhichCivsMapShown])
                    {
                        drawColor = (Map.Tile[col, row].Type == TerrainType.Ocean) ? Color.FromArgb(0, 0, 95) : Color.FromArgb(55, 123, 23);
                        e.Graphics.FillRectangle(new SolidBrush(drawColor), Offset[0] + 2 * col + (row % 2), Offset[1] + row, 2, 1);
                    }
                }
            }

            // Draw cities
            foreach (City city in Game.GetCities)
            {
                if (Game.WhichCivsMapShown == 8 || Map.IsTileVisibleC2(city.X, city.Y, Game.WhichCivsMapShown))
                {
                    e.Graphics.FillRectangle(new SolidBrush(CivColors.CityTextColor[city.Owner.Id]), Offset[0] + city.X, Offset[1] + city.Y, 2, 1);
                }
            }

            // Draw current view rectangle
            //e.Graphics.DrawRectangle(new Pen(Color.White), Offset[0] + StartingSqXY[0], Offset[1] + StartingSqXY[1], DrawingSqXY[0], DrawingSqXY[1]); // TODO: correct this
            e.Dispose();
        }
Ejemplo n.º 15
0
        // Token: 0x060001EA RID: 490 RVA: 0x0000C858 File Offset: 0x0000AA58
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            Graphics graphics = e.Graphics;

            graphics.Clear(Color.FromArgb(0, 0, 0));
            graphics.SmoothingMode = SmoothingMode.AntiAlias;
            LinearGradientBrush brush = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)), Color.FromArgb(0, 0, 0), Color.FromArgb(0, 0, 0), 90f);

            graphics.FillEllipse(brush, new Rectangle(new Point(0, 0), new Size(14, 14)));
            GraphicsPath graphicsPath = new GraphicsPath();

            graphicsPath.AddEllipse(new Rectangle(0, 0, 14, 14));
            graphics.SetClip(graphicsPath);
            graphics.ResetClip();
            graphics.DrawEllipse(new Pen(Color.FromArgb(255, 255, 255)), new Rectangle(new Point(0, 0), new Size(14, 14)));
            if (this.lt)
            {
                SolidBrush brush2 = new SolidBrush(Color.FromArgb(255, 255, 255));
                graphics.FillEllipse(brush2, new Rectangle(new Point(4, 4), new Size(6, 6)));
            }
            graphics.DrawString(this.Text, this.Font, new SolidBrush(Color.FromArgb(255, 255, 255)), 16f, 8f, new StringFormat
            {
                LineAlignment = StringAlignment.Center
            });
            e.Dispose();
        }
Ejemplo n.º 16
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaintBackground(PaintEventArgs e)
        {
            if (BackColor == Color.Transparent || BackColor.A < 255)
            {
                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = this;
                }

                int hScrollHeight = (this.HScroll ? SystemInformation.HorizontalScrollBarHeight : 0);
                int vScrollWidth  = (this.VScroll ? SystemInformation.VerticalScrollBarWidth : 0);

                int borderWidth = ((this.Width - this.ClientSize.Width) - vScrollWidth) / 2;

                System.Drawing.Drawing2D.GraphicsContainer g = e.Graphics.BeginContainer();
                Rectangle translateRect = this.Bounds;
                e.Graphics.TranslateTransform(-(Left + borderWidth), -(Top + borderWidth));
                PaintEventArgs pe = new PaintEventArgs(e.Graphics, translateRect);
                this.InvokePaintBackground(Parent, pe);
                this.InvokePaint(Parent, pe);
                e.Graphics.ResetTransform();
                e.Graphics.EndContainer(g);
                pe.Dispose();

                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = null;
                }
            }

            ControlRenderer.PaintMgPanel(this, e.Graphics);
        }
        private void Draw(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            Pen        black       = new Pen(Color.Black);
            Pen        yellow      = new Pen(Color.FromArgb(0, 8, 57));
            SolidBrush yellowBrush = new SolidBrush(Color.FromArgb(255, 164, 27));

            Graph graph = new Graph(vertix, edges);

            graph.kruskalMST();

            for (int i = 0; i < graph.result.Count; i++)
            {
                Edge  edge = graph.result[i];
                Point src  = points.Where(x => x.Name == edge.src).FirstOrDefault().Point;
                Point dest = points.Where(x => x.Name == edge.dest).FirstOrDefault().Point;
                g.DrawLine(yellow, src.X, src.Y, dest.X, dest.Y);
            }


            for (int i = 0; i < points.Count; i++)
            {
                Point point = points[i].Point;
                g.DrawEllipse(black, point.X - _radius, point.Y - _radius, 2 * _radius, 2 * _radius);
                g.FillEllipse(yellowBrush, point.X - _radius, point.Y - _radius, 2 * _radius, 2 * _radius);
            }


            e.Dispose();
        }
Ejemplo n.º 18
0
        /// <summary>
        /// Responds to Paint event.
        /// </summary>
        /// <param name="e">Event arguments.</param>
        protected override void OnPaint(PaintEventArgs e)
        {
            // Use SystemBrushes for colors of a control.
            System.Drawing.Brush backgroundBrush = SystemBrushes.Window;
            System.Drawing.Brush focusedBrush;
            if (this.Focused)
            {
                focusedBrush = SystemBrushes.Highlight;
            }
            else
            {
                focusedBrush = new SolidBrush(Color.DarkGray);
            }
            e.Graphics.FillRectangle(backgroundBrush, DisplayRectangle);

            System.Drawing.Font itemTextFont = SystemFonts.DefaultFont;

            System.Drawing.Brush itemInk = SystemBrushes.ControlText;

            // draw text onto screen
            Point     pt = new Point(DisplayRectangle.Left + 2, DisplayRectangle.Top + controlHeight);
            Rectangle rc = new Rectangle(DisplayRectangle.X, DisplayRectangle.Top + controlHeight + 1, DisplayRectangle.Width, controlHeight);

            rc = new Rectangle(rc.X, rc.Y + 2, controlWidth, controlHeight);

            e.Graphics.DrawString(this.Text, itemTextFont, itemInk, rc);

            e.Dispose();
        }
Ejemplo n.º 19
0
        private void InfoPanel_Paint(object sender, PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            GenerateCourseGroupLists(graphics);
            e.Dispose();
        }
Ejemplo n.º 20
0
        private void GraphPanel_Paint(object sender, PaintEventArgs e)
        {
            Graphics graphics = e.Graphics;

            PaintGraph(graphics);
            e.Dispose();
        }
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);
            var MyDrawer = e.Graphics;

            MyDrawer.Clear(Parent.BackColor);
            MyDrawer.SmoothingMode = SmoothingMode.AntiAlias;

            // Fill the body of the ellipse with a gradient
            LinearGradientBrush LGB = new LinearGradientBrush(new Rectangle(new Point(0, 0), new Size(14, 14)), Color.FromArgb(213, 85, 32), Color.FromArgb(224, 123, 82), 90);

            MyDrawer.FillEllipse(LGB, new Rectangle(new Point(0, 0), new Size(14, 14)));

            GraphicsPath GP = new GraphicsPath();

            GP.AddEllipse(new Rectangle(0, 0, 14, 14));
            MyDrawer.SetClip(GP);
            MyDrawer.ResetClip();

            // Draw ellipse border
            MyDrawer.DrawEllipse(new Pen(Color.FromArgb(182, 88, 55)), new Rectangle(new Point(0, 0), new Size(14, 14)));

            // Draw an ellipse inside the body
            if (_Checked)
            {
                SolidBrush EllipseColor = new SolidBrush(Color.FromArgb(255, 255, 255));
                MyDrawer.FillEllipse(EllipseColor, new Rectangle(new Point(4, 4), new Size(6, 6)));
            }
            MyDrawer.DrawString(Text, Font, new SolidBrush(Color.FromArgb(76, 76, 95)), 16, 7, new StringFormat {
                LineAlignment = StringAlignment.Center
            });
            e.Dispose();
        }
Ejemplo n.º 22
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            var _G = e.Graphics;

            _G.Clear(Color.FromArgb(246, 246, 246));
            _G.SmoothingMode = SmoothingMode.AntiAlias;
            // Fill the body of the CheckBox
            _G.FillPath(GB, Shape);
            // Draw the border
            _G.DrawPath(new Pen(Color.FromArgb(160, 160, 160)), Shape);
            // Draw the string
            _G.DrawString(Text, Font, new SolidBrush(Color.FromArgb(64, 64, 64)), R1, new StringFormat {
                LineAlignment = StringAlignment.Center
            });

            if (Checked)
            {
                _G.DrawString("ü", new Font("Wingdings", 14), new SolidBrush(Color.FromArgb(64, 64, 64)), new Rectangle(-2, 1, Width, Height), new StringFormat {
                    LineAlignment = StringAlignment.Center
                });
            }
            e.Dispose();
        }
Ejemplo n.º 23
0
        private void Form2_Paint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;

            g.DrawImage(TheImage, new Rectangle(0, 0, Width * 500 / resolution, Height * 500 / resolution));
            //g.Flush(System.Drawing.Drawing2D.FlushIntention.Flush);
            e.Dispose();
        }
        public void Dispose()
        {
            PaintEventArgs pea = new PaintEventArgs(default_graphics, default_rect);

            pea.Dispose();
            // uho, under 2.0 we not really disposing the stuff - it means it's not ours to dispose!
            Assert.IsTrue(pea.Graphics.Transform.IsIdentity, "Graphics.Transform");
        }
Ejemplo n.º 25
0
 void FormDiagram_Paint(object sender, PaintEventArgs e)
 {
     if (dg != null)
     {
         dg.Draw(e.Graphics);
         e.Dispose();
     }
 }
Ejemplo n.º 26
0
        private void DrawCircle(PaintEventArgs e, Coordinate c, int width, int height)
        {
            Random r   = new Random();
            Pen    pen = new Pen(Color.FromArgb(r.Next(0, 255), r.Next(0, 255), r.Next(0, 255)), 3);

            e.Graphics.DrawEllipse(pen, c.X - width / 2, c.Y - height / 2, width, height);
            e.Dispose();
        }
Ejemplo n.º 27
0
        protected override void OnPaint(PaintEventArgs e)
        {
            //Simulate Transparency
            if (BackColor == Color.Transparent)
            {
#if !PocketPC
                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = this;
                }

                System.Drawing.Drawing2D.GraphicsContainer g = e.Graphics.BeginContainer();
                Rectangle translateRect = this.Bounds;
                e.Graphics.TranslateTransform(-Left, -Top);
                PaintEventArgs pe = new PaintEventArgs(e.Graphics, translateRect);
                this.InvokePaintBackground(Parent, pe);
                this.InvokePaint(Parent, pe);
                //fixed bug#:796041, the forgound not need to display
                //this.InvokePaint(Parent, pe);
                e.Graphics.ResetTransform();
                e.Graphics.EndContainer(g);
                pe.Dispose();

                if (Parent is ISupportsTransparentChildRendering)
                {
                    ((ISupportsTransparentChildRendering)Parent).TransparentChild = null;
                }
#endif
            }

            ControlRenderer.FillRectAccordingToGradientStyle(e.Graphics, ClientRectangle, BackColor, LinkColor, 0,
                                                             false, GradientColor, GradientStyle);

            ContentAlignment newTextAlign = ControlUtils.GetOrgContentAligment(RightToLeft, TextAlign);

            FontDescription font = new FontDescription(Font);
            ControlRenderer.PrintText(e.Graphics, ClientRectangle, LinkColor, font, Text, false, newTextAlign,
                                      Enabled, true, !UseMnemonic, false, (RightToLeft == RightToLeft.Yes));

            //fixed bug #:765815 : when parking on hypertext button,focus need to seen on text on the button (not on  entire button)
            if (Focused)
            {
                Size textExt = Utils.GetTextExt(Font, Text, this);
                // get the display the focus on the text of the control
                Rectangle textRect = ControlUtils.GetFocusRect(this, ClientRectangle, newTextAlign, textExt);
                //ass offset, it will look as in online
                textRect.Inflate(2, 2);
                textRect.Width  -= 2;
                textRect.Height -= 1;

                textRect.X      = Math.Max(1, textRect.X);
                textRect.Y      = Math.Max(1, textRect.Y);
                textRect.Width  = Math.Min(textRect.Width, ClientRectangle.Width - textRect.X);
                textRect.Height = Math.Min(textRect.Height, ClientRectangle.Height - textRect.Y);

                ControlPaint.DrawFocusRectangle(e.Graphics, textRect);
            }
        }
Ejemplo n.º 28
0
 private void pictureBox1_Paint(object sender, PaintEventArgs e)
 {
     if (pictureBox1.Image != null && !startdetect)
     {
         Pen p = new Pen(Color.Yellow, 2);
         e.Graphics.DrawString("分辨率:" + width.ToString() + "X" + height.ToString(), new Font("宋体", 10, FontStyle.Bold), Brushes.Gold, 0, 0);
         e.Dispose();
     }
 }
Ejemplo n.º 29
0
        //Paint Events
        public void PaintEvents(PaintEventArgs e)
        {
            //Get a copy of currentMidiObjects Events
            MidiEvent[] CurrentMidiEvents = new MidiEvent[0];
            Array.Resize(ref CurrentMidiEvents, CurrentMidiObject.Track.Events.Length);
            Array.Copy(CurrentMidiObject.Track.Events, CurrentMidiEvents, CurrentMidiObject.Track.Events.Length);

            if (CurrentMidiEvents != null && CurrentMidiEvents.Length > 0 && CurrentMidiEvents[0] != null)
            {
                MidiEvent CurrentEvent = null;
                for (int EventIndex = 0; EventIndex <= CurrentMidiEvents.Length - 1; EventIndex++)
                {
                    CurrentEvent = CurrentMidiEvents[EventIndex];
                    //Paint Tempo Events : Paint all TempoEvents before NoteDown Events, for depth
                    if (CurrentEvent is TempoMidiEvent)
                    {
                        TempoMidiEvent CurrentTempoEvent = (TempoMidiEvent)CurrentEvent;
                        e.Graphics.FillRectangle(Brushes.Yellow, (CurrentTempoEvent.CellPosition * CellWidth) + (CellWidth / 2), 0, (CellWidth / 2), ROWCOUNT * CellHeight);
                    }
                    //Paint InstrumentEvents : Paint all InstrumentEvents before NoteDown Events, for depth
                    if (CurrentEvent is InstrumentMidiEvent)
                    {
                        InstrumentMidiEvent CurrentTempoEvent = (InstrumentMidiEvent)CurrentEvent;
                        e.Graphics.FillRectangle(Brushes.Red, (CurrentTempoEvent.CellPosition * CellWidth), 0, (CellWidth / 2), ROWCOUNT * CellHeight);
                    }
                }
                //for each Note
                for (int EventIndex = 0; EventIndex <= CurrentMidiEvents.Length - 1; EventIndex++)
                {
                    CurrentEvent = CurrentMidiEvents[EventIndex];
                    //Paint note events
                    if (CurrentEvent.Type == NOTE_DOWN)
                    {
                        //Paint notes
                        e.Graphics.FillRectangle(NoteFill, CurrentEvent.CellPosition * CellWidth, (127 - CurrentEvent.Paramater1) * CellHeight, CurrentEvent.Length * CellWidth, CellHeight);
                        e.Graphics.DrawRectangle(NoteOutline, CurrentEvent.CellPosition * CellWidth, (127 - CurrentEvent.Paramater1) * CellHeight, CurrentEvent.Length * CellWidth, CellHeight);
                    }
                }
                //for each selected note
                if (SelectedEvents != null && SelectedEvents.Length > 0 && SelectedEvents[0] != null)
                {
                    for (int EventIndex = 0; EventIndex <= SelectedEvents.Length - 1; EventIndex++)
                    {
                        CurrentEvent = SelectedEvents[EventIndex];
                        //Paint note events
                        if (CurrentEvent.Type == NOTE_DOWN)
                        {
                            //Paint notes
                            e.Graphics.FillRectangle(Brushes.Red, CurrentEvent.CellPosition * CellWidth, (127 - CurrentEvent.Paramater1) * CellHeight, CurrentEvent.Length * CellWidth, CellHeight);
                            e.Graphics.DrawRectangle(Pens.Black, CurrentEvent.CellPosition * CellWidth, (127 - CurrentEvent.Paramater1) * CellHeight, CurrentEvent.Length * CellWidth, CellHeight);
                        }
                    }
                }
                e.Dispose();
            }
        }
Ejemplo n.º 30
0
        protected override void OnPaint(PaintEventArgs e)
        {
            e.Graphics.Clear(Color.CornflowerBlue);

            using (Brush brush = new SolidBrush(Color.White))
            {
                e.Graphics.FillEllipse(brush, new Rectangle(x, y, h, w));
            }
            e.Dispose();
        }