StartInk() public method

public StartInk ( ) : void
return void
Esempio n. 1
0
        public bool PreFilterMessage(ref Message m)
        {
            if (m.Msg == 0x0312)
            {
                //Keys key = (Keys)(((int)m.LParam >> 16) & 0xFFFF);                  // The key of the hotkey that was pressed.
                //int modifier = (int)m.LParam & 0xFFFF;       // The modifier of the hotkey that was pressed.
                //int id = m.WParam.ToInt32();                                        // The id of the hotkey that was pressed.

                if (Root.FormCollection == null && Root.FormDisplay == null)
                {
                    Root.StartInk();
                }
                else if (Root.PointerMode)
                {
                    //Root.UnPointer();
                    Root.SelectPen(Root.LastPen);
                }
                else
                {
                    //Root.Pointer();
                    Root.SelectPen(-2);
                }
            }
            return(false);
        }
Esempio n. 2
0
        public void timer1_Tick(object sender, EventArgs e)
        {
            if (Root.FormCollection is null)
            {
                return; // the initialisation is not yet completed. we wait for
            }
            Tick++;

            /*
             *          if (Tick == 1)
             *                  TickStartTime = DateTime.Now;
             *          else if (Tick % 60 == 0)
             *          {
             *                  Console.WriteLine(60 / (DateTime.Now - TickStartTime).TotalMilliseconds * 1000);
             *                  TickStartTime = DateTime.Now;
             *          }
             */

            if (Root.UponAllDrawingUpdate)
            {
                ClearCanvus();
                DrawStrokes();
                DrawButtons(true);
                if (Root.Snapping > 0)
                {
                    DrawSnapping(Root.SnappingRect);
                }
                UpdateFormDisplay(true);
                Root.UponAllDrawingUpdate = false;
            }

            else if (Root.UponTakingSnap)
            {
                if (Root.ResizeDrawingWindow)
                {
                    if ((Root.SnappingRect.Width == SystemInformation.VirtualScreen.Width) && (Root.SnappingRect.Height == SystemInformation.VirtualScreen.Height))
                    {
                        Root.WindowRect = new Rectangle(int.MinValue, int.MinValue, -1, -1);
                    }
                    else
                    {
                        Root.WindowRect = new Rectangle(Root.SnappingRect.Left, Root.SnappingRect.Top, Root.SnappingRect.Width, Root.SnappingRect.Height);
                    }
                    Root.StopInk();
                    Root.StartInk();
                    return;
                }
                if (Root.SnappingRect.Width == this.Width && Root.SnappingRect.Height == this.Height)
                {
                    System.Threading.Thread.Sleep(200);
                }
                ClearCanvus();
                DrawStrokes();
                //DrawButtons(false);
                UpdateFormDisplay(true);
                if (Root.VideoRecordWindowInProgress)
                {
                    Root.FormCollection.VideoRecordStartFFmpeg(Root.SnappingRect);
                    Root.UponTakingSnap = false;
                    Root.VideoRecordWindowInProgress = false;
                    return;
                }
                SnapShot(Root.SnappingRect);
                Root.UponBalloonSnap = true;
                Root.UponTakingSnap  = false;
                if (!Root.FormCollection.SnapWithoutClosing && (Root.CloseOnSnap == "true" || (Root.CloseOnSnap == "blankonly" && Root.FormCollection.IC.Ink.Strokes.Count == 0)))
                {
                    Root.FormCollection.RetreatAndExit();
                }

                /*
                 * if (Root.CloseOnSnap == "true")
                 *              {
                 *                      Root.FormCollection.RetreatAndExit();
                 *              }
                 *              else if (Root.CloseOnSnap == "blankonly")
                 *              {
                 *                      if ((Root.FormCollection.IC.Ink.Strokes.Count == 0))
                 *                              Root.FormCollection.RetreatAndExit();
                 *              }*/
            }

            else if (Root.Snapping == 2)
            {
                if (Root.MouseMovedUnderSnapshotDragging)
                {
                    ClearCanvus();
                    DrawStrokes();
                    DrawButtons(false);
                    DrawSnapping(Root.SnappingRect);
                    UpdateFormDisplay(true);
                    Root.MouseMovedUnderSnapshotDragging = false;
                }
            }

            else if (!(Root.FormCollection is null) && !(Root.FormCollection.IC is null) && Root.FormCollection.IC.CollectingInk && Root.EraserMode == false && Root.InkVisible)
            { // Drawing in progress : we get the last stroke in the list, if we have to draw because not deleted and not a shape in progress
              //we replace the rectangle containing the stroke by the saved one and

                if (Root.FormCollection.IC.Ink.Strokes.Count > 0)
                {
                    Stroke stroke = Root.FormCollection.IC.Ink.Strokes[Root.FormCollection.IC.Ink.Strokes.Count - 1];
                    if ((!stroke.Deleted) && (!Root.FormCollection.ZoomCapturing) && (Root.ToolSelected == Tools.Hand))
                    {
                        BitBlt(OutcanvusDc, 0, 0, this.Width, this.Height, canvusDc, 0, 0, 0x00CC0020);
                        Root.FormCollection.IC.Renderer.Draw(gOutCanvus, stroke, Root.FormCollection.IC.DefaultDrawingAttributes);
                    }
                    UpdateFormDisplay(true, Root.ToolSelected == Tools.Hand && (!Root.FormCollection.ZoomCapturing));
                }
            }