protected override void OnRender(DrawingContext drawingContext) { int firstTrack = (int)(OffsetY / TrackHeight); int alt = firstTrack; double top = TrackHeight * firstTrack - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(alt) ? ThemeManager.BlackKeyBrushNormal : MusicMath.IsCenterKey(alt) ? ThemeManager.CenterKeyBrushNormal : ThemeManager.WhiteKeyBrushNormal, null, new Rect(0, (int)top, _size.Width, TrackHeight)); if (TrackHeight >= 12) { FormattedText text = new FormattedText( MusicMath.GetNoteString(UIConstants.MaxNoteNum - alt - 1), System.Threading.Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, SystemFonts.CaptionFontFamily.GetTypefaces().First(), 12, MusicMath.IsBlackKey(alt) ? ThemeManager.BlackKeyNameBrushNormal : MusicMath.IsCenterKey(alt) ? ThemeManager.CenterKeyNameBrushNormal : ThemeManager.WhiteKeyNameBrushNormal ); drawingContext.DrawText(text, new Point(42 - text.Width, (int)(top + (TrackHeight - text.Height) / 2))); } top += TrackHeight; alt++; } }
protected override void OnRender(DrawingContext drawingContext) { int note = UIConstants.MaxNoteNum - 1 - (int)(OffsetY / TrackHeight); double top = TrackHeight * (UIConstants.MaxNoteNum - note - 1) - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(note) ? ThemeManager.BlackKeyBrushNormal : MusicMath.IsCenterKey(note) ? ThemeManager.CenterKeyBrushNormal : ThemeManager.WhiteKeyBrushNormal, null, new Rect(0, (int)top, _size.Width, TrackHeight)); if (TrackHeight >= 12) { FormattedText text = new FormattedText( MusicMath.GetNoteString(note), System.Threading.Thread.CurrentThread.CurrentUICulture, FlowDirection.LeftToRight, SystemFonts.CaptionFontFamily.GetTypefaces().First(), 12, MusicMath.IsBlackKey(note) ? ThemeManager.BlackKeyNameBrushNormal : MusicMath.IsCenterKey(note) ? ThemeManager.CenterKeyNameBrushNormal : ThemeManager.WhiteKeyNameBrushNormal, VisualTreeHelper.GetDpi(this).PixelsPerDip ); drawingContext.DrawText(text, new Point(42 - text.Width, (int)(top + (TrackHeight - text.Height) / 2))); } top += TrackHeight; note--; } }
protected override void OnRender(DrawingContext drawingContext) { int note = UIConstants.MaxNoteNum - 1 - (int)(OffsetY / TrackHeight); double top = TrackHeight * (UIConstants.MaxNoteNum - note - 1) - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(note) ? ThemeManager.TrackBackgroundBrushAlt : ThemeManager.TrackBackgroundBrush, null, new Rect(0, (int)top, _size.Width, TrackHeight)); top += TrackHeight; note--; } }
protected override void OnRender(DrawingContext drawingContext) { int firstTrack = (int)(OffsetY / TrackHeight); int alt = firstTrack % 12; double top = TrackHeight * firstTrack - OffsetY; while (top < _size.Height) { drawingContext.DrawRectangle( MusicMath.IsBlackKey(alt) ? ThemeManager.TrackBackgroundBrushAlt : ThemeManager.TrackBackgroundBrush, null, new Rect(0, (int)top, _size.Width, TrackHeight)); top += TrackHeight; alt = (alt + 1) % 12; } }