| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113 |
- using System;
- using System.Drawing;
- namespace Dongke.WinForm.Controls
- {
- internal struct GripBounds
- {
- private const int GRIPSIZE = 6;
- private const int CORNER_GRIPSIZE = GRIPSIZE << 1;
- private Rectangle _clientRectangle;
- public GripBounds(Rectangle clientRectangle)
- {
- this._clientRectangle = clientRectangle;
- }
- public Rectangle ClientRectangle
- {
- get { return _clientRectangle; }
- //set { clientRectangle = value; }
- }
- public Rectangle Bottom
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Y = rect.Bottom - GRIPSIZE + 1;
- rect.Height = GRIPSIZE;
- return rect;
- }
- }
- public Rectangle BottomRight
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Y = rect.Bottom - CORNER_GRIPSIZE + 1;
- rect.Height = CORNER_GRIPSIZE;
- rect.X = rect.Width - CORNER_GRIPSIZE + 1;
- rect.Width = CORNER_GRIPSIZE;
- return rect;
- }
- }
- public Rectangle Top
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Height = GRIPSIZE;
- return rect;
- }
- }
- public Rectangle TopRight
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Height = CORNER_GRIPSIZE;
- rect.X = rect.Width - CORNER_GRIPSIZE + 1;
- rect.Width = CORNER_GRIPSIZE;
- return rect;
- }
- }
- public Rectangle Left
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Width = GRIPSIZE;
- return rect;
- }
- }
- public Rectangle BottomLeft
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Width = CORNER_GRIPSIZE;
- rect.Y = rect.Height - CORNER_GRIPSIZE + 1;
- rect.Height = CORNER_GRIPSIZE;
- return rect;
- }
- }
- public Rectangle Right
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.X = rect.Right - GRIPSIZE + 1;
- rect.Width = GRIPSIZE;
- return rect;
- }
- }
- public Rectangle TopLeft
- {
- get
- {
- Rectangle rect = ClientRectangle;
- rect.Width = CORNER_GRIPSIZE;
- rect.Height = CORNER_GRIPSIZE;
- return rect;
- }
- }
- }
- }
|