Exemple #1
0
 public MedCurve(MedPointList points, int xaxisindex, int yaxisindex, MedSymbol symbol, System.Drawing.Pen pen, string title, bool hasLine)
 {
     this._points     = points;
     this._XaxisIndex = xaxisindex;
     this._YaxisIndex = yaxisindex;
     if (_pen != null)
     {
         _pen.Dispose();
     }
     this._pen = pen;
     if (_symbol != null)
     {
         _symbol.Dispose();
     }
     if (symbol == null)
     {
         this._symbol = new MedSymbol(MedSymbolType.None);
     }
     else
     {
         this._symbol = symbol;
     }
     _symbol.Pen = _pen;
     _title      = title;
     _hasLine    = hasLine;
 }
Exemple #2
0
        public void Draw(Grid inGrid, System.Drawing.Graphics inGraphics, bool bPrintAgeType)
        {
            double boundRectX = inGrid.GetTopLeftX() + inGrid.GetSectionWidth() * (GetX() - GetRadius());
            int    maxY       = inGrid.GetTopLeftY() + inGrid.GetHeight();
            double boundRectY = maxY - inGrid.GetSectionHeight() * (GetY() + GetRadius());

            float plantDiameter = (float)GetDiameter();

            float rectHeight = plantDiameter * inGrid.GetSectionHeight();
            float rectiWidth = plantDiameter * inGrid.GetSectionWidth();

            System.Drawing.RectangleF boundingRect       = new System.Drawing.RectangleF((float)boundRectX, (float)boundRectY, rectHeight, rectiWidth);
            System.Drawing.Color      EllipseBorderColor = System.Drawing.Color.Red;
            System.Drawing.Pen        ellipseBorderPen   = new System.Drawing.Pen(EllipseBorderColor);

            inGraphics.DrawEllipse(ellipseBorderPen, boundingRect);
            System.Drawing.SolidBrush ellipseFillBrush = new System.Drawing.SolidBrush(GetFillColor());
            inGraphics.FillEllipse(ellipseFillBrush, boundingRect);

            if (bPrintAgeType)
            {
                System.Drawing.Font       textFont  = new System.Drawing.Font("Arial", 16);
                System.Drawing.SolidBrush textBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Black);
                float textX = (float)(inGrid.GetTopLeftX() + inGrid.GetSectionWidth() * (GetX() - GetRadius()));
                float textY = (float)(maxY - inGrid.GetSectionHeight() * (GetY() + GetRadius()));
                inGraphics.DrawString(GetAgeType().ToString(), textFont, textBrush, textX, textY);
            }

            ellipseBorderPen.Dispose();
        }
Exemple #3
0
 public void Dispose()
 {
     if (_pen != null)
     {
         _pen.Dispose();
     }
 }
Exemple #4
0
        public void drawALine(LinkedList [] l, System.Drawing.Color c)
        {
            System.Drawing.Graphics g   = mainVars.getForm().CreateGraphics();
            System.Drawing.Pen      pen = new System.Drawing.Pen(c, 3);
            for (int i = l.Length - 1; i >= 0; i--)
            {
                LinkedListNode node = l[i].getHead().getNext();
                while (node != null)
                {
                    if (node.getData().right != null)
                    {
                        BinaryTreeeNode parent        = node.getData();
                        int             parent_midleX = parent.getButton().Location.X + (parent.getButton().Width / 2),
                                        parent_midleY = parent.getButton().Location.Y + parent.right.getButton().Height;
                        int child_midlleX             = parent.right.getButton().Location.X + (parent.right.getButton().Width / 2),
                            child_midlleY             = parent.right.getButton().Location.Y;
                        g.DrawLine(pen, parent_midleX, parent_midleY,
                                   child_midlleX, child_midlleY);
                        child_midlleX = parent.left.getButton().Location.X + (parent.left.getButton().Width / 2);
                        child_midlleY = parent.left.getButton().Location.Y;
                        g.DrawLine(pen, parent_midleX, parent_midleY,
                                   child_midlleX, child_midlleY);
                    }
                    node = node.getNext();
                }
            }

            pen.Dispose();
        }
        private void TableLayoutPanelCellPaint(object sender, PaintEventArgs e)
        {
            System.Drawing.Pen penColor = new System.Drawing.Pen(System.Drawing.Color.LightGray);

            e.Graphics.DrawRectangle(penColor, e.ClipRectangle);
            penColor.Dispose();
        }
