MegaMan.LevelEditor.ScreenDrawingSurface.SetSelection C# (CSharp) Метод

SetSelection() публичный Метод

public SetSelection ( int tx, int ty, int width, int height ) : void
tx int
ty int
width int
height int
Результат void
        public void SetSelection(int tx, int ty, int width, int height)
        {
            if (width != 0 && height != 0)
            {
                if (tx < 0)
                {
                    width += tx;
                    tx = 0;
                }
                if (ty < 0)
                {
                    height += ty;
                    ty = 0;
                }

                if (width + tx > Screen.Width) width = Screen.Width - tx;
                if (height + ty > Screen.Height) height = Screen.Height - ty;

                // all in tile sizes
                Selection = new Rectangle(tx, ty, width, height);

                DrawSelectionAnts();
            }
            else
            {
                Selection = null;

                using (Graphics g = Graphics.FromImage(toolLayer))
                {
                    g.Clear(Color.Transparent);
                }
            }

            if (SelectionChanged != null)
            {
                SelectionChanged(this, Selection);
            }
        }

Usage Example

Пример #1
0
 public void Release(ScreenDrawingSurface surface)
 {
     surface.SetSelection(
         Math.Min(tx1, tx2),
         Math.Min(ty1, ty2),
         Math.Abs(tx2 - tx1),
         Math.Abs(ty2 - ty1)
     );
 }
All Usage Examples Of MegaMan.LevelEditor.ScreenDrawingSurface::SetSelection