
MyRectangle 需包含以下屬性:
int X:主矩形左上角 X 座標int Y:主矩形左上角 Y 座標int DownPointX:繪製時滑鼠按下點 X 座標int DownPointY:繪製時滑鼠按下點 Y 座標int Width:主矩形寬度int Height:主矩形高度int MinWidth:主矩形最小寬度int MinHeight:主矩形最小高度bool ChangeSizeMode:是否為調整大小模式bool MoveMode:是否為移動模式bool MouseOnLeftTop、MouseOnLeftMiddle、MouseOnLeftBottom、MouseOnRightTop、MouseOnRightMiddle、MouseOnRightBottom、MouseOnTopMiddle、MouseOnBottomMiddle、MouseOnMiddle:滑鼠位置旗標int LittleRectangleWidth、LittleRectangleHeight:控制點小矩形尺寸Rectangle LeftTopRectangle 等 8 個小矩形Rectangle Rect:主矩形Size Size:主矩形大小Image BackImage:背景圖片Cursor MyCursor:游標樣式主要方法成員:
SetLittleRectangle():設定 8 個小矩形位置Draw(Color backColor):繪製主矩形與控制點ChangeSize(MouseEventArgs e):調整大小Move(int newX, int newY):移動位置CheckMouseLocation(MouseEventArgs e):檢測滑鼠位置並切換游標setAllModeFalse():重設所有模式旗標onChangingMode():判斷是否處於調整/移動模式Initialize(int x, int y, int width, int height):初始化矩形