Exemple #6
0
 private void DrawRectPanel(System.Windows.Forms.PaintEventArgs pevent)
 {
     if ((_GradientMode == Oranikle.Studio.Controls.StyledPanel_LinearGradientMode.None) || BackColor == _BackColour2)
     {
         pevent.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.Invalid;
         pevent.Graphics.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.Low;
         pevent.Graphics.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.None;
         pevent.Graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.None;
     }
     else
     {
         pevent.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
         pevent.Graphics.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.High;
         pevent.Graphics.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
         pevent.Graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     }
     System.Drawing.Brush brush = GetBackgroundBrush(pevent);
     pevent.Graphics.FillRectangle(brush, ClientRectangle);
     brush.Dispose();
     if ((_BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle) && (_BorderWidth > 0))
     {
         System.Drawing.Pen       pen        = GetBorderPen(_BorderColour, _BorderWidth);
         System.Drawing.Rectangle rectangle2 = ClientRectangle;
         System.Drawing.Point     point      = rectangle2.Location;
         point.X += _BorderWidth / 2;
         point.Y += _BorderWidth / 2;
         System.Drawing.Rectangle rectangle3 = ClientRectangle;
         System.Drawing.Size      size       = rectangle3.Size;
         size.Width  -= _BorderWidth;
         size.Height -= _BorderWidth;
         System.Drawing.Rectangle rectangle1 = new System.Drawing.Rectangle(point, size);
         pevent.Graphics.DrawRectangle(pen, rectangle1);
         pen.Dispose();
     }
 }
 public void Dispose()
 {
     if (mPen != null)
     {
         mPen.Dispose();
         mPen = null;
     }
 }
 public void Dispose()
 {
     _bitmapRender.Dispose();
     _gridPen.Dispose();
     _hoverPen.Dispose();
     _selectedPen.Dispose();
     _fpsFont.Dispose();
 }
Exemple #9
0
        private void On_TakeImageButtonClick(object sender, EventArgs e)
        {
            if (webCam != null)
            {
                if (stillImageBox.Image != null)
                {
                    stillImageBox.Image.Dispose();
                }
                if (originalPicture != null)
                {
                    originalPicture.Dispose();
                }
                try
                {
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor;
                    // Release any previous buffer
                    if (ip != IntPtr.Zero)
                    {
                        Marshal.FreeCoTaskMem(ip);
                        ip = IntPtr.Zero;
                    }
                    // capture image
                    ip = webCam.Click();
                    originalPicture = new System.Drawing.Bitmap(webCam.Width, webCam.Height, webCam.Stride, PixelFormat.Format24bppRgb, ip);
                    originalPicture.RotateFlip(System.Drawing.RotateFlipType.RotateNoneFlipY);

                    System.Drawing.Bitmap result = new System.Drawing.Bitmap(200, 150);
                    using (System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(result))
                    {
                        graph.InterpolationMode = System.Drawing.Drawing2D.InterpolationMode.NearestNeighbor;
                        graph.DrawImage(originalPicture, 0, 0, 200, 150);
                        System.Drawing.Pen pen = new System.Drawing.Pen(System.Drawing.Color.Purple, 1);
                        for (int i = 0; i < 3; i++)
                        {
                            for (int j = 0; j < 3; j++)
                            {
                                graph.DrawRectangle(pen, 25 + 25 - 10 + 50 * j, 25 - 10 + 50 * i, 20, 20);
                            }
                        }
                        pen.Dispose();
                    }
                    stillImageBox.Image = result;
                    System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default;
                }
                catch
                {
                    System.Drawing.Bitmap bitmap = new System.Drawing.Bitmap(VIDEOWIDTH, VIDEOHEIGHT);
                    using (System.Drawing.Graphics graph = System.Drawing.Graphics.FromImage(bitmap))
                    {
                        System.Drawing.Rectangle size = new System.Drawing.Rectangle(0, 0, VIDEOWIDTH, VIDEOHEIGHT);
                        graph.FillRectangle(System.Drawing.Brushes.White, size);
                    }
                    stillImageBox.Image = bitmap;
                    webCam.Dispose();
                    webCam = null;
                }
            }
        }
