public void Clear(Color color) { GDIBrush b = new GDIBrush(color); Clear(b); b.Dispose(); }
public void FillRect(Color color, int x, int y, int width, int height) { GDIBrush b = new GDIBrush(color); FillRect(b, x, y, width, height); b.Dispose(); }
public void FillRect(GDIBrush brush, int x, int y, int width, int height) { RECTAPI gr; gr.Top = y; gr.Left = x; gr.Right = width + x; gr.Bottom = height + y; NativeUser32Api.FillRect(mhDC, ref gr, brush.hBrush); }
private void RenderRow(Graphics g, int RowIndex, int RowPos) { // if (RowIndex ==-1) // System.Diagnostics.Debugger.Break (); if (RowIndex >= 0 && RowIndex < this.Control.Document.Count) { //do keyword parse before we render the line... if (this.Control.Document[RowIndex].RowState == RowState.SegmentParsed) { this.Control.Document.Parser.ParseLine(RowIndex, true); this.Control.Document[RowIndex].RowState = RowState.AllParsed; } } GDISurface bbuff = GFX.BackBuffer; bool found = false; GDIBrush bg = GFX.BackgroundBrush; if (RowIndex < this.Control.Document.Count && RowIndex >= 0) { Row r = Control.Document[RowIndex]; if (SpanFound && RowIndex >= FirstSpanRow && RowIndex <= LastSpanRow && Control._CodeEditor.ScopeBackColor != Color.Transparent) { bg = new GDIBrush(Control._CodeEditor.ScopeBackColor); found = true; } else if (r.BackColor != Color.Transparent) { bg = new GDIBrush(r.BackColor); found = true; } else { if (r.EndSegment != null) { Segment tmp = null; tmp = r.Expansion_EndSegment; while (tmp != null) { if (tmp.BlockType.Transparent == false) { bg = new GDIBrush(tmp.BlockType.BackColor); found = true; break; } tmp = tmp.Parent; } if (!found) { tmp = r.EndSegment; while (tmp != null) { if (tmp.BlockType.Transparent == false) { bg = new GDIBrush(tmp.BlockType.BackColor); found = true; break; } tmp = tmp.Parent; } } if (!found) { tmp = r.Expansion_EndSegment; while (tmp != null) { if (tmp.BlockType.Transparent == false) { bg = new GDIBrush(tmp.BlockType.BackColor); found = true; break; } tmp = tmp.Parent; } } } } } if (RowIndex == Control.Caret.Position.Y && Control.HighLightActiveLine) bbuff.Clear(GFX.HighLightLineBrush); else if (RowIndex >= 0 && RowIndex < Control.Document.Count) { if (Control.Document[RowIndex].IsCollapsed) { if (Control.Document[RowIndex].Expansion_EndRow.Index == Control.Caret.Position.Y && Control.HighLightActiveLine) bbuff.Clear(GFX.HighLightLineBrush); else bbuff.Clear(bg); } else bbuff.Clear(bg); } else bbuff.Clear(bg); //only render normal text if any part of the row is visible if (RowIndex <= Control.Selection.LogicalBounds.FirstRow || RowIndex >= Control.Selection.LogicalBounds.LastRow) { RenderText(RowIndex); } //only render selection text if the line is selected if (Control.Selection.IsValid) { if (RowIndex >= Control.Selection.LogicalBounds.FirstRow && RowIndex <= Control.Selection.LogicalBounds.LastRow) { if (this.Control.ContainsFocus) GFX.SelectionBuffer.Clear(Control.SelectionBackColor); else GFX.SelectionBuffer.Clear(Control.InactiveSelectionBackColor); RenderSelectedText(RowIndex); } } if (this.Control.ContainsFocus || Control.View.Action == XTextAction.xtDragText) { RenderCaret(RowIndex, RowPos * Control.View.RowHeight + this.yOffset); } RenderSelection(RowIndex, true); RenderMargin(RowIndex); if (Control.Document.Folding) RenderExpansion(RowIndex); RowPaintEventArgs e = new RowPaintEventArgs(); Rectangle rec = new Rectangle(0, 0, this.Control.Width, Control.View.RowHeight); e.Graphics = Graphics.FromHdc(bbuff.hDC); e.Bounds = rec; e.Row = null; if (RowIndex >= 0 && RowIndex < Control.Document.Count) e.Row = Control.Document[RowIndex]; this.Control._CodeEditor.OnRenderRow(e); e.Graphics.Dispose(); bbuff.Flush(); bbuff.RenderToControl(0, RowPos * Control.View.RowHeight + this.yOffset) ; //GFX.SelectionBuffer.RenderToControl (0,RowPos*Control.View.RowHeight+this.yOffset); if (found) bg.Dispose(); }
public void Clear(GDIBrush brush) { FillRect(brush, 0, 0, mWidth, mHeight); }
public GDIBrush OutlineBrush; //background brush #region IDisposable Members public void Dispose() { if (BackBuffer != null) { BackBuffer.Dispose(); BackBuffer = null; } if (SelectionBuffer != null) { SelectionBuffer.Dispose(); SelectionBuffer = null; } if (StringBuffer != null) { StringBuffer.Dispose(); StringBuffer = null; } if (FontNormal != null) { FontNormal.Dispose(); FontNormal = null; } if (FontBold != null) { FontBold.Dispose(); FontBold = null; } if (FontItalic != null) { FontItalic.Dispose(); FontItalic = null; } if (FontBoldItalic != null) { FontBoldItalic.Dispose(); FontBoldItalic = null; } if (FontUnderline != null) { FontUnderline.Dispose(); FontUnderline = null; } if (FontBoldUnderline != null) { FontBoldUnderline.Dispose(); FontBoldUnderline = null; } if (FontItalicUnderline != null) { FontItalicUnderline.Dispose(); FontItalicUnderline = null; } if (FontBoldItalicUnderline != null) { FontBoldItalicUnderline.Dispose(); FontBoldItalicUnderline = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (GutterMarginBrush != null) { GutterMarginBrush.Dispose(); GutterMarginBrush = null; } if (LineNumberMarginBrush != null) { LineNumberMarginBrush.Dispose(); LineNumberMarginBrush = null; } if (LineNumberMarginBorderBrush != null) { LineNumberMarginBorderBrush.Dispose(); LineNumberMarginBorderBrush = null; } if (BackgroundBrush != null) { BackgroundBrush.Dispose(); BackgroundBrush = null; } if (HighLightLineBrush != null) { HighLightLineBrush.Dispose(); HighLightLineBrush = null; } if (OutlineBrush != null) { OutlineBrush.Dispose(); OutlineBrush = null; } }