StopInk() public method

public StopInk ( ) : void
return void
示例#1
0
        private void tiSlide_Tick(object sender, EventArgs e)
        {
            // ignore the first tick
            if (LastTickTime.Year == 1987)
            {
                LastTickTime = DateTime.Now;
                return;
            }

            int primwidth  = Screen.PrimaryScreen.WorkingArea.Width;
            int primheight = Screen.PrimaryScreen.WorkingArea.Height;
            int primright  = Screen.PrimaryScreen.WorkingArea.Right;
            int primbottom = Screen.PrimaryScreen.WorkingArea.Bottom;

            int aimedleft = gpButtonsLeft;

            if (ButtonsEntering == 0)
            {
                if (Root.Docked)
                {
                    aimedleft = gpButtonsLeft + gpButtons.Width - btDock.Right;
                }
                else
                {
                    aimedleft = gpButtonsLeft;
                }
            }
            else if (ButtonsEntering == -1)
            {
                aimedleft = gpButtonsLeft + gpButtons.Width;
            }

            if (gpButtons.Left > aimedleft)
            {
                float dleft = gpButtons.Left - aimedleft;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 230;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                gpButtons.Left -= (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left < aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }
            else if (gpButtons.Left < aimedleft)
            {
                float dleft = aimedleft - gpButtons.Left;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                // fast exiting when not docked
                if (ButtonsEntering == -1 && !Root.Docked)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 120;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                // fast exiting when docked
                if (ButtonsEntering == -1 && dleft == 1)
                {
                    dleft = 2;
                }
                gpButtons.Left += (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left > aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }

            if (ButtonsEntering == -1 && gpButtons.Left == aimedleft)
            {
                tiSlide.Enabled = false;
                Root.StopInk();
                return;
            }

            short retVal = GetKeyState(27);

            if ((retVal & 0x8000) == 0x8000)
            {
                RetreatAndExit();
            }
        }
示例#2
0
        private void tiSlide_Tick(object sender, EventArgs e)
        {
            // ignore the first tick
            if (LastTickTime.Year == 1987)
            {
                LastTickTime = DateTime.Now;
                return;
            }

            int aimedleft = gpButtonsLeft;

            if (ButtonsEntering == 0)
            {
                if (Root.Snapping > 0)
                {
                    aimedleft = gpButtonsLeft + gpButtonsWidth + 5;
                }
                else if (Root.Docked)
                {
                    aimedleft = gpButtonsLeft + gpButtonsWidth - btDock.Right;
                }
                else
                {
                    aimedleft = gpButtonsLeft;
                }
            }
            else if (ButtonsEntering == -1)
            {
                aimedleft = gpButtonsLeft + gpButtonsWidth;
            }

            if (gpButtons.Left > aimedleft)
            {
                float dleft = gpButtons.Left - aimedleft;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 230;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                gpButtons.Left -= (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left < aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                gpButtons.Width         = Math.Max(gpButtonsWidth - (gpButtons.Left - gpButtonsLeft), btDock.Width);
                Root.UponButtonsUpdate |= 0x1;
            }
            else if (gpButtons.Left < aimedleft)
            {
                float dleft = aimedleft - gpButtons.Left;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                // fast exiting when not docked
                if (ButtonsEntering == -1 && !Root.Docked)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 120;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                // fast exiting when docked
                if (ButtonsEntering == -1 && dleft == 1)
                {
                    dleft = 2;
                }
                gpButtons.Left += (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left > aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                gpButtons.Width         = Math.Max(gpButtonsWidth - (gpButtons.Left - gpButtonsLeft), btDock.Width);
                Root.UponButtonsUpdate |= 0x1;
            }

            if (ButtonsEntering == -1 && gpButtons.Left == aimedleft)
            {
                tiSlide.Enabled = false;
                Root.StopInk();
                return;
            }

            if (!Root.PointerMode && !this.TopMost)
            {
                ToTopMost();
            }

            // gpPenWidth status

            if (Root.gpPenWidthVisible != gpPenWidth.Visible)
            {
                gpPenWidth.Visible = Root.gpPenWidthVisible;
            }

            // hotkeys

            const int VK_LCONTROL = 0xA2;
            const int VK_RCONTROL = 0xA3;
            short     retVal;

            if (!Root.PointerMode)
            {
                // ESC key : Exit
                retVal = GetKeyState(27);
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastESCStatus & 0x8000) == 0x0000)
                    {
                        if (Root.Snapping > 0)
                        {
                            ExitSnapping();
                        }
                        else if (Root.gpPenWidthVisible)
                        {
                            Root.gpPenWidthVisible  = false;
                            Root.UponSubPanelUpdate = true;
                        }
                        else if (Root.Snapping == 0)
                        {
                            RetreatAndExit();
                        }
                    }
                }
                LastESCStatus = retVal;
            }


            if (!Root.FingerInAction && !Root.PointerMode && Root.Snapping <= 0)
            {
                // 0 ~ 9 : Pen0 ~ Pen9
                for (int p = 0; p < 10 && p < Root.MaxPenCount; p++)
                {
                    retVal = GetKeyState('0' + p);
                    if ((retVal & 0x8000) == 0x8000)
                    {
                        SelectPen(p);
                    }
                }

                // E : Eraser
                retVal = GetKeyState('E');
                if ((retVal & 0x8000) == 0x8000)
                {
                    SelectPen(-1);
                }

                // Ctrl + Z : Undo
                retVal = GetKeyState('Z');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastZStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.UndoInk();
                        }
                    }
                }
                LastZStatus = retVal;

                // Ctrl + Y : Redo
                retVal = GetKeyState('Y');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastYStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.RedoInk();
                        }
                    }
                }
                LastYStatus = retVal;

                // Ctrl + P : Pointer
                retVal = GetKeyState('P');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(-2);
                    }
                }

                // Ctrl + S : Snap
                retVal = GetKeyState('S');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        btSnap_Click(null, null);
                    }
                }

                // Ctrl + D : Clear
                retVal = GetKeyState('D');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastDStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            btClear_Click(null, null);
                        }
                    }
                }
                LastDStatus = retVal;
            }

            if (Root.Snapping < 0)
            {
                Root.Snapping++;
            }
        }