Exemple #10
0
        public override void Draw(System.Drawing.Rectangle renderingRect, System.Drawing.Graphics g, ICoordinateMapper coordinateMapper)
        {
            if (g == null)
            {
                throw new System.ArgumentNullException("g");
            }
            if (coordinateMapper == null)
            {
                throw new System.ArgumentNullException("coordinateMapper");
            }

            System.Drawing.Drawing2D.GraphicsPath drawPath = CreateViewportPath(coordinateMapper);
            System.Drawing.Pen pen = CreateViewportPen(coordinateMapper);

            System.Drawing.Drawing2D.SmoothingMode oldSmoothingMode = g.SmoothingMode;
            try
            {
                switch (base.DrawMode)
                {
                case VObjectDrawMode.Draft:
                    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.Default;
                    break;

                case VObjectDrawMode.Normal:
                    g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
                    break;

                default:
                    throw new Aurigma.GraphicsMill.UnexpectedException(StringResources.GetString("ExStrUnexpectedDrawMode"));
                }

                if (_brush != null)
                {
                    AdaptBrushToViewport(coordinateMapper);
                    try
                    {
                        g.FillPath(_brush, drawPath);
                    }
                    finally
                    {
                        RestoreBrush();
                    }
                }
                if (pen != null)
                {
                    g.DrawPath(pen, drawPath);
                }
            }
            finally
            {
                if (pen != null)
                {
                    pen.Dispose();
                }
                drawPath.Dispose();
                g.SmoothingMode = oldSmoothingMode;
            }
        }
Exemple #11
0
 public void draw(System.Windows.Forms.Control control, Point k)
 {
     System.Drawing.Pen myPen;
     myPen = new System.Drawing.Pen(System.Drawing.Color.Black);
     System.Drawing.Graphics formGraphics = control.CreateGraphics();
     formGraphics.DrawLine(myPen, k.x * a.x, k.y * a.y, k.x * b.x, k.y * b.y);
     myPen.Dispose();
     formGraphics.Dispose();
 }
