public override void DrawLocal(IGraphics graphics, RenderOptions options) { base.DrawLocal(graphics, options); for (int i = 0; i < 5; i++) { float y = i * Bounds.Height / 4; using (var pen = EffectivePen.CreateGdiPen()) graphics.DrawLine(pen, 0, y, Bounds.Width, y); } var rect = GetLocalBounds(); rect.Inflate(0, 8); rect.X = 2; rect.Width = 14; gClef.Draw(graphics, rect); }
public override void DrawLocal(IGraphics graphics, RenderOptions options) { base.DrawLocal(graphics, options); var cx = Bounds.Width / 2; var cy = Bounds.Height / 2; var gs = graphics.Save(); graphics.TranslateTransform(cx, cy); graphics.RotateTransform(-10); graphics.TranslateTransform(-cx, -cy); var bounds = GetLocalBounds(); bounds.Inflate(0, -bounds.Width / 10); var path = new GraphicsPath(); path.AddEllipse(bounds); if (Duration == Duration.Whole || Duration == Duration.Half) { bounds.Inflate(-bounds.Width / 8, -bounds.Width / 6); path.AddEllipse(bounds); } graphics.FillPath(Brushes.Black, path); graphics.Restore(gs); if (position < -1 || position > 8) { // draw ledger lines if above or below staff var pen = EffectivePen.CreateGdiPen(); var staff = (StaffNode)MasterGroup.MainItem; var yoff = staff.Bounds.Y - Bounds.Y; int i1 = position < -1 ? position : 9; int i2 = position < -1 ? -2 : position; for (int i = i1; i <= i2; i++) { if (i % 2 != 0) { continue; } var y = yoff + i * staff.Bounds.Height / 8; graphics.DrawLine(pen, -2, y, Bounds.Width + 2, y); } pen.Dispose(); } if (Duration != Duration.Whole) { // draw stem float x = Bounds.Width; float y = Bounds.Height / 2; var pen = new System.Drawing.Pen(Color.Black, 0.5f); graphics.DrawLine(pen, x - pen.Width / 2, y, x - pen.Width / 2, y - Bounds.Height * 2); pen.Dispose(); } if (Duration == Duration.Eighth || Duration == Duration.Sixteenth) { DrawFlag(graphics, bounds.Width, bounds.Height / 2 - bounds.Height * 2, bounds.Width + 1, bounds.Height); } if (Duration == Duration.Sixteenth) { DrawFlag(graphics, bounds.Width, bounds.Height - bounds.Height * 2, bounds.Width + 1, bounds.Height); } }