protected override void OnResize(EventArgs e) { OffscreenBuffer.TryReAllocateOffsceenBuffer(); base.OnResize(e); if (BackgroundIImage != null) { BackgroundIImage = BackgroundIImage; } if (Canvas.Children.Count == 0) { return; } // resize is called whenever the control is moved or resized Size size = Size; if (size == _oldViewSize) { // the control was moved // this should mean that it was repositioned by the host // if the control has transparencies, invalidate it. //if (BackColor == Color.Transparent) // Canvas.inva Invalidate(); } else { _oldViewSize = size; // the control was resized for whatever reason // we must repaint everything. //sInvalidate(); } }
private static void TryReAllocateOffsceenBuffer() { OffscreenBuffer.TryReAllocateOffsceenBuffer(ref _offScreenBmp, ref _offScreenGraphics, Screen.PrimaryScreen.WorkingArea.Width, Screen.PrimaryScreen.WorkingArea.Height); }