Free cookie consent management tool by TermsFeed Policy Generator

Changeset 724


Ignore:
Timestamp:
11/09/08 14:54:41 (16 years ago)
Author:
bspisic
Message:

#319

Class MouseEventListener added
In CanvasUI surrounded the Draw method with try/catch to prevent exceptions in UI-Designer

Location:
trunk/sources
Files:
1 added
5 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Visualization.Test/MainForm.Designer.cs

    r636 r724  
    3131      //
    3232      this.canvasUI.Location = new System.Drawing.Point(12, 29);
     33      this.canvasUI.MouseEventListener = null;
    3334      this.canvasUI.Name = "canvasUI";
    3435      this.canvasUI.Size = new System.Drawing.Size(800, 600);
     
    4546      this.label2.Text = "Canvas";
    4647      //
    47       // Form1
     48      // MainForm
    4849      //
    4950      this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
     
    5253      this.Controls.Add(this.label2);
    5354      this.Controls.Add(this.canvasUI);
    54       this.Name = "Form1";
     55      this.Name = "MainForm";
    5556      this.Text = "Form1";
    5657      this.ResumeLayout(false);
  • trunk/sources/HeuristicLab.Visualization/CanvasUI.Designer.cs

    r635 r724  
    2929        private void InitializeComponent()
    3030        {
    31             components = new System.ComponentModel.Container();
     31          this.SuspendLayout();
     32          //
     33          // CanvasUI
     34          //
     35          this.MouseMove += new System.Windows.Forms.MouseEventHandler(this.CanvasUI_MouseMove);
     36          this.MouseUp += new System.Windows.Forms.MouseEventHandler(this.CanvasUI_MouseUp);
     37          this.ResumeLayout(false);
     38
    3239        }
    3340
  • trunk/sources/HeuristicLab.Visualization/CanvasUI.cs

    r635 r724  
    1 using System.Drawing;
     1using System;
     2using System.Diagnostics;
     3using System.Drawing;
    24using System.Windows.Forms;
    35
     
    57  public partial class CanvasUI : Control {
    68    private readonly Canvas mainCanvas = new Canvas();
     9    private MouseEventListener mouseEventListener;
    710
    811    public CanvasUI() {
     
    1417    }
    1518
     19    public MouseEventListener MouseEventListener {
     20      get { return mouseEventListener; }
     21      set { mouseEventListener = value; }
     22    }
     23
    1624    protected override void OnPaint(PaintEventArgs pe) {
    17       Graphics g = pe.Graphics;
     25      try {
     26        Graphics g = pe.Graphics;
    1827
    19       g.FillRectangle(Brushes.White, ClientRectangle);
     28        g.FillRectangle(Brushes.White, ClientRectangle);
    2029
    21       mainCanvas.Draw(g, ClientRectangle);
     30        mainCanvas.Draw(g, ClientRectangle);
    2231
    23       g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
     32        g.DrawRectangle(Pens.Black, 0, 0, Width - 1, Height - 1);
    2433
    25       base.OnPaint(pe);
     34        base.OnPaint(pe);
     35      } catch (Exception e) {
     36       Debug.WriteLine(e);
     37      }
     38    }
     39
     40    private void CanvasUI_MouseMove(object sender, MouseEventArgs e) {
     41      if (mouseEventListener != null) {}
     42    }
     43
     44    private void CanvasUI_MouseUp(object sender, MouseEventArgs e) {
     45      if (mouseEventListener != null) {}
    2646    }
    2747  }
  • trunk/sources/HeuristicLab.Visualization/HeuristicLab.Visualization.csproj

    r710 r724  
    6969    <Compile Include="IChartDataModel.cs" />
    7070    <Compile Include="IChartDataRowsModel.cs" />
    71     <Compile Include="IMouseEventListener.cs" />
    7271    <Compile Include="IShape.cs" />
    7372    <Compile Include="LineChart.cs">
     
    7776      <DependentUpon>LineChart.cs</DependentUpon>
    7877    </Compile>
    79     <Compile Include="MouseEventDragDropListener.cs" />
    80     <Compile Include="MouseEventPanListener.cs" />
    81     <Compile Include="MouseEventSelectListener.cs" />
    82     <Compile Include="MouseEventZoomListener.cs" />
     78    <Compile Include="MouseEventListener.cs" />
    8379    <Compile Include="Offset.cs" />
    8480    <Compile Include="PointD.cs" />
Note: See TracChangeset for help on using the changeset viewer.