コード例 #1
1
 void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     var borderPen = new Pen (Brushes.Black,1);
     g.DrawRectangle (borderPen, (float)panel1.Bounds.X, (float)panel1.Bounds.Y, (float)panel1.Bounds.Width, (float)panel1.Bounds.Height);
     borderPen.Dispose ();
     float a = panel1.Height / 4;
     var dc = new DrawCylinder (this, a, 2 * a);
     dc.DrawIsometricView (g);
 }
コード例 #2
0
ファイル: Ellipse.cs プロジェクト: aiten/CNCLib
		public override void Draw(PaintEventArgs e, PaintState paintstate)
        {
			Rectangle rect;
			Point start = DrawStartPosition;
			rect = new Rectangle(start, new Size(DrawEndPosition.X - start.X, DrawEndPosition.Y - start.Y));
            e.Graphics.DrawEllipse(GetForgroundPen(paintstate), rect);
        }
コード例 #3
0
ファイル: Chart.cs プロジェクト: GirlD/mono
		protected override void OnPaint (PaintEventArgs e)
		{
			base.OnPaint (e);

			ChartGraphics g = new ChartGraphics (e.Graphics);

			PaintElement (g, this, new ElementPosition (0, 0, 100, 100));

			foreach (var area in ChartAreas)
				PaintElement (g, area, new ElementPosition (9.299009f, 6.15f, 86.12599f, 81.1875f));

			foreach (var series in Series)
				PaintElement (g, series, new ElementPosition (9.299009f, 6.15f, 86.12599f, 81.1875f));
		}
コード例 #4
0
        void PlotPanelPaint(object sender, PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            var borderPen = new Pen(Brushes.Black,1);
            g.DrawRectangle (borderPen, (float)panel1.Bounds.X, (float)panel1.Bounds.Y, (float)panel1.Bounds.Width, (float)panel1.Bounds.Height);
            borderPen.Dispose ();

            g.SmoothingMode = SmoothingMode.AntiAlias;
            float a;

            if (panel1.Height < panel1.Width)
                a = panel1.Height / 3;
            else
                a = panel1.Height / 4;

            var ds = new DrawSphere (this, a, 0, 0, -a / 2);
            ds.DrawIsometricView (g);
            ds = new DrawSphere(this, 2 * a / 3, -a/2, -a/2, a / 2);
            ds.DrawIsometricView (g);
        }
コード例 #5
0
ファイル: Program.cs プロジェクト: 0xack13/LegacyDraw
        private void Form1_Paint(object sender, PaintEventArgs e)
        {
            Graphics myGraphics = e.Graphics;

            myGraphics.Clear(Color.White);
            double radius = 5;
            for (int j = 1; j <= 25; j++)
            {
                radius = (j + 1) * 5;
                for (double i = 0.0; i < 360.0; i += 0.1)
                {
                    double angle = i * System.Math.PI / 180;
                    int x = (int)(150 + radius * System.Math.Cos(angle));
                    int y = (int)(150 + radius * System.Math.Sin(angle));

                    PutPixel(myGraphics, x, y, Color.Red);
                    //System.Threading.Thread.Sleep(1); // If you want to draw circle very slowly.
                }
            }
            myGraphics.Dispose();
        }
コード例 #6
0
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            CalendarRendererEventArgs evt = new CalendarRendererEventArgs(this, e.Graphics, e.ClipRectangle);

            ///Calendar background
            Renderer.OnDrawBackground(evt);

            /// Headers / Timescale
            switch (DaysMode)
            {
                case CalendarDaysMode.Short:
                    Renderer.OnDrawDayNameHeaders(evt);
                    Renderer.OnDrawWeekHeaders(evt);
                    break;
                case CalendarDaysMode.Expanded:
                    Renderer.OnDrawTimeScale(evt);
                    break;
                default:
                    throw new NotImplementedException("Current DaysMode not implemented");
            }

            ///Days on view
            Renderer.OnDrawDays(evt);

            ///Items
            Renderer.OnDrawItems(evt);

            ///Overflow marks
            Renderer.OnDrawOverflows(evt);
        }
コード例 #7
0
        public override void DrawRect(CGRect dirtyRect)
        {
            Graphics g = Graphics.FromCurrentContext();
            g.Clear(backColor);

            Rectangle clip = new Rectangle((int)dirtyRect.X,
                                           (int)dirtyRect.Y,
                                           (int)dirtyRect.Width,
                                           (int)dirtyRect.Height);

            var args = new PaintEventArgs(g, clip);

            OnPaint(args);

            if(Paint != null)
            {
                Paint(this, args);
            }
        }
