public void FillSelect(long Tick1, long Tick2, Color AreaColor)
        {
            if (Tick1 == Tick2)
            {
                return;
            }
            long MinSTick = Math.Min(Tick1, Tick2);
            long MaxSTick = Math.Max(Tick1, Tick2);

            long MinTick = pprops.PianoStartTick;
            long MaxTick = pprops.PianoStartTick + (long)Math.Round(pprops.dertPixel2dertTick(baseEvent.ClipRectangle.Width), 0) + 1;

            int PX1 = Tick2PixelX(MinSTick, MinTick, MaxTick);
            int PX2 = Tick2PixelX(MaxSTick, MinTick, MaxTick);

            List <Point> PArr = new List <Point>();

            PArr.Add(new Point(PX1, 0));
            PArr.Add(new Point(PX2, 0));
            PArr.Add(new Point(PX2, baseEvent.ClipRectangle.Height));
            PArr.Add(new Point(PX1, baseEvent.ClipRectangle.Height));

            D2DGraphics g = baseEvent.D2DGraphics;

            g.FillPathGeometrySink(PArr, AreaColor);
        }
Пример #2
0
        protected override void OnRender(D2DGraphics g)
        {
            // draw the subtitle memory bitmap on screen
            var rect = new D2DRect(50, y, ClientRectangle.Width - 100, 1500);

            g.DrawBitmap(bg, rect);
        }
Пример #3
0
 public static void DrawText(this D2DGraphics g, string text, D2DColor color, float x, float y)
 {
     using (var font = new Font("Arial", 8.25f))
     {
         g.DrawText(text, color, font, x, y);
     }
 }
Пример #4
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            using (var font = new Font("Arial", 12))
            {
                foreach (var node in nodes)
                {
                    using (var brush = this.Device.CreateSolidColorBrush(node.color))
                    {
                        var rect = node.rect;

                        //rect.Size = g.MeasureText(node.text, this.Font.Name, node.fontSize, node.rect.Size);
                        //rect.Width += 10;
                        //rect.Height += 10;

                        //g.FillRectangle(rect, brush);


                        //using (var f = new Font(this.Font.FontFamily, fontSize))
                        //{
                        var textRect = rect;
                        textRect.X += 5;
                        textRect.Y += 5;
                        g.DrawText(node.text, node.color, textRect.X, textRect.Y);
                        //}
                    }
                }
            }
        }
Пример #5
0
 public override void EnsureDecorationInitialization(D2DGraphics g, DateTime now)
 {
     Decorations ??= new IStateDecoration <InitialState>[] {
         HelpTextDecoration.ForContext(g, now),
         MouseWindowOutlineDecoration.ForContext(g, now),
     };
 }
