private void Initialize() { // Keep this or for strange reason the bitmaps won't appear. SetBackgroundColor(Color.Black); _control = new WaveFormControl(); _control.ShowScrollBar = false; _control.Frame = new BasicRectangle(0, 0, Width, Height); _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 WaveFormControl(); _control.OnChangePosition += (position) => OnChangePosition(position); _control.OnChangeSecondaryPosition += (position) => OnChangeSecondaryPosition(position); _control.OnContentOffsetChanged += (offset) => OnContentOffsetChanged(offset); _control.OnInvalidateVisual += () => InvokeOnMainThread(() => SetNeedsDisplayInRect(Bounds)); _control.OnInvalidateVisualInRect += (rect) => InvokeOnMainThread(() => SetNeedsDisplayInRect(GenericControlHelper.ToRect(rect))); SetFrame(); PostsBoundsChangedNotifications = true; NSNotificationCenter.DefaultCenter.AddObserver(NSView.FrameChangedNotification, FrameDidChangeNotification, this); }
private void Initialize() { BackgroundColor = GlobalTheme.BackgroundColor; _control = new WaveFormControl(); _control.FontFace = "HelveticaNeue"; _control.LetterFontFace = "HelveticaNeue"; _control.OnInvalidateVisual += () => InvokeOnMainThread(SetNeedsDisplay); _control.OnInvalidateVisualInRect += (rect) => InvokeOnMainThread(() => SetNeedsDisplayInRect(GenericControlHelper.ToRect(rect))); }