public static Collapse ( |
||
rect | ||
return |
protected override void OnLostMouseCapture(MouseEventArgs e) { base.OnLostMouseCapture(e); if (this.bounds.Width < 3 || this.bounds.Height < 3) { CloseService(); return; } Cursor = Cursors.Arrow; IntRect startRect = NativeMethods.ClientToScreen(this, this.bounds); screenshot = new ScreenShot(startRect); startRect.Width -= 1; startRect.Height -= 1; IntRect screenBounds = ScreenCoordinates.Collapse(startRect, screenshot); Rect bounds = NativeMethods.ScreenToClient(this, screenBounds); if (!bounds.IsEmpty) { AnimateBounds(bounds); } isInDrawMode = false; Dimensions.CanClose = true; }
protected override void OnLostMouseCapture(MouseEventArgs e) { base.OnLostMouseCapture(e); if (this.bounds.Width == 0 || this.bounds.Height == 0) { this.CloseService(); return; } this.IsGrayed = false; this.Cursor = Cursors.Arrow; IntRect startRect = NativeMethods.ClientToScreen(this, this.bounds); startRect.Width -= 1; startRect.Height -= 1; IntRect screenBounds = ScreenCoordinates.Collapse(startRect, this.screenshot); if (!screenBounds.IsEmpty) { this.AnimateBounds(screenBounds); } this.BoundsRect.Visibility = Visibility.Visible; this.Dimensions.CanClose = true; //BitmapFrame frame = BitmapFrame.Create(this.screenshot.Image); //PngBitmapEncoder encoder = new PngBitmapEncoder(); //encoder.Frames.Add(frame); //using (FileStream fs = new FileStream(@"C:\tmp\ss.png", FileMode.Create, FileAccess.Write)) { // encoder.Save(fs); //}; }
public static IntRect Collapse(IntRect rect) { return(ScreenCoordinates.Collapse(rect, new ScreenShot())); }