Пример #6
0
        private void DrawParameterButtonsArea(object sender, BalthasarLib.D2DPainter.D2DPaintEventArgs e, PianoRollPoint startPoint)
        {
            D2DGraphics g         = e.D2DGraphics;
            Rectangle   BlackRect = new Rectangle(
                0,
                0,
                rconf.Const_RollWidth,
                e.ClipRectangle.Height
                );

            g.FillRectangle(BlackRect, Color.Black);
            //绘制分割线
            g.DrawLine(new Point(rconf.Const_RollWidth, 0), new Point(rconf.Const_RollWidth, e.ClipRectangle.Height), Color.White, 1);

            Rectangle CurrentRect = new Rectangle(
                0,
                0,
                rconf.Const_RollWidth,
                e.ClipRectangle.Height
                );//可绘制区域

            if (ParamBtnsPaint != null)
            {
                D2DPaintEventArgs d2de = new D2DPaintEventArgs(
                    e.D2DGraphics,
                    CurrentRect,
                    e.MousePoint
                    );
                ParamBtnsPaint(sender, new BalthasarLib.PianoRollWindow.DrawUtils.ParamBtnsDrawUtils(d2de, rconf));
            }
        }
        public void DrawDynLine(List <TickControlObject> SortedDynPointSilk, int DynBase, double MaxValue, Color LineColor, float LineWidth = 1, System.Drawing.Drawing2D.DashStyle LineStyle = System.Drawing.Drawing2D.DashStyle.Solid, ulong AntiBordTick = 480)
        {
            D2DGraphics g = baseEvent.D2DGraphics;

            long MinTick = pprops.PianoStartTick;
            long MaxTick = pprops.PianoStartTick + (long)Math.Round(pprops.dertPixel2dertTick(baseEvent.ClipRectangle.Width), 0) + 1;

            int BaseZero = baseEvent.ClipRectangle.Height;

            List <Point> PixelSilkLine = new List <Point>();

            for (int i = 0; i < SortedDynPointSilk.Count; i++)
            {
                if (SortedDynPointSilk[i].Tick >= MinTick - (long)AntiBordTick && SortedDynPointSilk[i].Tick <= MaxTick + (long)AntiBordTick)
                {
                    double DynValue = DynBase + SortedDynPointSilk[i].Value;
                    if (DynValue < 0)
                    {
                        DynValue = 0;
                    }
                    double bfb    = (double)DynValue / (double)MaxValue;
                    int    CalcY  = (int)(bfb * BaseZero);
                    int    PointY = BaseZero - CalcY;
                    int    PointX = Tick2PixelX(SortedDynPointSilk[i].Tick, MinTick, MaxTick);
                    PixelSilkLine.Add(new Point(PointX, PointY));
                }
            }

            if (PixelSilkLine.Count > 1)
            {
                g.DrawPathGeometrySink(PixelSilkLine, LineColor, LineWidth, LineStyle, false);
            }
        }
Пример #8
0
        void DrawAxisX(D2DGraphics g)
        {
            g.RenderTarget.AntialiasMode = AntialiasMode.PerPrimitive;

            int startIdx = dataRange.startIdx;
            int endIdx   = dataRange.endIdx;
            StrokeStyleProperties ssp = new StrokeStyleProperties();

            ssp.DashStyle = DashStyle.DashDot;
            StrokeStyle     strokeStyle = new StrokeStyle(D2DGraphics.d2dFactory, ssp);
            SolidColorBrush brush2      = new SolidColorBrush(g.RenderTarget, GDIDataD2DUtils.TransToRawColor4(XAxisColor));

            g.RenderTarget.DrawLine(new RawVector2(0, Height / 2), new RawVector2(Width, Height / 2), brush2, 0.5f, strokeStyle);

            //
            float widthStep = Width / xAxisSeqCount;

            float numSeq   = GetAxisXSeq();
            float startNum = startIdx * numSeq;
            float numWidth = (endIdx - startIdx) * numSeq;
            float numStep  = numWidth / xAxisSeqCount;

            RawRectangleF rect;

            for (int i = 0; i < xAxisSeqCount; i++)
            {
                float x = (widthStep * i - 100 + widthStep * i + 100) / 2f;
                g.RenderTarget.DrawLine(new RawVector2(x, Height / 2), new RawVector2(x, Height / 2 + 3), brush2, 1f);

                //
                rect = new RawRectangleF(widthStep * i - 100, Height / 2, widthStep * i + 100, Height / 2 + 15);
                string str = (startNum + i * numStep).ToString("#.##");
                g.RenderTarget.DrawText(str, textFormat, rect, brush2, DrawTextOptions.Clip);
            }
        }