示例#3
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));
                }
            }
示例#4
0
        private void tiSlide_Tick(object sender, EventArgs e)
        {
            // ignore the first tick
            if (LastTickTime.Year == 1987)
            {
                LastTickTime = DateTime.Now;
                return;
            }

            int primwidth  = Screen.PrimaryScreen.WorkingArea.Width;
            int primheight = Screen.PrimaryScreen.WorkingArea.Height;
            int primright  = Screen.PrimaryScreen.WorkingArea.Right;
            int primbottom = Screen.PrimaryScreen.WorkingArea.Bottom;

            int aimedleft = gpButtonsLeft;

            if (ButtonsEntering == 0)
            {
                if (Root.Snapping > 0)
                {
                    aimedleft = gpButtonsLeft + gpButtons.Width + 5;
                }
                else if (Root.Docked)
                {
                    aimedleft = gpButtonsLeft + gpButtons.Width - btDock.Right;
                }
                else
                {
                    aimedleft = gpButtonsLeft;
                }
            }
            else if (ButtonsEntering == -1)
            {
                aimedleft = gpButtonsLeft + gpButtons.Width;
            }

            if (gpButtons.Left > aimedleft)
            {
                float dleft = gpButtons.Left - aimedleft;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 230;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                gpButtons.Left -= (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left < aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }
            else if (gpButtons.Left < aimedleft)
            {
                float dleft = aimedleft - gpButtons.Left;
                dleft /= 70;
                if (dleft > 8)
                {
                    dleft = 8;
                }
                // fast exiting when not docked
                if (ButtonsEntering == -1 && !Root.Docked)
                {
                    dleft = 8;
                }
                dleft *= (float)(DateTime.Now - LastTickTime).TotalMilliseconds;
                if (dleft > 120)
                {
                    dleft = 120;
                }
                if (dleft < 1)
                {
                    dleft = 1;
                }
                // fast exiting when docked
                if (ButtonsEntering == -1 && dleft == 1)
                {
                    dleft = 2;
                }
                gpButtons.Left += (int)dleft;
                LastTickTime    = DateTime.Now;
                if (gpButtons.Left > aimedleft)
                {
                    gpButtons.Left = aimedleft;
                }
                Root.UponButtonsUpdate |= 0x1;
            }

            if (ButtonsEntering == -1 && gpButtons.Left == aimedleft)
            {
                tiSlide.Enabled = false;
                Root.StopInk();
                return;
            }

            if (!Root.PointerMode && !this.TopMost)
            {
                ToTopMost();
            }

            // hotkeys

            const int VK_LCONTROL = 0xA2;
            const int VK_RCONTROL = 0xA3;
            short     retVal;

            if (!Root.PointerMode)
            {
                // ESC key : Exit
                retVal = GetKeyState(27);
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastESCStatus & 0x8000) == 0x0000)
                    {
                        if (Root.Snapping > 0)
                        {
                            ExitSnapping();
                        }
                        else if (Root.Snapping == 0)
                        {
                            RetreatAndExit();
                        }
                    }
                }
                LastESCStatus = retVal;
            }

            if (!Root.FingerInAction)
            {
                // Ctrl + 1 : Pen 1
                retVal = GetKeyState('1');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(1);
                    }
                }

                // Ctrl + 2 : Pen 2
                retVal = GetKeyState('2');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(2);
                    }
                }

                // Ctrl + 3 : Pen 3
                retVal = GetKeyState('3');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(3);
                    }
                }

                // Ctrl + 4 : Pen 4
                retVal = GetKeyState('4');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(4);
                    }
                }

                // Ctrl + 5 : Pen 5
                retVal = GetKeyState('5');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(5);
                    }
                }

                // Ctrl + 0 : Eraser
                retVal = GetKeyState('0');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(0);
                    }
                }
            }

            if (!Root.FingerInAction && !Root.PointerMode && Root.Snapping <= 0)
            {
                // Ctrl + Z : Undo
                retVal = GetKeyState('Z');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastZStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.UndoInk();
                        }
                    }
                }
                LastZStatus = retVal;

                // Ctrl + Y : Redo
                retVal = GetKeyState('Y');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastYStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            Root.RedoInk();
                        }
                    }
                }
                LastYStatus = retVal;

                // Ctrl + P : Pointer
                retVal = GetKeyState('P');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        SelectPen(-1);
                    }
                }

                // Ctrl + S : Snap
                retVal = GetKeyState('S');
                if ((retVal & 0x8000) == 0x8000)
                {
                    short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                    if ((control & 0x8000) == 0x8000)
                    {
                        btSnap_Click(null, null);
                    }
                }

                // Ctrl + D : Clear
                retVal = GetKeyState('D');
                if ((retVal & 0x8000) == 0x8000)
                {
                    if ((LastDStatus & 0x8000) == 0x0000)
                    {
                        short control = (short)(GetKeyState(VK_LCONTROL) | GetKeyState(VK_RCONTROL));
                        if ((control & 0x8000) == 0x8000)
                        {
                            btClear_Click(null, null);
                        }
                    }
                }
                LastDStatus = retVal;
            }

            if (Root.Snapping < 0)
            {
                Root.Snapping++;
            }
        }