コード例 #8
0
ファイル: MainView.cs プロジェクト: aprilix/helloworldn2
 private void MainView_Paint(object sender, PaintEventArgs e)
 {
     Font font = new Font("Tahoma", 12f, FontStyle.Regular);
     Graphics graphics = e.Graphics;
     graphics.DrawString("Number of clicks: " + iClicks.ToString(), font, new SolidBrush(this.Title.TextColor), (float)8, (float)30);
 }
コード例 #9
0
 void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     AddData (g);
     cs.PlotPanelStyle (g);
     dc.AddBars (g, cs, dc.DataSeriesList.Count, ds.PointList.Count);
 }
コード例 #10
0
ファイル: PropertyGridTextBox.cs プロジェクト: nlhepler/mono
		private void dialog_button_Paint(object sender, PaintEventArgs e) {
			// best way to draw the ellipse?
			e.Graphics.DrawString("...", new Font(Font,FontStyle.Bold), Brushes.Black, 0,0);
		}
コード例 #11
0
        public override void Draw(RectangleF dirtyRect)
        {
            if(Paint != null)
            {
                Graphics g = Graphics.FromCurrentContext();
                Rectangle clip = new Rectangle((int)dirtyRect.X,
                                               (int)dirtyRect.Y,
                                               (int)dirtyRect.Width,
                                               (int)dirtyRect.Height);

                var args = new PaintEventArgs(g, clip);

                Paint(this, args);
            }
        }
コード例 #12
0
        protected void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.InterpolationMode = InterpolationMode.NearestNeighbor;

            g.Clear (Color.Wheat);
            switch (currentView) {
                case 0:
                DrawImage1 (g);
                break;
                case 1:
                DrawImage2 (g);
                break;
                case 2:
                DrawImage3 (g);
                break;
                case 3:
                DrawImage4 (g);
                break;
                case 4:
                DrawImage5 (g);
                break;
                case 5:
                DrawImage6 (g);
                break;
                case 6:
                DrawImage7 (g);
                break;
                case 7:
                DrawImage8 (g);
                break;
                case 8:
                DrawImage9 (g);
                break;
                case 9:
                DrawImagePageUnit (g);
                break;
                case 10:
                DrawImagePageUnit_2 (g);
                break;
                case 11:
                DrawImagePageUnit_3 (g);
                break;
                case 12:
                DrawImagePageUnit_4 (g);
                break;
                case 13:
                DrawImagePageUnitClip (g);
                break;
            case 14:
                DrawImageTranslateClip (g);
                break;
            case 15:
                FillRegionIntersect (g);
                break;
            case 16:
                DrawImageIntersectClip (g);
                break;
            }

            g.PageUnit = GraphicsUnit.Pixel;
            Brush sBrush = Brushes.Black;

            g.ResetTransform ();

            if (!g.IsClipEmpty) {
                var clipPoint = Point.Empty;
                var clipString = string.Format ("Clip-{0}", g.ClipBounds);
                g.ResetClip ();
                var clipSize = g.MeasureString (clipString, clipFont);
                clipPoint.X = (int)(ClientRectangle.Width / 2 - clipSize.Width / 2);
                clipPoint.Y = 5;
                g.DrawString (clipString, clipFont, sBrush, clipPoint);
            }

            var anyKeyPoint = Point.Empty;
            var anyKey = "Tap screen to continue.";
            var anyKeySize = g.MeasureString (anyKey, anyKeyFont);
            anyKeyPoint.X = ((int)(ClientRectangle.Width / 2 - anyKeySize.Width / 2));
            anyKeyPoint.Y = (int)(ClientRectangle.Height - anyKeySize.Height + 10);
            g.DrawString(anyKey, anyKeyFont, sBrush, anyKeyPoint );

            anyKeySize = g.MeasureString (title, anyKeyFont);
            anyKeyPoint.X = (int)(ClientRectangle.Width / 2 - anyKeySize.Width / 2);
            anyKeyPoint.Y -= (int)anyKeySize.Height;
            g.DrawString (title, anyKeyFont, sBrush, anyKeyPoint );

            g.Dispose ();
        }
コード例 #13
0
ファイル: Chart.cs プロジェクト: GirlD/mono
		protected override void OnPaintBackground (PaintEventArgs pevent)
		{
			base.OnPaintBackground (pevent);
		}
コード例 #14
0
        protected void DoPaint(object sender, PaintEventArgs e)
        {
            e.Graphics.DrawImage(graphImage, 0,26);

            base.OnPaint(e);
        }