Пример #9
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            for (int y = 0; y < gridCountY; y++)
            {
                for (int x = 0; x < gridCountX; x++)
                {
                    var s = sprites[x, y];

                    // if angle is almost zero, draw the partial image simply
                    // this will get better performance
                    if (Math.Abs(s.angle) < 0.01)
                    {
                        g.DrawBitmap(s.bmp, new D2DRect(s.x, s.y, s.width, s.height));
                    }
                    else
                    {
                        // else when angle is specified, push a rotate matrix
                        g.PushTransform();
                        g.RotateTransform(s.angle, new D2DPoint(s.x + s.width * 0.5f, s.y + s.height * 0.5f));
                        g.DrawBitmap(s.bmp, new D2DRect(s.x, s.y, s.width, s.height));
                        g.PopTransform();
                    }
                }
            }
        }
Пример #10
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            // set the transform before draw rect
            g.SetTransform(mat.ToMatrix3x2());
            g.DrawRectangle(rect, isHitted ? D2DColor.Red : D2DColor.Blue, 2);
        }
Пример #11
0
 public override void Draw(D2DGraphics g, DateTime now, TimeSpan elapsed, Rectangle bounds, D2DBitmap image)
 {
     Debug.Assert(Decorations != null);
     foreach (var d in Decorations)
     {
         d.UpdateAndDraw(g, now, elapsed, bounds, image, this);
     }
 }
 public void DrawString(System.Drawing.Point LeftTopAxis, System.Drawing.Color FontColor, string Text, int FontSize = 9, FontStyle FontStyles = FontStyle.Regular)
 {
     try
     {
         D2DGraphics g = baseEvent.D2DGraphics;
         g.DrawText(Text, new System.Drawing.Rectangle(baseEvent.ClipRectangle.Left + LeftTopAxis.X, LeftTopAxis.Y, baseEvent.ClipRectangle.Width - LeftTopAxis.X, baseEvent.ClipRectangle.Height - LeftTopAxis.Y), FontColor, new System.Drawing.Font("Tahoma", FontSize, FontStyles));
     }
     catch {; }
 }
Пример #13
0
        protected override void CreateHandle()
        {
            base.CreateHandle();

            DoubleBuffered = false;

            _graphics = new D2DGraphics(Device);
            _graphics.SetDPI(96, 96);
        }
Пример #14
0
        public override void OnRender(D2DGraphics g)
        {
            var rect = new D2DRect(AbsolutePosition.X, AbsolutePosition.Y, Size.Width, Size.Height);

            g.DrawBitmap(bg, rect);
            //g.FillRectangle(AbsolutePosition.X, AbsolutePosition.Y, Size.Width, Size.Height, D2DColor.FromGDIColor(backColor));

            //g.FillRectangle(AbsolutePosition.X + 5, AbsolutePosition.Y + 55, Size.Width - 10, Size.Height - 60, D2DColor.FromGDIColor(backColor2));

            //g.DrawText(this.Name, D2DColor.FromGDIColor(Color.FromArgb(230, 247, 243, 243)), new Font("Segoe UI", 15.75F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point), AbsolutePosition.X + 10, AbsolutePosition.Y + 10);
        }
