Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #region Window: Resizing
- private void Resizing_MouseDown(object sender, MouseButtonEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- t.CaptureMouse(); }
- private void Resizing_MouseUp(object sender, MouseButtonEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- t.ReleaseMouseCapture(); }
- private void Resizing_WE(object sender, MouseEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- if (!t.IsMouseCaptured) return;
- this.Width = Math.Max(e.GetPosition(this).X + 5, 0); }
- private void Resizing_EW(object sender, MouseEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- if (!t.IsMouseCaptured) return;
- var x = e.GetPosition(this).X;
- var w = this.ActualWidth;
- this.Width = Math.Max(this.ActualWidth - x, 0);
- if (w != this.ActualWidth)
- this.Left += w - this.ActualWidth; }
- private void Resizing_NS(object sender, MouseEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- if (!t.IsMouseCaptured) return;
- this.Height = Math.Max(e.GetPosition(this).Y + 5, 0); }
- private void Resizing_NWSE(object sender, MouseEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- if (!t.IsMouseCaptured) return;
- var p = e.GetPosition(this);
- this.Width = Math.Max(p.X + 5, 0);
- this.Height = Math.Max(p.Y + 5, 0); }
- private void Resizing_NESW(object sender, MouseEventArgs e) {
- var t = sender as Shape;
- if (t == null) { Debug.Assert(false); return; }
- if (!t.IsMouseCaptured) return;
- var p = e.GetPosition(this);
- this.Height = Math.Max(p.Y + 5, 5);
- var w = this.ActualWidth;
- this.Width = Math.Max(this.ActualWidth - p.X, 5);
- if (w != this.ActualWidth)
- this.Left += w - this.ActualWidth; }
- #endregion
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement