호불호? 가 있을 수도 있는, 그런데 저는 아주 만족스러운 코드 스타일입니다.
public void Resize(ActionCursorKind actionCursor, Point p)
{
Rect = actionCursor switch
{
ActionCursorKind.LeftResize => new(Rect.Left + p.X, Rect.Top, Rect.Width - p.X, Rect.Height),
ActionCursorKind.LeftTopResize => new(Rect.Left + p.X, Rect.Top + p.Y, Rect.Width - p.X, Rect.Height - p.Y),
ActionCursorKind.TopResize => new(Rect.Left, Rect.Top + p.Y, Rect.Width, Rect.Height - p.Y),
ActionCursorKind.RightTopResize => new(Rect.Left, Rect.Top + p.Y, Rect.Width + p.X, Rect.Height - p.Y),
ActionCursorKind.RightResize => new(Rect.Left, Rect.Top, Rect.Width + p.X, Rect.Height),
ActionCursorKind.RightBottomResize => new(Rect.Left, Rect.Top, Rect.Width + p.X, Rect.Height + p.Y),
ActionCursorKind.BottomResize => new(Rect.Left, Rect.Top, Rect.Width, Rect.Height + p.Y),
ActionCursorKind.LeftBottomResize => new(Rect.Left + p.X, Rect.Top, Rect.Width - p.X, Rect.Height + p.Y),
_ => Rect
};
}