コード例 #15
0
        public override void Draw(CGRect rect)
        {
            Graphics g = Graphics.FromCurrentContext();
            g.Clear(backColor);

            var clip = new Rectangle ((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
            var args = new PaintEventArgs(g, clip);

            OnPaint (args);
            Paint?.Invoke (this, args);
        }
コード例 #16
0
 private void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     AddData();
     cs.PlotPanelStyle(g);
     dc.AddStockChart(g, cs);
 }
コード例 #17
0
 private void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     g.SmoothingMode = SmoothingMode.AntiAlias;
     AddData();
     ds.AddPie(g, cs);
     lg.AddLegend(g, ds, cs);
 }
コード例 #18
0
ファイル: MonthView.cs プロジェクト: Hujairi/CMS
        protected override void OnPaint(PaintEventArgs e)
        {
            base.OnPaint(e);

            e.Graphics.Clear(SystemColors.Window);

            for (int i = 0; i < Months.Length; i++)
            {
                if (Months[i].Bounds.IntersectsWith(e.ClipRectangle))
                {
                    #region MonthTitle

                    string title = Months[i].Date.ToString(MonthTitleFormat);
                    MonthViewBoxEventArgs evtTitle = new MonthViewBoxEventArgs(e.Graphics, Months[i].MonthNameBounds,
                        title,
                        Focused ? MonthTitleTextColor : MonthTitleTextColorInactive,
                        Focused ? MonthTitleColor : MonthTitleColorInactive);

                    DrawBox(evtTitle);

                    #endregion

                    #region DayNames

                    for (int j = 0; j < Months[i].DayNamesBounds.Length; j++)
                    {
                        MonthViewBoxEventArgs evtDay = new MonthViewBoxEventArgs(e.Graphics, Months[i].DayNamesBounds[j], Months[i].DayHeaders[j],
                            StringAlignment.Far, ForeColor, DayBackgroundColor);

                        DrawBox(evtDay);
                    }

                    if (Months[i].DayNamesBounds != null && Months[i].DayNamesBounds.Length != 0)
                    {
                        using (Pen p = new Pen(MonthTitleColor))
                        {
                            int y = Months[i].DayNamesBounds[0].Bottom;
                            e.Graphics.DrawLine(p, new Point(Months[i].Bounds.X, y), new Point(Months[i].Bounds.Right, y));
                        }
                    }
                    #endregion

                    #region Days
                    foreach (MonthViewDay day in Months[i].Days)
                    {
                        if (!day.Visible) continue;

                        MonthViewBoxEventArgs evtDay = new MonthViewBoxEventArgs(e.Graphics, day.Bounds, day.Date.Day.ToString(),
                            StringAlignment.Far,
                            day.Grayed ? DayGrayedText : (day.Selected ? DaySelectedTextColor : ForeColor),
                            day.Selected ? DaySelectedBackgroundColor : DayBackgroundColor);

                        if (day.Date.Equals(DateTime.Now.Date))
                        {
                            evtDay.BorderColor = TodayBorderColor;
                        }

                        DrawBox(evtDay);
                    }
                    #endregion 

                    #region Arrows

                    if (i == 0)
                    {
                        Rectangle r = BackwardButtonBounds;
                        using (Brush b = new SolidBrush(BackwardButtonSelected ? ArrowsSelectedColor : ArrowsColor))
                        {
                            e.Graphics.FillPolygon(b, new Point[] { 
                                new Point(r.Right, r.Top),
                                new Point(r.Right, r.Bottom - 1),
                                new Point(r.Left + r.Width / 2, r.Top + r.Height / 2),
                            });
                        }
                    }

                    if (i == _forwardMonthIndex)
                    {
                        Rectangle r = ForwardButtonBounds;
                        using (Brush b = new SolidBrush(ForwardButtonSelected ? ArrowsSelectedColor : ArrowsColor))
                        {
                            e.Graphics.FillPolygon(b, new Point[] { 
                                new Point(r.X, r.Top),
                                new Point(r.X, r.Bottom - 1),
                                new Point(r.Left + r.Width / 2, r.Top + r.Height / 2),
                            });
                        }
                    }

                    #endregion
                }
            }
        }