Exemple #12
0
        private void findCalendars(Folders folders, Dictionary <string, MAPIFolder> calendarFolders, String excludeDeletedFolder, MAPIFolder defaultCalendar = null)
        {
            //Initiate progress bar (red line underneath "Getting calendars" text)
            System.Drawing.Graphics g          = MainForm.Instance.tabOutlook.CreateGraphics();
            System.Drawing.Pen      p          = new System.Drawing.Pen(System.Drawing.Color.Red, 3);
            System.Drawing.Point    startPoint = new System.Drawing.Point(MainForm.Instance.lOutlookCalendar.Location.X,
                                                                          MainForm.Instance.lOutlookCalendar.Location.Y + MainForm.Instance.lOutlookCalendar.Size.Height + 3);
            double stepSize = MainForm.Instance.lOutlookCalendar.Size.Width / folders.Count;

            int fldCnt = 0;

            foreach (MAPIFolder folder in folders)
            {
                fldCnt++;
                System.Drawing.Point endPoint = new System.Drawing.Point(MainForm.Instance.lOutlookCalendar.Location.X + Convert.ToInt16(fldCnt * stepSize),
                                                                         MainForm.Instance.lOutlookCalendar.Location.Y + MainForm.Instance.lOutlookCalendar.Size.Height + 3);
                try { g.DrawLine(p, startPoint, endPoint); } catch { /*May get GDI+ error if g has been repainted*/ }
                System.Windows.Forms.Application.DoEvents();
                try {
                    OlItemType defaultItemType = folder.DefaultItemType;
                    if (defaultItemType == OlItemType.olAppointmentItem)
                    {
                        if (defaultCalendar == null ||
                            (folder.EntryID != defaultCalendar.EntryID))
                        {
                            calendarFolders.Add(folder.Name, folder);
                        }
                    }
                    if (folder.EntryID != excludeDeletedFolder && folder.Folders.Count > 0)
                    {
                        findCalendars(folder.Folders, calendarFolders, excludeDeletedFolder, defaultCalendar);
                    }
                } catch (System.Exception ex) {
                    OGCSexception.Analyse(ex);
                    if (oApp.Session.ExchangeConnectionMode.ToString().Contains("Disconnected") ||
                        ex.Message.StartsWith("Network problems are preventing connection to Microsoft Exchange.") ||
                        OGCSexception.GetErrorCode(ex, 0x000FFFFF) == "0x00040115")
                    {
                        log.Info("Currently disconnected from Exchange - unable to retrieve MAPI folders.");
                        MainForm.Instance.ToolTips.SetToolTip(MainForm.Instance.cbOutlookCalendars,
                                                              "The Outlook calendar to synchonize with.\nSome may not be listed as you are currently disconnected.");
                    }
                    else
                    {
                        log.Error("Failed to recurse MAPI folders.");
                        log.Error(ex.Message);
                        MessageBox.Show("A problem was encountered when searching for Outlook calendar folders.",
                                        "Calendar Folders", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
            p.Dispose();
            try { g.Clear(System.Drawing.Color.White); } catch { }
            g.Dispose();
            System.Windows.Forms.Application.DoEvents();
        }
Exemple #13
0
 private void ucSteps_Paint(object sender, PaintEventArgs e)
 {
     // base.OnPaint(e);
     System.Drawing.Pen      myPen = new System.Drawing.Pen(System.Drawing.Color.LightGray);
     System.Drawing.Graphics formGraphics;
     formGraphics = this.CreateGraphics();
     formGraphics.DrawLine(myPen, 220, 10, 220, 450);
     //formGraphics.DrawLine(myPen, 200, 300, 532, 286);
     myPen.Dispose();
 }
        public void Draw(System.Drawing.Bitmap bitmap, List <System.Drawing.Point> points)
        {
            System.Drawing.Point startPoint = points[0], endPoint = points[1];

            System.Drawing.Pen      pen = new System.Drawing.Pen(System.Drawing.Brushes.Blue, 3);
            System.Drawing.Graphics g   = System.Drawing.Graphics.FromImage(bitmap);
            g.DrawEllipse(pen, startPoint.X, startPoint.Y, endPoint.X, endPoint.Y);

            pen.Dispose(); g.Dispose();
        }
 private void Representation_Paint(object sender, System.Windows.Forms.PaintEventArgs e)
 {
     System.Drawing.Graphics g = e.Graphics;
     g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     System.Drawing.Pen        p   = new System.Drawing.Pen(System.Drawing.Color.Tomato, 2);
     System.Drawing.SolidBrush myb = new System.Drawing.SolidBrush(System.Drawing.Color.White);
     g.DrawEllipse(p, 1, 1, 17, 17);
     g.FillEllipse(myb, 1, 1, 17, 17);
     p.Dispose();
 }
Exemple #16
0
        public override void Draw(System.Drawing.Graphics drawArea)
        {
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Green);
            drawArea.FillRectangle(myBrush, posX, posY, sides[0], sides[0]);
            myBrush.Dispose();

            System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.LightGreen);
            myPen.Width = 5;
            drawArea.DrawRectangle(myPen, posX, posY, sides[0], sides[0]);
            myPen.Dispose();
        }
Exemple #17
0
        public override void Draw(System.Drawing.Graphics drawArea)
        {
            System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(System.Drawing.Color.Yellow);
            drawArea.FillEllipse(myBrush, posX, posY, radius * 2, radius * 2);
            myBrush.Dispose();

            System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.DarkOrange);
            myPen.Width = 5;
            drawArea.DrawEllipse(myPen, posX, posY, radius * 2, radius * 2);
            myPen.Dispose();
        }
Exemple #18
0
        /// <summary>
        /// 引发 Paint 事件。
        /// </summary>
        /// <param name="e"></param>
        protected override void OnPaint(System.Windows.Forms.PaintEventArgs e)
        {
            System.Drawing.Pen penGray = new System.Drawing.Pen(System.Drawing.Color.Silver);
            e.Graphics.DrawLine(penGray, base.Padding.Left, this.Padding.Top, this.Width - base.Padding.Right, this.Padding.Top);
            penGray.Dispose();

            System.Drawing.Pen penWhite = new System.Drawing.Pen(System.Drawing.Brushes.White);
            e.Graphics.DrawLine(penWhite, base.Padding.Left, this.Padding.Top + 1, this.Width - base.Padding.Right, this.Padding.Top + 1);
            penWhite.Dispose();

            base.OnPaint(e);
        }
Exemple #19
0
        public void Stroke()
        {
            System.Drawing.Pen p = new System.Drawing.Pen(brush[brush.Count - 1], (float)strokesize[strokesize.Count - 1]);

            if (dashsize[dashsize.Count - 1] > 0)
            {
                p.DashPattern = new float[] { (float)dashsize[dashsize.Count - 1], (float)(dashsize[dashsize.Count - 1] / 2) }
            }
            ;

            graphics.DrawPath(p, path[path.Count - 1]);
            p.Dispose();
        }
        private void DrawRulerLine(System.Drawing.Graphics grap, int x1, int x2, int y1, int y2)
        {
            using (System.Drawing.SolidBrush brush = new System.Drawing.SolidBrush(System.Drawing.Color.DarkGray))
            {
                using (System.Drawing.Pen pen = new System.Drawing.Pen(brush, (float)0.3))
                {
                    grap.DrawLine(pen, x1, y1, x2, y2);

                    pen.Dispose();

                    brush.Dispose();
                }
            }
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         foreach (Texture2D item in rulerTextures.Values)
         {
             item?.Dispose();
         }
         rulerTextures.Clear();
         fontBrush.Dispose();
         rulerPen.Dispose();
     }
     base.Dispose(disposing);
 }