Пример #15
0
        private void DrawParameterLinesArea(object sender, BalthasarLib.D2DPainter.D2DPaintEventArgs e, PianoRollPoint startPoint)
        {
            D2DGraphics g         = e.D2DGraphics;
            Rectangle   BlackRect = new Rectangle(
                rconf.Const_RollWidth,
                0,
                e.ClipRectangle.Width - rconf.Const_RollWidth,
                e.ClipRectangle.Height
                );

            // g.FillRectangle(BlackRect, Color.Black);

            if (ParamAreaPaint != null)
            {
                D2DPaintEventArgs d2de = new D2DPaintEventArgs(
                    e.D2DGraphics,
                    BlackRect,
                    e.MousePoint
                    );
                ParamAreaPaint(sender, new BalthasarLib.PianoRollWindow.DrawUtils.ParamAreaDrawUtils(d2de, rconf, pprops));
            }

            //绘制分节符

            //初始化
            double x               = rconf.Const_RollWidth;                        //起点画线
            long   BeatNumber      = startPoint.BeatNumber;                        //获取起点拍号
            double BeatPixelLength = pprops.dertTick2dertPixel(pprops.BeatLength); //一拍长度

            if (startPoint.DenominatolTicksBefore != 0)                            //非完整Beats
            {
                //起点不在小节线
                BeatNumber = startPoint.NextWholeBeatNumber;
                x          = x + pprops.dertTick2dertPixel(startPoint.NextWholeBeatDistance);
            }
            while (x <= e.ClipRectangle.Width)
            {
                if (BeatNumber % pprops.BeatsCountPerSummery == 0)
                {
                    g.DrawLine(
                        new Point((int)Math.Round(x, 0), 0),
                        new Point((int)Math.Round(x, 0), BlackRect.Height),
                        rconf.TitleColor_Marker);
                    long SummeryId = BeatNumber / pprops.BeatsCountPerSummery;
                }
                BeatNumber = BeatNumber + 1;
                x          = x + BeatPixelLength;
            }
            g.DrawLine(
                new Point(BlackRect.Left, BlackRect.Height / 2),
                new Point(BlackRect.Width + BlackRect.Left, BlackRect.Height / 2),
                rconf.TitleColor_Marker);
        }
Пример #16
0
        public static void DrawBitmap(this D2DGraphics g, Bitmap bitmap, D2DRect destRect, float opacity = 1,
                                      bool alpha = false, D2DBitmapInterpolationMode interpolationMode = D2DBitmapInterpolationMode.Linear)
        {
            IntPtr hbitmap = bitmap.GetHbitmap();

            if (hbitmap != IntPtr.Zero)
            {
                var srcRect = new D2DRect(0, 0, bitmap.Width, bitmap.Height);

                g.DrawGDIBitmap(hbitmap, destRect, srcRect, opacity, alpha, interpolationMode);
                Win32.DeleteObject(hbitmap);
            }
        }
Пример #17
0
        public void DrawPianoMouseAxis(Color LineColor, float LineWidth, System.Drawing.Drawing2D.DashStyle LineStyle)
        {
            D2DGraphics g = baseEvent.D2DGraphics;
            //横线
            Point L1_p1 = new Point(baseEvent.ClipRectangle.Left, baseEvent.MousePoint.Y);
            Point L1_p2 = new Point(baseEvent.ClipRectangle.Left + baseEvent.ClipRectangle.Width, baseEvent.MousePoint.Y);
            //竖线
            Point L2_p1 = new Point(baseEvent.MousePoint.X, baseEvent.ClipRectangle.Top);
            Point L2_p2 = new Point(baseEvent.MousePoint.X, baseEvent.ClipRectangle.Top + baseEvent.ClipRectangle.Height);

            g.DrawLine(L1_p1, L1_p2, LineColor, LineWidth, LineStyle);
            g.DrawLine(L2_p1, L2_p2, LineColor, LineWidth, LineStyle);
        }
Пример #18
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            // set the transform before draw rect
            g.SetTransform(mat.ToMatrix3x2());

            g.FillRectangle(rect, isHitted ? D2DColor.LightYellow : D2DColor.LightGray);
            g.DrawRectangle(rect, isHitted ? D2DColor.Red : D2DColor.Blue, 2);

            g.DrawText("Click to rotate", D2DColor.Black, this.Font.Name, 14, rect,
                       DWRITE_TEXT_ALIGNMENT.DWRITE_TEXT_ALIGNMENT_CENTER, DWRITE_PARAGRAPH_ALIGNMENT.DWRITE_PARAGRAPH_ALIGNMENT_CENTER);
        }
Пример #19
0
        protected override void CreateHandle()
        {
            base.CreateHandle();

            this.DoubleBuffered = false;

            if (this.device == null)
            {
                this.device = D2DDevice.FromHwnd(this.Handle);
            }

            this.graphics = new D2DGraphics(this.device);
        }