コード例 #19
0
        protected void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.SmoothingMode = SmoothingMode.AntiAlias;

            switch (currentView)
            {
            case 0:
                PaintView0 (g);
                break;
            case 1:
                PaintView1 (g);
                break;
            case 2:
                GlassSphere (g);
                break;
            case 3:
                BlendingIn (g);
                break;
            case 4:
                PaintView3 (g);
                break;
            case 5:
                PaintViewB (g);
                break;
            case 6:
                PaintView4 (g);
                break;
            case 7:
                PaintView5 (g);
                break;
            case 8:
                PaintView6 (g);
                break;
            case 9:
                PaintView7 (g);
                break;
            };

            g.ResetTransform ();
            Brush sBrush = Brushes.Black;

            if (!g.IsClipEmpty)
            {
                var clipPoint = PointF.Empty;
                var clipString = string.Format("Clip-{0}", g.ClipBounds);
                g.ResetClip ();
                var clipSize = g.MeasureString(clipString, clipFont);
                clipPoint.X = (ClientRectangle.Width / 2) - (clipSize.Width / 2);
                clipPoint.Y = 5;
                g.DrawString(clipString, clipFont, sBrush, clipPoint );

            }

            var anyKeyPoint = PointF.Empty;
            var anyKey = "Press any key to continue.";
            var anyKeySize = g.MeasureString(anyKey, anyKeyFont);
            anyKeyPoint.X = (ClientRectangle.Width / 2) - (anyKeySize.Width / 2);
            anyKeyPoint.Y = ClientRectangle.Height - (anyKeySize.Height + 10);
            g.DrawString(anyKey, anyKeyFont, sBrush, anyKeyPoint );

            anyKeySize = g.MeasureString(title, anyKeyFont);
            anyKeyPoint.X = (ClientRectangle.Width / 2) - (anyKeySize.Width / 2);
            anyKeyPoint.Y -= anyKeySize.Height;
            g.DrawString(title, anyKeyFont, sBrush, anyKeyPoint );

            g.Dispose();
        }
コード例 #20
0
        protected override void OnPaint(PaintEventArgs pe)
        {
            string methodCountMessage = null, description;
            if (DataProvider == null || DataProvider.InsightDataCount < 1) {
                description = "Unknown Method";
            } else {
            //				if (DataProvider.InsightDataCount > 1) {
            //					StringParserService stringParserService = (StringParserService)ServiceManager.Services.GetService(typeof(StringParserService));
            //					stringParserService.Properties["CurrentMethodNumber"]  = (CurrentData + 1).ToString();
            //					stringParserService.Properties["NumberOfTotalMethods"] = DataProvider.InsightDataCount.ToString();
            //					methodCountMessage = stringParserService.Parse("${res:MonoDevelop.DefaultEditor.Gui.Editor.InsightWindow.NumberOfText}");
            //				}

                description = DataProvider.GetInsightData(CurrentData);
            }

            TipPainterTools.DrawHelpTipFromCombinedDescription(this, pe.Graphics,
                Font, methodCountMessage, description);
        }
コード例 #21
0
        private void ImagePanel_Paint(object sender, PaintEventArgs e)
        {
            if (bpp == ImageBitsPerPixel.Eight)
            {
                if (pix8.Count > 0)
                {
                    Graphics g = Graphics.FromHwnd(panel.Handle);
                    if (newImage == true)
                    {
                        g.Clear(SystemColors.Control);
                        newImage = false;
                    }

                    g.DrawImage(bmp, hOffset, vOffset);
                    g.Dispose();
                }
            }
            else if (bpp == ImageBitsPerPixel.Sixteen)
            {
                if (pix16.Count > 0)
                {
                    Graphics g = Graphics.FromHwnd(panel.Handle);
                    if (newImage == true)
                    {
                        g.Clear(SystemColors.Control);
                        newImage = false;
                    }

                    g.DrawImage(bmp, hOffset, vOffset);
                    g.Dispose();
                }
            }
            else //if (bpp == ImageBitsPerPixel.TwentyFour)  // 30 July 2010
            {
                if (pix24.Count > 0)
                {
                    Graphics g = Graphics.FromHwnd(panel.Handle);
                    if (newImage == true)
                    {
                        g.Clear(SystemColors.Control);
                        newImage = false;
                    }

                    g.DrawImage(bmp, hOffset, vOffset);
                    g.Dispose();
                }
            }
        }
コード例 #22
0
 protected override void OnPaintBackground(PaintEventArgs pe)
 {
     pe.Graphics.FillRectangle(SystemBrushes.Info, pe.ClipRectangle);
 }
コード例 #23
0
ファイル: PropertyGridTextBox.cs プロジェクト: nlhepler/mono
		private void dropdown_button_Paint(object sender, PaintEventArgs e)
		{
			ThemeEngine.Current.CPDrawComboButton(e.Graphics, dropdown_button.ClientRectangle, dropdown_button.ButtonState);
		}
