public WaveFormScale() { _control = new WaveFormScaleControl(); _control.OnInvalidateVisual += () => Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(InvalidateVisual)); _control.OnInvalidateVisualInRect += (rect) => Dispatcher.BeginInvoke(DispatcherPriority.Render, new Action(() => { InvalidateVisual(); // TODO: It seems you can't invalidate a specific rect in WPF? What? // http://stackoverflow.com/questions/2576599/possible-to-invalidatevisual-on-a-given-region-instead-of-entire-wpf-control })); }
private void Initialize() { _control = new WaveFormScaleControl(); _control.OnInvalidateVisual += () => Post(Invalidate); _control.OnInvalidateVisualInRect += (rect) => Post(() => Invalidate(GenericControlHelper.ToRect(rect))); //_control.FontSize = 12; if (!IsInEditMode) SetLayerType(LayerType.Hardware, null); // Use GPU instead of CPU (except in IDE such as Eclipse) }
private void Initialize() { WantsLayer = true; LayerContentsRedrawPolicy = NSViewLayerContentsRedrawPolicy.OnSetNeedsDisplay; _control = new WaveFormScaleControl(); _control.OnInvalidateVisual += () => InvokeOnMainThread(() => SetNeedsDisplayInRect(Bounds)); _control.OnInvalidateVisualInRect += (rect) => InvokeOnMainThread(() => SetNeedsDisplayInRect(GenericControlHelper.ToRect(rect))); }