Пример #20
0
 private void drawCursor(D2DGraphics g, Point p)
 {
     if (this.penColor == D2DColor.White)
     {
         // when current color is white, draw an eraser
         g.DrawRectangle(p.X - this.penSize.Width, p.Y - this.penSize.Height, this.penSize.Width * 2, this.penSize.Height * 2, D2DColor.Black, 2);
     }
     else
     {
         // else draw pen
         g.DrawEllipse(p, this.penSize, this.penColor, 2.0f);
     }
 }
Пример #21
0
        static public Dot9BitmapD2D CreateDot9BoxShadowBitmap(D2DGraphics g, float cornersRadius, float shadowRadius, System.Drawing.Color shadowColor)
        {
            int width  = (int)(cornersRadius * 2 + shadowRadius * 4 + 2);
            int height = (int)(cornersRadius * 2 + shadowRadius * 4 + 2);

            SharpDX.Direct2D1.PixelFormat format = new SharpDX.Direct2D1.PixelFormat(SharpDX.DXGI.Format.B8G8R8A8_UNorm, AlphaMode.Premultiplied);
            BitmapProperties prop = new BitmapProperties(format);

            SharpDX.Direct2D1.Bitmap bitmap = new SharpDX.Direct2D1.Bitmap(g.RenderTarget, new Size2(width, height), prop);

            unsafe
            {
                System.Drawing.Bitmap     gdibmp = new System.Drawing.Bitmap(width, height);
                System.Drawing.RectangleF rect   = new System.Drawing.RectangleF(shadowRadius, shadowRadius, width - shadowRadius * 2, height - shadowRadius * 2);
                Graphics             gdiGraph    = Graphics.FromImage(gdibmp);
                GraphicsPath         myPath      = DrawUtils.CreateRoundedRectanglePath(rect, cornersRadius);
                System.Drawing.Brush brush       = new SolidBrush(shadowColor);
                gdiGraph.FillPath(brush, myPath);
                brush.Dispose();

                GaussianBlur gs = new GaussianBlur((int)shadowRadius);
                gdibmp = gs.ProcessImage(gdibmp);

                System.Drawing.Rectangle bitmapRect = new System.Drawing.Rectangle(0, 0, gdibmp.Width, gdibmp.Height);
                BitmapData srcBmData = gdibmp.LockBits(bitmapRect, ImageLockMode.ReadWrite, System.Drawing.Imaging.PixelFormat.Format32bppPArgb);
                byte *     ptr       = (byte *)srcBmData.Scan0;
                bitmap.CopyFromMemory((IntPtr)ptr, srcBmData.Stride);
                gdibmp.UnlockBits(srcBmData);

                //  gdibmp.Save("f:\\shadow.png");
                gdibmp.Dispose();
            }



            int[] widthPts = new int[]
            {
                (int)(cornersRadius + shadowRadius * 2 + 1), (int)(width - cornersRadius - shadowRadius * 2 - 1)
            };

            int[] heightPts = new int[]
            {
                (int)(cornersRadius + shadowRadius * 2 + 1), (int)(width - cornersRadius - shadowRadius * 2 - 1)
            };


            Dot9BitmapD2D dot9Bitmap = new Dot9BitmapD2D(bitmap, widthPts, heightPts);

            return(dot9Bitmap);
        }