Exemple #22
0
        protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
        {
            base.OnPaintBackground(pevent);
            pevent.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            System.Drawing.Drawing2D.GraphicsPath graphPath;
            graphPath = this.CreatePath();
            //	Create Gradient Brush (Cannot be width or height 0)
            System.Drawing.Drawing2D.LinearGradientBrush filler;
            System.Drawing.Rectangle rect = this.ClientRectangle;
            if (this.ClientRectangle.Width == 0)
            {
                rect.Width += 1;
            }
            if (this.ClientRectangle.Height == 0)
            {
                rect.Height += 1;
            }

            /*if (this.m_GradientMode == LinearGradientMode.None)
             * {
             *      filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor1, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
             * }
             * else
             * {
             *      filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor2, ((System.Drawing.Drawing2D.LinearGradientMode)this.m_GradientMode));
             * }
             */
            filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor2, ((System.Drawing.Drawing2D.LinearGradientMode) this.m_GradientMode));


            pevent.Graphics.FillPath(filler, graphPath);
            //filler.Dispose();	// Fxcop warning
            if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle)
            {
                System.Drawing.Pen borderPen = new System.Drawing.Pen(this.m_BorderColor, this.m_BorderWidth);
                pevent.Graphics.DrawPath(borderPen, graphPath);
                borderPen.Dispose();
            }
            else if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.Fixed3D)
            {
                DrawBorder3D(pevent.Graphics, this.ClientRectangle);
            }
            else if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.None)
            {
            }
            filler.Dispose();
            graphPath.Dispose();
        }
 protected virtual void Dispose(bool disposing)
 {
     if (disposing && _borderPen != null)
     {
         try
         {
             _borderPen.Dispose();
         }
         catch (System.ArgumentException)
         {
         }
         finally
         {
             _borderPen = null;
         }
     }
 }
Exemple #24
0
 protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent)
 {
     this.DoubleBuffered = true;
     this.SuspendLayout();
     base.OnPaintBackground(pevent);
     pevent.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
     System.Drawing.Drawing2D.GraphicsPath graphPath;
     graphPath = this.GetPath();
     //	Create Gradient Brush (Cannot be width or height 0)
     System.Drawing.Drawing2D.LinearGradientBrush filler;
     System.Drawing.Rectangle rect = this.ClientRectangle;
     if (this.ClientRectangle.Width == 0)
     {
         rect.Width += 1;
     }
     if (this.ClientRectangle.Height == 0)
     {
         rect.Height += 1;
     }
     if (this._GradientMode == LinearGradientMode.None)
     {
         filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this._BackColour1, this._BackColour1, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
     }
     else
     {
         filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this._BackColour1, this._BackColour2, ((System.Drawing.Drawing2D.LinearGradientMode) this._GradientMode));
     }
     pevent.Graphics.FillPath(filler, graphPath);
     filler.Dispose();
     if (this._BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle)
     {
         System.Drawing.Pen borderPen = new System.Drawing.Pen(this._BorderColour, this._BorderWidth);
         pevent.Graphics.DrawPath(borderPen, graphPath);
         borderPen.Dispose();
     }
     else if (this._BorderStyle == System.Windows.Forms.BorderStyle.Fixed3D)
     {
         DrawBorder3D(pevent.Graphics, this.ClientRectangle);
     }
     else if (this._BorderStyle == System.Windows.Forms.BorderStyle.None)
     {
     }
     filler.Dispose();
     graphPath.Dispose();
     this.ResumeLayout(false);
 }
