public GraphShapesView() { // This call is required by the Windows.Forms Form Designer. InitializeComponent(); imageList=new ImageList(); this.libraries=new GraphObjectsLibraryCollection(); imageList.Images.Add(this.GetDefaultThumbnail()); #region NAF specific //these lines can safely be deleted if you want to use this control outside NAF #if NAFEnabled this.dockState = Netron.NAF.Core.Plugin.NAFDockState.Right; this.panelText = "Shape viewer"; #endif #endregion }
/// <summary> /// Class constructor /// </summary> /// <remarks> /// Notice the double buffering directives at the end /// </remarks> public GraphControl() { //Make sure the control repaints as it is resized SetStyle(ControlStyles.ResizeRedraw, true); //allow dragdrop this.AllowDrop=true; //instantiate the layout factory layoutFactory=new LayoutFactory(this); //instanciating an attached extract to the canvas extract = new GraphAbstract(); extract.Site=this; //init the transmission timer transmissionTimer.Interval = AutomataPulse; transmissionTimer.Tick += new EventHandler(OnTransmissionTimer); //attach of the handler //enable double buffering of graphics SetStyle(ControlStyles.DoubleBuffer, true); SetStyle(ControlStyles.UserPaint, true); SetStyle(ControlStyles.AllPaintingInWmPaint, true); //instantiate the library collection mLibraries = new GraphObjectsLibraryCollection(); this.KeyDown+=new KeyEventHandler(OnKeyDown); this.KeyPress+=new KeyPressEventHandler(OnKeyPress); AddBaseMenu(); bag = new PropertyBag(); AddProperties(); this.AutoScroll=true; this.HScroll=true; this.VScroll=true; try { Assembly ass= Assembly.GetExecutingAssembly(); MouseCursors.Add = new Cursor( ass.GetManifestResourceStream("Netron.GraphLib.Resources.Add.cur")); MouseCursors.Cross = new Cursor( ass.GetManifestResourceStream("Netron.GraphLib.Resources.Cross.cur")); MouseCursors.Grip = new Cursor( ass.GetManifestResourceStream("Netron.GraphLib.Resources.Grip.cur")); MouseCursors.Move = new Cursor( ass.GetManifestResourceStream("Netron.GraphLib.Resources.Move.cur")); MouseCursors.Select = new Cursor( ass.GetManifestResourceStream("Netron.GraphLib.Resources.Select.cur")); } catch(Exception exc) { Trace.WriteLine(exc.Message); } }