public void ExitSnapping() { IC.SetWindowInputRectangle(new Rectangle(0, 0, this.Width, this.Height)); Root.SnappingX = -1; Root.SnappingY = -1; Root.Snapping = -60; Root.SelectPen(Root.CurrentPen); }
public void btSnap_Click(object sender, EventArgs e) { if (Root.Snapping > 0) { return; } cursorsnap = new System.Windows.Forms.Cursor(gInk.Properties.Resources.cursorsnap.Handle); this.Cursor = cursorsnap; Root.gpPenWidthVisible = false; IC.SetWindowInputRectangle(new Rectangle(0, 0, 1, 1)); Root.SnappingX = -1; Root.SnappingY = -1; Root.SnappingRect = new Rectangle(0, 0, 0, 0); Root.Snapping = 1; Root.UnPointer(); }
public MainForm() { // Required for Windows Form Designer support. InitializeComponent(); // Load our icon. this.Icon = new Icon(typeof(MainForm),"PhysicsIllustrator.ico"); // Initialize the per-item smart tag. bodytag = new PhysicsIllustrator.SmartTag.SmartTag(); bodytag.Image = Global.LoadImage("Resources.PenMenu.ico"); bodytag.Visible = false; bodytag.ContextMenu = new ContextMenu(); bodytag.ContextMenu.MenuItems.Add("Clone", new EventHandler(hover_EditCloneClicked)); bodytag.ContextMenu.MenuItems.Add("Delete", new EventHandler(hover_EditDeleteClicked)); bodytag.ContextMenu.MenuItems.Add("-"); bodytag.ContextMenu.MenuItems.Add("Straighten", new EventHandler(hover_EditStraightenClicked)); bodytag.ContextMenu.MenuItems.Add("Properties...", new EventHandler(hover_EditPropertiesClicked)); this.Controls.Add(bodytag); // Go fullscreen. Note: this works even with the taskbar set // to "keep on top of other windows". this.WindowState = System.Windows.Forms.FormWindowState.Normal; // this.Bounds = Screen.PrimaryScreen.Bounds; // Declare repaint optimizations. base.SetStyle( ControlStyles.UserPaint| ControlStyles.AllPaintingInWmPaint| ControlStyles.DoubleBuffer, true); // this.BackColor = Color.Black; pi.Enabled = true; pi.Visible = true; pi.Size = new Size(100, 100); pi.Top = 50; pi.BackColor = Color.Black; pi.Show(); // Init inkoverlay. inkoverlay = new InkOverlay(this.Handle,true); inkoverlay.CollectionMode = CollectionMode.InkOnly; // no gestures // ((Object) inkoverlay).MemberwiseClone(); // Mudando o tamanho do // Rectangle theRect = new Rectangle(500, 300, 1000, 1000); Rectangle theRect = new Rectangle(0, 0, 0, 0); inkoverlay.SetWindowInputRectangle(theRect); // inkoverlay.AttachMode = InkOverlayAttachMode.Behind; inkoverlay.AutoRedraw = false; // Dynamic rendering only; we do all the painting. DrawingAttributes da = new DrawingAttributes(); da.AntiAliased = false; da.PenTip = PenTip.Ball; inkoverlay.DefaultDrawingAttributes = da; inkoverlay.Stroke += new InkCollectorStrokeEventHandler(inkoverlay_Stroke); inkoverlay.CursorInRange += new InkCollectorCursorInRangeEventHandler(inkoverlay_CursorInRange); inkoverlay.StrokesDeleting += new InkOverlayStrokesDeletingEventHandler(inkoverlay_StrokesDeleting); inkoverlay.SelectionChanging += new InkOverlaySelectionChangingEventHandler(inkoverlay_SelectionChanging); inkoverlay.SelectionChanged += new InkOverlaySelectionChangedEventHandler(inkoverlay_SelectionChanged); inkoverlay.SelectionMoved += new InkOverlaySelectionMovedEventHandler(inkoverlay_SelectionMoved); inkoverlay.SelectionResized += new InkOverlaySelectionResizedEventHandler(inkoverlay_SelectionResized); // inkoverlay. declaredmode = inkoverlay.EditingMode; // Spin up SDI model (ink+doc). doc = new MagicDocument(); inkoverlay.Ink = doc.Ink; inkoverlay.Enabled = !DesignMode; inkoverlay.Ink.InkAdded += new StrokesEventHandler(inkoverlay_Ink_InkAdded); }