Changeset 9491


Ignore:
Timestamp:
05/13/13 15:24:31 (8 years ago)
Author:
bburlacu
Message:

#1265: Added mouse wheel support to the picture box.

Location:
branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.Designer.cs

    r9415 r9491  
    6767      // pictureBox
    6868      //
    69       this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) 
    70             | System.Windows.Forms.AnchorStyles.Left) 
     69      this.pictureBox.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
     70            | System.Windows.Forms.AnchorStyles.Left)
    7171            | System.Windows.Forms.AnchorStyles.Right)));
    7272      this.pictureBox.BackColor = System.Drawing.Color.White;
    73       this.pictureBox.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle;
    7473      this.pictureBox.ContextMenuStrip = this.pictureBoxContextMenuStrip;
    7574      this.pictureBox.Location = new System.Drawing.Point(0, 0);
     
    8180      this.pictureBox.VisibleChanged += new System.EventHandler(this.pictureBox_VisibleChanged);
    8281      this.pictureBox.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseDown);
     82      this.pictureBox.MouseEnter += new System.EventHandler(this.pictureBox_MouseEnter);
    8383      this.pictureBox.MouseMove += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseMove);
    8484      this.pictureBox.MouseUp += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseUp);
     85      this.pictureBox.MouseWheel += new System.Windows.Forms.MouseEventHandler(this.pictureBox_MouseWheel);
     86
    8587      //
    8688      // pictureBoxContextMenuStrip
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.cs

    r9415 r9491  
    166166    }
    167167
    168     private void ChartControl_KeyDown(object sender, KeyEventArgs e) {
     168    protected virtual void pictureBox_MouseWheel(object sender, MouseEventArgs e) {
     169      if (e.Delta > 0) {
     170        // zoom in
     171        double x1 = Chart.LowerLeft.X + Chart.Size.Width / 8;
     172        double y1 = Chart.LowerLeft.Y + Chart.Size.Height / 8;
     173        double x2 = Chart.UpperRight.X - Chart.Size.Width / 8;
     174        double y2 = Chart.UpperRight.Y - Chart.Size.Height / 8;
     175        Chart.ZoomIn(x1, y1, x2, y2);
     176      } else if (e.Delta < 0) {
     177        // zoom out
     178        double x1 = Chart.LowerLeft.X - Chart.Size.Width / 8;
     179        double y1 = Chart.LowerLeft.Y - Chart.Size.Height / 8;
     180        double x2 = Chart.UpperRight.X + Chart.Size.Width / 8;
     181        double y2 = Chart.UpperRight.Y + Chart.Size.Height / 8;
     182        Chart.ZoomIn(x1, y1, x2, y2);
     183      }
     184    }
     185
     186    private void pictureBox_MouseEnter(object sender, EventArgs e) {
     187      pictureBox.Focus();
     188    }
     189
     190    protected virtual void ChartControl_KeyDown(object sender, KeyEventArgs e) {
    169191      if (Chart.Mode == ChartMode.Select) {
    170192        if (e.KeyCode == Keys.Delete) {
  • branches/HeuristicLab.Visualization/HeuristicLab.Visualization/3.3/ChartControl.resx

    r4773 r9491  
    113113  </resheader>
    114114  <resheader name="reader">
    115     <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     115    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    116116  </resheader>
    117117  <resheader name="writer">
    118     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
     118    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
    119119  </resheader>
    120   <metadata name="pictureBoxContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     120  <metadata name="pictureBoxContextMenuStrip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    121121    <value>102, 17</value>
    122122  </metadata>
    123   <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     123  <metadata name="toolTip.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
    124124    <value>17, 17</value>
    125125  </metadata>
     126  <metadata name="saveFileDialog.TrayLocation" type="System.Drawing.Point, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
     127    <value>311, 17</value>
     128  </metadata>
    126129</root>
Note: See TracChangeset for help on using the changeset viewer.