Inheritance: GDIObject
Example #1
0
        public void DrawRect(Color color, int left, int top, int width, int height)
        {
            var p = new GDIPen(color, 1);

            DrawRect(p, left, top, width, height);
            p.Dispose();
        }
Example #2
0
 public void DrawRect(GDIPen pen, int left, int top, int width, int height)
 {
     DrawLine(pen, new Point(left, top), new Point(left + width, top));
     DrawLine(pen, new Point(left, top + height), new Point(left + width, top + height));
     DrawLine(pen, new Point(left, top), new Point(left, top + height));
     DrawLine(pen, new Point(left + width, top), new Point(left + width, top + height + 1));
 }
Example #3
0
        public void DrawLine(Color color, Point p1, Point p2)
        {
            var p = new GDIPen(color, 1);

            DrawLine(p, p1, p2);
            p.Dispose();
        }
Example #4
0
        public void DrawLine(GDIPen pen, Point p1, Point p2)
        {
            IntPtr   oldpen = NativeMethods.SelectObject(mhDC, pen.hPen);
            APIPoint gp;

            gp.x = 0;
            gp.y = 0;
            NativeMethods.MoveToEx(mhDC, p1.X, p1.Y, ref gp);
            NativeMethods.LineTo(mhDC, p2.X, p2.Y);
            NativeMethods.SelectObject(mhDC, oldpen);
        }
Example #5
0
 public void DrawRect(GDIPen pen, int left, int top, int width, int height)
 {
     DrawLine(pen, new Point(left, top), new Point(left + width, top));
     DrawLine(pen, new Point(left, top + height), new Point(left + width, top + height));
     DrawLine(pen, new Point(left, top), new Point(left, top + height));
     DrawLine(pen, new Point(left + width, top), new Point(left + width, top + height + 1));
 }
Example #6
0
 public void DrawRect(Color color, int left, int top, int width, int height)
 {
     var p = new GDIPen(color, 1);
     DrawRect(p, left, top, width, height);
     p.Dispose();
 }
Example #7
0
 public void DrawLine(Color color, Point p1, Point p2)
 {
     var p = new GDIPen(color, 1);
     DrawLine(p, p1, p2);
     p.Dispose();
 }
Example #8
0
 public void DrawLine(GDIPen pen, Point p1, Point p2)
 {
     IntPtr oldpen = NativeMethods.SelectObject(mhDC, pen.hPen);
     APIPoint gp;
     gp.x = 0;
     gp.y = 0;
     NativeMethods.MoveToEx(mhDC, p1.X, p1.Y, ref gp);
     NativeMethods.LineTo(mhDC, p2.X, p2.Y);
     NativeMethods.SelectObject(mhDC, oldpen);
 }
Example #9
0
        private void RenderMargin(int RowIndex)
        {
            GDISurface bbuff = GFX.BackBuffer;

            if (Control.ShowGutterMargin)
            {
                bbuff.FillRect(GFX.GutterMarginBrush, 0, 0, Control.View.GutterMarginWidth, Control.View.RowHeight);
                bbuff.FillRect(GFX.GutterMarginBorderBrush, Control.View.GutterMarginWidth - 1, 0, 1, Control.View.RowHeight);
                if (RowIndex <= Control.Document.Count - 1)
                {
                    Row r = Control.Document[RowIndex];

                    if (Control.View.RowHeight >= Control._SyntaxBox.GutterIcons.ImageSize.Height)
                    {
                        //Shaun: don't draw bookmarks
                        //if (r.Bookmarked)
                        //    Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, 1);
                        if (r.Breakpoint)
                            Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, 0);
                    }
                    else
                    {
                        int w = Control.View.RowHeight;
                        //if (r.Bookmarked)
                        //    Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, 1);
                        if (r.Breakpoint)
                            Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, 0);
                    }

                    if (r.Images != null)
                    {
                        foreach (int i in r.Images)
                        {
                            if (Control.View.RowHeight >= Control._SyntaxBox.GutterIcons.ImageSize.Height)
                            {
                                Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, i);
                            }
                            else
                            {
                                int w = Control.View.RowHeight;
                                Control._SyntaxBox.GutterIcons.Draw(Graphics.FromHdc(bbuff.hDC), 0, 0, w, w, i);
                            }
                        }
                    }
                }
            }

            // Shaun: highlight the number line under special circumstances
            bool highlight = RowIndex == Control.Caret.Position.Y && Control.HighLightActiveLine;

            if (Control.ShowLineNumbers)
            {
                // Shaun: color the line number space the same as the highlighted line
                bbuff.FillRect(highlight ? GFX.HighLightLineBrush : GFX.LineNumberMarginBrush, Control.View.GutterMarginWidth, 0, Control.View.LineNumberMarginWidth + 1, Control.View.RowHeight);

                //bbuff.FillRect (GFX.LineNumberMarginBrush  ,Control.View.GutterMarginWidth+Control.View.LineNumberMarginWidth,0,1,Control.View.RowHeight);

                //Shaun: draw solid line
                using (var pen = new GDIPen(Control.LineNumberBorderColor,1))
                {
                    int x = Control.View.GutterMarginWidth + Control.View.LineNumberMarginWidth;
                    int y = Control.View.RowHeight;
                    bbuff.DrawLine(pen, new Point(x, 0), new Point(x, y));
                }

                // Shaun: don't draw the dotted line
                    /*
                for (int j = 0; j < Control.View.RowHeight; j += 2)
                {
                    bbuff.FillRect(GFX.LineNumberMarginBorderBrush, Control.View.GutterMarginWidth + Control.View.LineNumberMarginWidth, j, 1, 1);
                }
                     */
            }

            if (!Control.ShowLineNumbers || !Control.ShowGutterMargin)
                // Shaun: don't draw this (it's blocking the number line)
                ;//bbuff.FillRect(GFX.BackgroundBrush, Control.View.TotalMarginWidth, 0, Control.View.TextMargin - Control.View.TotalMarginWidth - 3, Control.View.RowHeight);
            else
                bbuff.FillRect(highlight ? GFX.HighLightLineBrush : GFX.BackgroundBrush, Control.View.TotalMarginWidth + 1, 0, Control.View.TextMargin - Control.View.TotalMarginWidth - 4, Control.View.RowHeight);

            if (Control.ShowLineNumbers)
            {
                bbuff.Font = GFX.FontNormal;
                bbuff.FontTransparent = true;

                bbuff.TextForeColor = Control.LineNumberForeColor;
                if (RowIndex <= Control.Document.Count - 1)
                {
                    // Shaun: draw >> for bookmarks
                    string s = (RowIndex + 1).ToString(CultureInfo.InvariantCulture);
                    //if (Control.Document[RowIndex].Bookmarked)
                        //s = ">>" + s;
                    int nw = MeasureString(s).Width;

                    bbuff.DrawTabbedString(s, Control.View.GutterMarginWidth + Control.View.LineNumberMarginWidth - nw - 1, 1, 0, Control.PixelTabSize);
                }
            }
        }