예제 #1
0
파일: MainWindow.cs 프로젝트: Sobiech/zut
        private void AssingDrawingEvents()
        {
            DrawablePanel.MouseDown += new MouseEventHandler((ob, e) => {
                p1Location = e.Location;

                if (DrawableMode.isNormalMode())
                {
                    drawOnSurface = true;
                }
            });

            DrawablePanel.MouseUp += new MouseEventHandler((ob, e) => {
                drawOnSurface = false;

                if (!DrawableMode.isNormalMode())
                {
                    p2Location = e.Location;
                    DrawFigure();
                }
            });

            DrawablePanel.MouseMove += new MouseEventHandler((ob, e) => {
                if (drawOnSurface)
                {
                    if (DrawableMode.isNormalMode())
                    {
                        p2Location = e.Location;
                    }

                    DrawFigure();

                    p1Location = e.Location;
                }
            });

            DrawablePanel.Paint += new PaintEventHandler((ob, e) => {
                e.Graphics.DrawImageUnscaled(DrawableBitmap, new Point(0, 0));
            });
        }
예제 #2
0
파일: MainWindow.cs 프로젝트: Sobiech/zut
 private void DrawFigure()
 {
     DrawableMode.draw(DrawableBitmap, pen, p1Location, p2Location);
     DrawablePanel.CreateGraphics().DrawImageUnscaled(DrawableBitmap, new Point(0, 0));
 }