コード例 #24
0
ファイル: Chart.cs プロジェクト: stabbylambda/mono
		protected override void OnPaint (PaintEventArgs e)
		{
			base.OnPaint (e);
		}
コード例 #25
0
        public override void DrawRect(System.Drawing.RectangleF dirtyRect)
        {
            if(Paint != null)
            {
                Graphics g = new Graphics();
                g.Clear(backColor);

                Rectangle clip = new Rectangle((int)dirtyRect.X,
                                               (int)dirtyRect.Y,
                                               (int)dirtyRect.Width,
                                               (int)dirtyRect.Height);

                var args = new PaintEventArgs(g, clip);

                Paint(this, args);
            }
        }
コード例 #26
0
 private void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     g.SmoothingMode = SmoothingMode.AntiAlias;
     AddData();
     cs.SetPolarAxes(g);
     dc.AddPolar(g,cs);
     lg.AddLegend(g, dc, cs);
     g.Dispose();
 }
コード例 #27
0
 public override void Draw(CGRect rect)
 {
     if (Paint != null) {
         Graphics g = Graphics.FromCurrentContext();
         var clip = new CGRect ((int)rect.X, (int)rect.Y, (int)rect.Width, (int)rect.Height);
         var args = new PaintEventArgs (g, clip);
         Paint(this, args);
     }
 }
コード例 #28
0
        protected void OnPaint(PaintEventArgs e)
        {
            Graphics g = e.Graphics;
            g.InterpolationMode = InterpolationMode.NearestNeighbor;

            g.Clear(Color.White);
            //g.SmoothingMode = SmoothingMode.None;
            switch (currentView)
            {
            case 0:
                FillRegionInfinite (g);
                break;
            case 1:
                FillRegionEmpty (g);
                break;
            case 2:
                FillRegion1 (g);
                break;
            case 3:
                FillRegionIntersect (g);
                break;
            case 4:
                FillRegionUnion (g);
                break;
            case 5:
                FillRegionExclude (g);
                break;
            case 6:
                FillRegionXor(g);
                break;
            case 7:
                FillRegionInfiniteIntersect(g);
                break;
            case 8:
                FillRegionInfiniteUnion(g);
                break;
            case 9:
                FillRegionInfiniteExclude(g);
                break;
            case 10:
                FillRegionInfiniteXor(g);
                break;
            case 11:
                FillRegionEmptyIntersect(g);
                break;
            case 12:
                FillRegionEmptyUnion(g);
                break;
            case 13:
                FillRegionEmptyExclude(g);
                break;
            case 14:
                FillRegionEmptyXor(g);
                break;
            case 15:
                TranslateRegion(g);
                break;
            case 16:
                TransformRegion(g);
                break;
            case 17:
                RegionIsVisibleRectangleF(g);
                break;

            }

            Brush sBrush = Brushes.Black;

            g.ResetTransform ();

            if (!g.IsClipEmpty)
            {
                var clipPoint = PointF.Empty;
                var clipString = string.Format("Clip-{0}", g.ClipBounds);
                g.ResetClip ();
                var clipSize = g.MeasureString(clipString, clipFont);
                clipPoint.X = (ClientRectangle.Width / 2) - (clipSize.Width / 2);
                clipPoint.Y = 5;
                g.DrawString(clipString, clipFont, sBrush, clipPoint );

            }

            var anyKeyPoint = PointF.Empty;
            var anyKey = "Tap screen to continue.";
            var anyKeySize = g.MeasureString(anyKey, anyKeyFont);
            anyKeyPoint.X = (ClientRectangle.Width / 2) - (anyKeySize.Width / 2);
            anyKeyPoint.Y = ClientRectangle.Height - (anyKeySize.Height + 10);
            g.DrawString(anyKey, anyKeyFont, sBrush, anyKeyPoint );

            anyKeySize = g.MeasureString(title, anyKeyFont);
            anyKeyPoint.X = (ClientRectangle.Width / 2) - (anyKeySize.Width / 2);
            anyKeyPoint.Y -= anyKeySize.Height;
            g.DrawString(title, anyKeyFont, sBrush, anyKeyPoint );

            g.Dispose();
        }
コード例 #29
0
 private void PlotPanelPaint(object sender, PaintEventArgs e)
 {
     Graphics g = e.Graphics;
     g.SmoothingMode = SmoothingMode.AntiAlias;
     AddData();
     cs.PlotPanelStyle(g);
     dc.AddAreas(g, cs, dc.DataSeriesList.Count, ds.PointList.Count);
 }
コード例 #30
0
ファイル: Glyph.cs プロジェクト: nlhepler/mono
		public abstract void Paint (PaintEventArgs pe);