コード例 #1
0
ファイル: Desktop.cs プロジェクト: marwaha-raghav/JackalOS
        private void MouseClicked(Point CurMouse)
        {
            //Icon sizes & Positions

            /*Point ShutdownStart = new Point(750, 20);
             * int ShutdownSize = 30;
             * Point DrawStart = new Point(750, 60);
             * int DrawSize = 30;*/

            if ((CurMouse.X > ShutdownStart.X) && (CurMouse.X < ShutdownStart.X + ShutdownEnd.X))
            {
                if ((CurMouse.Y > ShutdownStart.Y) && (CurMouse.Y < ShutdownStart.Y + YSize))
                {
                    Sys.Power.Shutdown();
                }
            }
            if ((CurMouse.X > DrawStart.X) && (CurMouse.X < DrawStart.X + DrawEnd.X))
            {
                if ((CurMouse.Y > DrawStart.Y) && (CurMouse.Y < DrawStart.Y + YSize))
                {
                    DrawApp Draw = new DrawApp();
                    Draw.Draw(C);
                    Initialize();
                }
            }
            if ((CurMouse.X > TextBoxStart.X) && (CurMouse.X < TextBoxStart.X + TextBoxEnd.X))
            {
                if ((CurMouse.Y > TextBoxStart.Y) && (CurMouse.Y < TextBoxStart.Y + YSize))
                {
                    Notepad Note = new Notepad();
                    Note.Launch(C);
                    Initialize();
                }
            }
        }
コード例 #2
0
        private void MouseClicked(Point CurMouse)
        {
            //Icon sizes & Positions

            /*Point ShutdownStart = new Point(750, 20);
             * int ShutdownSize = 30;
             * Point DrawStart = new Point(750, 60);
             * int DrawSize = 30;*/

            if ((CurMouse.X > ShutdownStart.X) && (CurMouse.X < ShutdownStart.X + ShutdownSize))
            {
                if ((CurMouse.Y > ShutdownStart.Y) && (CurMouse.Y < ShutdownStart.Y + ShutdownSize))
                {
                    Sys.Power.Shutdown();
                }
            }
            if ((CurMouse.X > DrawStart.X) && (CurMouse.X < DrawStart.X + DrawSize))
            {
                if ((CurMouse.Y > DrawStart.Y) && (CurMouse.Y < DrawStart.Y + DrawSize))
                {
                    draw.Draw(C);
                    Initialize();
                }
            }
            if ((CurMouse.X > TextBoxStart.X) && (CurMouse.X < TextBoxStart.X + TextBoxSize))
            {
                if ((CurMouse.Y > TextBoxStart.Y) && (CurMouse.Y < TextBoxStart.Y + TextBoxSize))
                {
                    Console.WriteLine("Enter your text below. Press y to continue.");
                    Console.WriteLine("Press 1 to end the text");

                    TextPoint.X = 16;
                    TextPoint.Y = 16;

                    //To print the heading
                    Text.StringTextHandler(C, "enter your text below. press any key to continue. press ~ to end the text. press ` for backspace. ", TextPoint);
                    key         = Console.ReadKey();
                    CurrentChar = key.KeyChar;
                    //To start text from the last written character position
                    if (TextIconClickTest == true)
                    {
                        CurrentPoint.X    = 16;
                        CurrentPoint.Y    = 66;
                        TextIconClickTest = false;
                    }

                    //To print individual characters
                    while (CurrentChar != '~')
                    {
                        if (CurrentChar == '`')
                        {
                            C.DrawFilledRectangle(new Pen(Color.Gold), CurrentPoint.X - 8, CurrentPoint.Y, 15, 22);
                            CurrentPoint.X = CurrentPoint.X - 8;
                            if (CurrentPoint.X < 16) // To go in previous line while backspacing.
                            {
                                if (CurrentPoint.Y - 23 >= 66)
                                {
                                    CurrentPoint.X = 734;
                                    CurrentPoint.Y = CurrentPoint.Y - 23;
                                }
                                else
                                {
                                    CurrentPoint.X = 16;
                                    CurrentPoint.Y = 66;
                                }
                            }

                            goto here;
                        }

                        CurrentPoint = Text.CharTextHandler(C, CurrentChar, CurrentPoint);
here:
                        key         = Console.ReadKey();
                        CurrentChar = key.KeyChar;
                    }
                }
            }
        }