Exemple #25
0
        private static void RenderShape(GH_Canvas canvas, System.Drawing.Graphics graphics, System.Drawing.PointF[] points, System.Drawing.Color color)
        {
            int   alpha    = GH_Canvas.ZoomFadeMedium;
            float x0       = points[0].X;
            float x        = x0;
            float y0       = points[0].Y;
            float y        = y0;
            int   arg_32_0 = 1;
            int   num      = points.Length - 1;

            for (int i = arg_32_0; i <= num; i++)
            {
                x0 = System.Math.Min(x0, points[i].X);
                x  = System.Math.Max(x, points[i].X);
                y0 = System.Math.Min(y0, points[i].Y);
                y  = System.Math.Max(y, points[i].Y);
            }
            System.Drawing.RectangleF bounds = System.Drawing.RectangleF.FromLTRB(x0, y0, x, y);
            bounds.Inflate(1f, 1f);
            System.Drawing.Drawing2D.LinearGradientBrush fill = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, color, GH_GraphicsUtil.OffsetColour(color, 50), System.Drawing.Drawing2D.LinearGradientMode.Vertical);
            fill.WrapMode = System.Drawing.Drawing2D.WrapMode.TileFlipXY;
            graphics.FillPolygon(fill, points);
            fill.Dispose();
            if (alpha > 0)
            {
                System.Drawing.Color col0 = System.Drawing.Color.FromArgb(System.Convert.ToInt32(0.5 * (double)alpha), System.Drawing.Color.White);
                System.Drawing.Color col  = System.Drawing.Color.FromArgb(0, System.Drawing.Color.White);
                System.Drawing.Drawing2D.LinearGradientBrush highlightFill = new System.Drawing.Drawing2D.LinearGradientBrush(bounds, col0, col, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
                highlightFill.WrapMode = System.Drawing.Drawing2D.WrapMode.TileFlipXY;
                System.Drawing.Pen highlightEdge = new System.Drawing.Pen(highlightFill, 3f);
                highlightEdge.LineJoin      = System.Drawing.Drawing2D.LineJoin.Round;
                highlightEdge.CompoundArray = new float[]
                {
                    0f,
                    0.5f
                };
                graphics.DrawPolygon(highlightEdge, points);
                highlightFill.Dispose();
                highlightEdge.Dispose();
            }
            graphics.DrawPolygon(new System.Drawing.Pen(color, 1f)
            {
                LineJoin = System.Drawing.Drawing2D.LineJoin.Round
            }, points);
        }
Exemple #26
0
        public void DrawProgress(int proc)
        {
            int penWidth = 4;

            System.Drawing.Pen      pen = new System.Drawing.Pen(System.Drawing.Color.Green, penWidth);
            System.Drawing.Graphics g   = CreateGraphics();
            int w = ClientSize.Width - (penWidth / 2);
            int h = ClientSize.Height - (penWidth / 2);
            int P = w * 2 + h * 2;
            int L = P * proc / 100;
            int DL1 = Math.Min(L, w / 2); L -= DL1;
            int DL2 = Math.Min(L, h);     L -= DL2;
            int DL3 = Math.Min(L, w);     L -= DL3;
            int DL4 = Math.Min(L, h);     L -= DL4;
            int DL5 = Math.Min(L, w / 2); L -= DL5;
            int x = w / 2 + 1, y = h + 1;

            if (DL1 > 0)
            {
                g.DrawLine(pen, x, y, x - DL1 - 1, y);
            }
            x -= DL1;
            if (DL2 > 0)
            {
                g.DrawLine(pen, x, y, x, y - DL2 - 1);
            }
            y -= DL2;
            if (DL3 > 0)
            {
                g.DrawLine(pen, x, y, x + DL3 + 1, y);
            }
            x += DL3;
            if (DL4 > 0)
            {
                g.DrawLine(pen, x, y, x, y + DL4 + 1);
            }
            y += DL4;
            if (DL5 > 0)
            {
                g.DrawLine(pen, x, y, x - DL5 - 1, y);
            }
            x -= DL5;
            pen.Dispose();
            g.Dispose();
        }