Пример #22
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderBy(s => s.Item2))
            {
                nanoD2d.bg?.BeginRender();
                nanoD2d.bg?.Clear(D2DColor.Transparent);
                nanoD2d.bg?.EndRender();
            }

            count++;
            label7.Text = count.ToString();

            foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderBy(s => s.Item2))
            {
                if (index != 0)
                {
                    nanoD2d.OnPaint(new Point(0, 0));
                }
                else
                {
                    nanoD2d.OnPaint(new Point(0, 0));
                }
            }

            foreach (var(nanoD2d, index) in GetAllTextBoxControls(controls).OrderByDescending(s => s.Item2))
            {
                if (index != 0)
                {
                    var rect = new D2DRect(nanoD2d.Location.X, nanoD2d.Location.Y, nanoD2d.Size.Width, nanoD2d.Size.Height);

                    nanoD2d.Parent?.bg?.BeginRender();
                    nanoD2d.Parent?.bg?.DrawBitmap(nanoD2d.bg, rect);
                    nanoD2d.Parent?.bg?.EndRender();
                }
            }

            foreach (var nanoD2d in controls.Reverse())
            {
                nanoD2d.OnRender(g);
            }


            if (selectControl != null)
            {
                var tmpRect1 = new D2DRect(selectControl.AbsolutePosition.X, selectControl.AbsolutePosition.Y, selectControl.Size.Width, selectControl.Size.Height);
                g.FillRectangle(tmpRect1, D2DColor.FromGDIColor(Color.FromArgb(80, 0, 0, 255)));
            }
        }
Пример #23
0
        protected override void OnRender(D2DGraphics g)
        {
            var text = "Hello World";

            var rect = new Rectangle(100, 100, 500, 500);

            var measuredSize = g.MeasureText(text, font1.Name, font1.Size, rect.Size);

            var measuredRect = new D2DRect(rect.X, rect.Y, measuredSize.width, measuredSize.height);

            g.DrawText(text, D2DColor.Black, font1.Name, font1.Size, rect);

            g.DrawRectangle(measuredRect, D2DColor.Blue);
        }
Пример #24
0
        protected override void OnRender(D2DGraphics g)
        {
            using (var path = this.Device.CreateEllipseGeometry(
                       new D2DPoint((float)(340 + waveWidth * offsetX), 200), new D2DSize(130, 130)))
            {
                using (var layer = g.PushLayer(path))
                {
                    g.FillRectangle(ClientRectangle, new D2DColor(.7f, .7f, .7f));

                    g.DrawText("Text drawed via Direct2D API (d2dlib)", D2DColor.Blue, "Arial", 24, 140, 180);

                    g.PopLayer();
                }
            }
        }
