Free cookie consent management tool by TermsFeed Policy Generator

source: trunk/sources/HeuristicLab.ExtLibs/HeuristicLab.Netron/3.0.2672.12446/HeuristicLab.Netron-3.0.2672.12446/NetronVisualization.cs @ 2781

Last change on this file since 2781 was 2781, checked in by mkommend, 14 years ago

added netron specific extensions (ticket #867)

File size: 2.0 KB
Line 
1using System;
2using System.Collections.Generic;
3using System.ComponentModel;
4using System.Drawing;
5using System.Data;
6using System.Linq;
7using System.Text;
8using System.Windows.Forms;
9
10using Netron.Diagramming.Core;
11
12namespace HeuristicLab.Netron {
13  [ToolboxItem(true)]
14  public partial class NetronVisualization : DiagramControlBase {
15    public NetronVisualization()
16      : base() {
17      InitializeComponent();
18
19      SetStyle(ControlStyles.AllPaintingInWmPaint, true);
20      SetStyle(ControlStyles.DoubleBuffer, true);
21      SetStyle(ControlStyles.UserPaint, true);
22      SetStyle(ControlStyles.ResizeRedraw, true);
23
24      if (!DesignMode) {
25        this.Controller = new Controller(this);
26        this.View = new View(this);
27
28        this.Document = new Document();
29        this.AttachToDocument(Document);
30        this.Controller.View = View;
31        TextEditor.Init(this);
32
33        View.OnCursorChange += new EventHandler<CursorEventArgs>(mView_OnCursorChange);
34        View.OnBackColorChange += new EventHandler<ColorEventArgs>(View_OnBackColorChange);
35
36        this.SizeChanged += new EventHandler(AlgorithmVisualization_SizeChanged);
37        this.AllowDrop = true;
38      }
39    }
40
41    void AlgorithmVisualization_SizeChanged(object sender, EventArgs e) {
42      Size newSize = new Size((int) (this.Size.Width * this.View.Magnification.Width),
43        (int) (this.Size.Height * this.View.Magnification.Height));
44      this.View.PageSize = newSize;
45    }
46
47    protected override void OnScroll(ScrollEventArgs se) {
48      //base.OnScroll(se);
49      if (se.ScrollOrientation == ScrollOrientation.HorizontalScroll) {
50        Origin = new Point(se.NewValue, Origin.Y);
51        //System.Diagnostics.Trace.WriteLine(se.NewValue);
52      } else {
53        Origin = new Point(Origin.X, se.NewValue);
54        //System.Diagnostics.Trace.WriteLine(se.NewValue);
55      }
56    }
57
58    private void mView_OnCursorChange(object sender, CursorEventArgs e) {
59      this.Cursor = e.Cursor;
60    }
61  }
62}
Note: See TracBrowser for help on using the repository browser.