Exemple #27
0
 protected override void Dispose(bool disposing)
 {
     if (disposing && gfx != null)
     {
         gfx.Dispose();
     }
     if (disposing && view != null)
     {
         view.Dispose();
     }
     if (disposing)
     {
         gridPen.Dispose();
         selectPen.Dispose();
         textBrush.Dispose();
     }
     base.Dispose(disposing);
 }
Exemple #28
0
 private void DrawCurvedPanel(System.Windows.Forms.PaintEventArgs pevent)
 {
     pevent.Graphics.Clear(GetColorBehindCurve());
     pevent.Graphics.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
     pevent.Graphics.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.High;
     pevent.Graphics.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
     pevent.Graphics.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
     System.Drawing.Drawing2D.GraphicsPath graphicsPath = GetCurvedPath();
     System.Drawing.Brush brush = GetBackgroundBrush(pevent);
     pevent.Graphics.FillPath(brush, graphicsPath);
     brush.Dispose();
     if ((_BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle) && (_BorderWidth > 0))
     {
         System.Drawing.Pen pen = GetBorderPen(_BorderColour, _BorderWidth);
         pevent.Graphics.DrawPath(pen, graphicsPath);
         pen.Dispose();
     }
     graphicsPath.Dispose();
 }
Exemple #29
0
 private void HandleDrawSimpleBackground(ref System.Windows.Forms.Message message)
 {
     if ((message.Msg == 15) && (DropDownStyle == System.Windows.Forms.ComboBoxStyle.Simple))
     {
         System.IntPtr intPtr = Oranikle.Studio.Controls.StyledComboBox.GetWindowDC(message.HWnd);
         if (intPtr != System.IntPtr.Zero)
         {
             System.Drawing.Graphics  graphics  = System.Drawing.Graphics.FromHdc(intPtr);
             System.Drawing.Rectangle rectangle = new System.Drawing.Rectangle(0, 0, Width, Height);
             System.Drawing.Color     color     = Enabled ? System.Drawing.Color.FromArgb(90, 90, 90) : System.Drawing.SystemColors.Control;
             System.Drawing.Pen       pen       = new System.Drawing.Pen(color, 6.0F);
             graphics.DrawRectangle(pen, rectangle);
             message.Result = (System.IntPtr) 1;
             Oranikle.Studio.Controls.StyledComboBox.ReleaseDC(message.HWnd, intPtr);
             pen.Dispose();
             graphics.Dispose();
         }
     }
 }
Exemple #30
0
        // implement Draw() (step 5)
        public void Draw(System.Drawing.Graphics image)
        {
            System.Drawing.Brush brush = new System.Drawing.SolidBrush(color);
            System.Drawing.Pen   pen   = new System.Drawing.Pen(color);

            // Determine if circle, since use [upperLeft, width, height, !vertices] only
            if (name.Equals("Circle"))
            {
                image.DrawEllipse(pen, UpperLeft.X, UpperLeft.Y, Height, Width);
                image.FillEllipse(brush, new System.Drawing.Rectangle(UpperLeft.X, UpperLeft.Y, Width, Height));
            }
            else
            {
                image.DrawPolygon(pen, Vertices);
                image.FillPolygon(brush, Vertices);
            }

            brush.Dispose();
            pen.Dispose();
        }