Пример #25
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            // set the transform before draw rect
            g.SetTransform(mat.toD2DMatrix3x2());

            g.FillRectangle(rect, isHitted ? D2DColor.LightYellow : D2DColor.LightGray);
            g.DrawRectangle(rect, isHitted ? D2DColor.Red : D2DColor.Blue, 2);

            g.DrawText("Drag to move / Click to rotate / Scroll to scale", D2DColor.Black, this.Font.Name, 14, rect,
                       DWriteTextAlignment.Center, DWriteParagraphAlignment.Center);

            g.ResetTransform();
        }
        public void FillDynLine(List <TickControlObject> SortedDynPointSilk, int DynBase, double MaxValue, Color AreaColor, ulong AntiBordTick = 480)
        {
            D2DGraphics g = baseEvent.D2DGraphics;

            long MinTick = pprops.PianoStartTick;
            long MaxTick = pprops.PianoStartTick + (long)Math.Round(pprops.dertPixel2dertTick(baseEvent.ClipRectangle.Width), 0) + 1;

            if (MaxValue < 100)
            {
                MaxValue = 100;
            }

            int BaseZero = baseEvent.ClipRectangle.Height;

            List <Point> PixelSilkLine = new List <Point>();

            bool  isFirst = true;
            Point PE      = new Point(rconf.Const_RollWidth + baseEvent.ClipRectangle.Width, baseEvent.ClipRectangle.Height);

            for (int i = 0; i < SortedDynPointSilk.Count; i++)
            {
                if (SortedDynPointSilk[i].Tick >= MinTick - (long)AntiBordTick && SortedDynPointSilk[i].Tick <= MaxTick + (long)AntiBordTick)
                {
                    double DynValue = DynBase + SortedDynPointSilk[i].Value;
                    if (DynValue < 0)
                    {
                        DynValue = 0;
                    }
                    double bfb    = (double)DynValue / (double)MaxValue;
                    int    CalcY  = (int)(bfb * BaseZero);
                    int    PointY = BaseZero - CalcY;
                    int    PointX = Tick2PixelX(SortedDynPointSilk[i].Tick, MinTick, MaxTick);
                    if (isFirst)
                    {
                        PixelSilkLine.Add(new Point(PointX, baseEvent.ClipRectangle.Height));
                        isFirst = false;
                    }
                    PixelSilkLine.Add(new Point(PointX, PointY));
                    PE = new Point(PointX, baseEvent.ClipRectangle.Height);
                }
            }
            PixelSilkLine.Add(PE);

            if (PixelSilkLine.Count > 1)
            {
                g.FillPathGeometrySink(PixelSilkLine, AreaColor);
            }
        }
        public void DrawXLine(long Tick, Color LineColor, float LineWidth = 2, System.Drawing.Drawing2D.DashStyle LineStyle = System.Drawing.Drawing2D.DashStyle.Solid)
        {
            D2DGraphics g       = baseEvent.D2DGraphics;
            long        MinTick = pprops.PianoStartTick;
            long        MaxTick = pprops.PianoStartTick + (long)Math.Round(pprops.dertPixel2dertTick(baseEvent.ClipRectangle.Width), 0) + 1;

            if (Tick <= MaxTick && Tick >= MinTick)
            {
                long ETick = Tick - MinTick;//获得左边界距离启绘点距离;
                if (ETick >= 0)
                {
                    long NodeXPixel = baseEvent.ClipRectangle.X + (int)Math.Round(pprops.dertTick2dertPixel(ETick), 0);
                    g.DrawLine(new Point((int)NodeXPixel, baseEvent.ClipRectangle.Top), new Point((int)NodeXPixel, baseEvent.ClipRectangle.Bottom), LineColor, LineWidth, LineStyle);
                }
            }
        }
Пример #28
0
        protected override void OnRender(D2DGraphics g)
        {
            // draw the memory bitmap
            g.DrawBitmap(memg, this.ClientSize.Width, this.ClientSize.Height);

            // draw tips
            g.DrawText("Tips:\n   Press 1 to 5 to switch color, E to erase\n   Scroll to change pen size", D2DColor.Black, this.Font, 10, 10);

            if (showGettingStart)
            {
                g.DrawTextCenter("Draw something...", D2DColor.Goldenrod, SystemFonts.DefaultFont.Name, 36, ClientRectangle);
            }

            // draw cursor
            this.drawCursor(g, this.cursorPoint);
        }
        public void DrawYLine(double Percent, Color LineColor, float LineWidth = 1, System.Drawing.Drawing2D.DashStyle LineStyle = System.Drawing.Drawing2D.DashStyle.Solid)
        {
            if (Percent > 1)
            {
                Percent = 1;
            }
            if (Percent < 0)
            {
                Percent = 0;
            }
            D2DGraphics g      = baseEvent.D2DGraphics;
            double      rp     = 1 - Percent;
            int         PixelY = (int)(baseEvent.ClipRectangle.Height * rp);

            g.DrawLine(new Point(rconf.Const_RollWidth, PixelY), new Point(rconf.Const_RollWidth + baseEvent.ClipRectangle.Width, PixelY), LineColor, LineWidth, LineStyle);
        }
Пример #30
0
        protected override void OnRender(D2DGraphics g)
        {
            base.OnRender(g);

            // draw background
            g.FillRectangle(100, 100, 400, 400, D2DColor.LightYellow);

            // draw pie geometries
            foreach (var pie in pies)
            {
                g.FillPath(pie.path, pie.color);
                g.DrawPath(pie.path, D2DColor.LightYellow, 2);
            }

            g.DrawText("Click to change color", D2DColor.Black, 250, 550);
        }