/// <summary> /// Whole redraw cycle - raises main Repaint event /// for the clients to redraw themselves. /// </summary> /// <remarks>Uses a back buffer, which is being copied to the screen.</remarks> /// <param name="ToRedraw">A rectangular area which should be updated (redrawn)</param> public void Redraw(Rect toRedraw) { // size of the backbuffer to use DrawOperations.Viewport.Size.Set(this.ClientSize); // first, clear the buffer with the background color Renderer.Clear(); // Commented out caret functionality from here. // Let the TextBox draw the caret instead. // Kirill // hide the caret and see if anyone needs it //Caret textCursor = RendererSingleton.MyCaret; //textCursor.Visible = false; // raise main Repaint event // clients (those who draw on this DrawWindow) // handle the event and draw everything there // (they use the Renderer that they become over a parameter) #if DEFINE_ShouldMeasureRedrawTime GuiLabs.Canvas.Utils.Timer t = new GuiLabs.Canvas.Utils.Timer(); t.Start(); #endif if (Repaint != null) { Repaint(Renderer); } #if DEFINE_ShouldMeasureRedrawTime t.Stop(); if (font == null) { font = DrawOperations.Factory.ProduceNewFontStyleInfo("Verdana", 14, FontStyle.Regular); font.ForeColor = System.Drawing.Color.Red; } DrawOperations.DrawString( t.TimeElapsed.ToString(), DrawOperations.Viewport, font); #endif // if someone needed the cursor, he/she turned it on // so we draw the cursor only if someone needs it // (e.g. an active TextBox control) //Renderer.DrawOperations.DrawCaret(textCursor); // finally, copy the buffer to the screen Renderer.RenderBuffer(this, toRedraw); }
/// <summary> /// Whole redraw cycle - raises main Repaint event /// for the clients to redraw themselves. /// </summary> /// <remarks>Uses a back buffer, which is being copied to the screen.</remarks> /// <param name="ToRedraw">A rectangular area which should be updated (redrawn)</param> public void Redraw(Rect toRedraw) { // size of the backbuffer to use DrawOperations.Viewport.Size.Set(this.ClientSize); // first, clear the buffer with the background color Renderer.Clear(); // Commented out caret functionality from here. // Let the TextBox draw the caret instead. // Kirill // hide the caret and see if anyone needs it //Caret textCursor = RendererSingleton.MyCaret; //textCursor.Visible = false; // raise main Repaint event // clients (those who draw on this DrawWindow) // handle the event and draw everything there // (they use the Renderer that they become over a parameter) #if DEFINE_ShouldMeasureRedrawTime GuiLabs.Canvas.Utils.Timer t = new GuiLabs.Canvas.Utils.Timer(); t.Start(); #endif if (Repaint != null) Repaint(Renderer); #if DEFINE_ShouldMeasureRedrawTime t.Stop(); if (font == null) { font = DrawOperations.Factory.ProduceNewFontStyleInfo("Verdana", 14, FontStyle.Regular); font.ForeColor = System.Drawing.Color.Red; } DrawOperations.DrawString( t.TimeElapsed.ToString(), DrawOperations.Viewport, font); #endif // if someone needed the cursor, he/she turned it on // so we draw the cursor only if someone needs it // (e.g. an active TextBox control) //Renderer.DrawOperations.DrawCaret(textCursor); // finally, copy the buffer to the screen Renderer.RenderBuffer(this, toRedraw); }