Exemple #31
0
		protected override void OnPaintBackground(System.Windows.Forms.PaintEventArgs pevent) 
		{
			base.OnPaintBackground(pevent);
			pevent.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
			System.Drawing.Drawing2D.GraphicsPath graphPath;
			graphPath = this.CreatePath();
			//	Create Gradient Brush (Cannot be width or height 0)
			System.Drawing.Drawing2D.LinearGradientBrush filler;
			System.Drawing.Rectangle rect = this.ClientRectangle;
			if (this.ClientRectangle.Width == 0) 
			{
				rect.Width += 1;
			}
			if (this.ClientRectangle.Height == 0) 
			{
				rect.Height += 1;
			}
			
			/*if (this.m_GradientMode == LinearGradientMode.None) 
			{
				filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor1, System.Drawing.Drawing2D.LinearGradientMode.Vertical);
			} 
			else 
			{
				filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor2, ((System.Drawing.Drawing2D.LinearGradientMode)this.m_GradientMode));
			}
			*/
			filler = new System.Drawing.Drawing2D.LinearGradientBrush(rect, this.m_BackColor1, this.m_BackColor2, ((System.Drawing.Drawing2D.LinearGradientMode)this.m_GradientMode));


			pevent.Graphics.FillPath(filler, graphPath);
			//filler.Dispose();	// Fxcop warning
			if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.FixedSingle) 
			{
				System.Drawing.Pen borderPen = new System.Drawing.Pen(this.m_BorderColor, this.m_BorderWidth);
				pevent.Graphics.DrawPath(borderPen, graphPath);
				borderPen.Dispose();
			} 
			else if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.Fixed3D) 
			{
				DrawBorder3D(pevent.Graphics, this.ClientRectangle);
			} 
			else if (this.m_BorderStyle == System.Windows.Forms.BorderStyle.None) 
			{
			}
			filler.Dispose();
			graphPath.Dispose();
		}
        public void Stroke()
        {
            System.Drawing.Pen p = new System.Drawing.Pen(brush[brush.Count - 1], (float)strokesize[strokesize.Count - 1]);

            if (dashsize[dashsize.Count - 1] > 0)
                p.DashPattern = new float[] { (float)dashsize[dashsize.Count - 1], (float)(dashsize[dashsize.Count - 1] / 2) };

            graphics.DrawPath(p, path[path.Count - 1]);
            p.Dispose();
        }
Exemple #33
0
 private void ucSteps_Paint(object sender, PaintEventArgs e)
 {
     // base.OnPaint(e);
     System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.LightGray);
     System.Drawing.Graphics formGraphics;
     formGraphics = this.CreateGraphics();
     formGraphics.DrawLine(myPen, 220, 10, 220, 450);
     //formGraphics.DrawLine(myPen, 200, 300, 532, 286);
     myPen.Dispose();
 }
Exemple #34
0
 public void DrawProgress()
 {
     int penWidth = 4;
     System.Drawing.Pen      pen = new System.Drawing.Pen(System.Drawing.Color.Green, penWidth);
     System.Drawing.Graphics g   = CreateGraphics();
     int w = ClientSize.Width  - (penWidth / 2);
     int h = ClientSize.Height - (penWidth / 2);
     int P = w * 2 + h * 2;
     int L = P * ProgressProcent / 100 ;
     int DL1 = Math.Min(L, w / 2); L -= DL1;
     int DL2 = Math.Min(L, h);     L -= DL2;
     int DL3 = Math.Min(L, w);     L -= DL3;
     int DL4 = Math.Min(L, h);     L -= DL4;
     int DL5 = Math.Min(L, w / 2);
     int x = w / 2 + 1, y = h + 1;
     if (DL1 > 0) g.DrawLine(pen, x, y, x - DL1 - 1, y); x -= DL1;
     if (DL2 > 0) g.DrawLine(pen, x, y, x, y - DL2 - 1); y -= DL2;
     if (DL3 > 0) g.DrawLine(pen, x, y, x + DL3 + 1, y); x += DL3;
     if (DL4 > 0) g.DrawLine(pen, x, y, x, y + DL4 + 1); y += DL4;
     if (DL5 > 0) g.DrawLine(pen, x, y, x - DL5 - 1, y);
     pen.Dispose();
     g.Dispose();
 }
 Rhino.Display.DisplayBitmap GetSprite()
 {
   if (m_sprite == null)
   {
     var bmp = new System.Drawing.Bitmap(64, 64);
     using (System.Drawing.Graphics g = System.Drawing.Graphics.FromImage(bmp))
     {
       g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
       g.Clear(System.Drawing.Color.Transparent);
       var pen = new System.Drawing.Pen(System.Drawing.Color.White, 6);
       pen.EndCap = System.Drawing.Drawing2D.LineCap.Round;
       pen.StartCap = pen.EndCap;
       g.DrawArc(pen, new System.Drawing.Rectangle(16, 16, 32, 32), 0, 360);
       g.DrawLine(pen, new System.Drawing.Point(8, 8), new System.Drawing.Point(56, 56));
       g.DrawLine(pen, new System.Drawing.Point(8, 56), new System.Drawing.Point(56, 8));
       pen.Dispose();
     }
     m_sprite = new Rhino.Display.DisplayBitmap(bmp);
   }
   return m_sprite;
 }