Ejemplo n.º 1
0
        void pixelEditor1_LeftClickDrag(PixelEditor arg1, MouseEventArgs arg2)
        {
            if (mode_copy.Checked)
            {
                int x, y;
                arg1.GetMapPos(arg2, out x, out y);

                int tilex = x ;
                int tiley = y ;

                int htilex, htiley;
                arg1.GetHighlightedTile(out htilex, out htiley);

                int minx = Math.Min(tilex, htilex);
                int miny = Math.Min(tiley, htiley);
                arg1.HighlightTile(minx, miny);

                int dx = Math.Max(Math.Abs(tilex - htilex + 1), 1);
                int dy = Math.Max(Math.Abs(tiley - htiley + 1), 1);

                arg1.highlightwidth = dx;
                arg1.highlightheight = dy;
                UpdateClipboardWithArea(minx, miny, dx, dy);
            }
            else
            {
                pixelEditor1_LeftClick(arg1, arg2);
            }
        }
Ejemplo n.º 2
0
        void pixelEditor1_LeftClick(PixelEditor arg1, MouseEventArgs arg2)
        {
            if (mode_copy.Checked)
            {
                int x, y;
                arg1.GetMapPos(arg2, out x, out y);
                arg1.HighlightTile(x, y);
                arg1.highlightheight = 1;
                arg1.highlightwidth = 1;
                UpdateClipboardWithArea(x, y, 1, 1);
            }
            else
            {
                arg1.ApplyMouseUnderlay();

                using (Graphics g = Graphics.FromImage(spritemap))
                {
                    g.CompositingMode = System.Drawing.Drawing2D.CompositingMode.SourceCopy;
                    g.DrawImage(sprite, new Rectangle(initialx, initialy, 48, 64), new Rectangle(0, 0, sprite.Width, sprite.Height), GraphicsUnit.Pixel);
                }
            }
            pixelEditor3.Refresh();
        }