Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.Visualization/3.2/CanvasUI.cs @ 1673

Last change on this file since 1673 was 1530, checked in by gkronber, 16 years ago

Moved source files of plugins Hive ... Visualization.Test into version-specific sub-folders. #576

File size: 842 bytes
Line 
1using System;
2using System.Diagnostics;
3using System.Drawing;
4using System.Windows.Forms;
5
6namespace HeuristicLab.Visualization {
7  public partial class CanvasUI : Control {
8    private readonly Canvas canvas = new Canvas();
9
10    public CanvasUI() {
11      InitializeComponent();
12
13      DoubleBuffered = true;
14    }
15
16    public Canvas Canvas {
17      get { return canvas; }
18    }
19
20    protected override void OnPaint(PaintEventArgs pe) {
21      try {
22        Graphics g = pe.Graphics;
23
24        canvas.Viewport = ClientRectangle;
25        canvas.Draw(g);
26
27        base.OnPaint(pe);
28      } catch (Exception e) {
29       Trace.WriteLine(e);
30      }
31    }
32
33    protected override void OnResize(EventArgs e) {
34      Invalidate();
35
36      canvas.Viewport = ClientRectangle;
37
38      base.OnResize(e);
39    }
40  }
41}
Note: See TracBrowser for help on using the repository browser.