If you think about it, the number of primitives needed to draw music notation is fairly small, especially if you don't get too fancy. All you basically need is:
- Vertical lines (note stems)
- Horizontal lines (staff lines)
- Ovals full and outlined (representing notes)
- Sharp and Flats are already provided for you with # and b
There are some fancier symbols that i omitted such as treble, bass clef marks but those you could cheese with T and B or find a fancier font that might work.
Very simple, sample code to get you started:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Drawing.Drawing2D;
public partial class MusicForm : Form
{
public MusicForm()
{
InitializeComponent();
}
private int _staffHght = 15;
private int _noteHght = 12;
private int _noteWdth = 20;
private Pen _notePen = new Pen(Color.Black, 2);
private Brush _noteBrush = Brushes.Black;
private void musicPanel_Paint(object sender, PaintEventArgs e)
{
Graphics g = e.Graphics;
g.SmoothingMode = SmoothingMode.HighQuality;
// draw some staff lines
for (int i = 1; i < 6; i++)
g.DrawLine(Pens.Black, 0, i * _staffHght, musicPanel.Width, i * _staffHght);
// draw four semi-random full and quarter notes
g.DrawEllipse(_notePen, 10, 2 * _staffHght, _noteWdth, _noteHght);
g.DrawEllipse(_notePen, 50, 4 * _staffHght, _noteWdth, _noteHght);
g.FillEllipse(_noteBrush, 100, 2 * _staffHght, _noteWdth, _noteHght);
g.FillEllipse(_noteBrush, 150, 4 * _staffHght, _noteWdth, _noteHght);
}
}
This paint function would of course have to be much more dynamic: full of loops on your collections of primitives...