コード例 #1
0
ファイル: ClientForm.cs プロジェクト: LuchunPen/TeamPainter
        private void OnMouseMove(object sender, MouseEventArgs e)
        {
            Point canvasPos = GetCanvasPoint(sender as Control, e.X, e.Y);

            lblPos.Invoke((MethodInvoker) delegate {
                lblPos.Text = canvasPos.ToString();
            });

            if (_paintTool != null)
            {
                DrawObject drObj = _paintTool.Draw(canvasPos.X, canvasPos.Y);
                SendDrawObject(drObj);
            }
        }
コード例 #2
0
ファイル: CuttingTool.cs プロジェクト: swstwix/Paint2
        public void Draw(IPixelSet pixelSet, IDrawingArea drawingArea)
        {
            var cut = new CuttingArguments
            {
                MinX = Math.Min(x0, x1),
                MinY = Math.Min(y0, y1),
                MaxX = Math.Max(x0, x1),
                MaxY = Math.Max(y0, y1),
            };

            IPaintTool line1 = Line2Tool.Build();

            line1.OnMouseClick(cut.MinX, cut.MinY);
            line1.OnMouseClicked(cut.MinX, cut.MaxY);
            line1.Draw(pixelSet, drawingArea);
            IPaintTool line2 = Line2Tool.Build();

            line2.OnMouseClick(cut.MinX, cut.MaxY);
            line2.OnMouseClicked(cut.MaxX, cut.MaxY);
            line2.Draw(pixelSet, drawingArea);
            IPaintTool line3 = Line2Tool.Build();

            line3.OnMouseClick(cut.MaxX, cut.MaxY);
            line3.OnMouseClicked(cut.MaxX, cut.MinY);
            line3.Draw(pixelSet, drawingArea);
            IPaintTool line4 = Line2Tool.Build();

            line4.OnMouseClick(cut.MaxX, cut.MinY);
            line4.OnMouseClicked(cut.MinX, cut.MinY);
            line4.Draw(pixelSet, drawingArea);

            foreach (IPaintTool paintTool in drawingArea)
            {
                paintTool.Cutting(cut);
            }
        }
コード例 #3
0
 public virtual void Draw(IPixelSet pixelSet, IDrawingArea drawingArea)
 {
     PaintTool.Draw(pixelSet, drawingArea);
 }