Esempio n. 1
0
		private void ShowHelperLines()
		{
			for (var octave = Note.Octave.Great; octave <= Note.Octave.ThreeLined; octave++)
			{
				var note = new Note(Note.Letter.C, Note.Accidental.None, octave);
				var staffPosition = note.ToStaffPosition(type, false);
				if (note.staffType != type)
					continue;
				double y = StaffPositionToY(staffPosition);
				// Rysuję linie pomocniczą.
				Line helperLine = new Line
				{
					X1 = left,
					X2 = score.ActualWidth - marginLeft,
					Y1 = y,
					Y2 = y,
					Stroke = helperLineBrush,
					StrokeThickness = 0.4
				};
				score.Children.Add(helperLine);
				// Rusuje nazwę oktawy.
				const string familyName = "Consolas";
				double fontSize = 9 * score.Magnification;
				FormattedText formattedText = new FormattedText(
					octave.ToString(),
					CultureInfo.GetCultureInfo("en-us"),
					FlowDirection.LeftToRight,
					new Typeface(familyName),
					fontSize,
					Brushes.Black);
				TextBlock octaveNameTextBlock = new TextBlock
				{
					FontFamily = new FontFamily(familyName),
					FontSize = fontSize,
					Text = octave.ToString(),
					Foreground = helperLineBrush,
					Padding = new Thickness(0, 0, 0, 0),
					Margin = new Thickness(helperLine.X1, helperLine.Y1 - formattedText.Height/* + formattedText.OverhangAfter - formattedText.Extent*/, 0, 0)
				};
				score.Children.Add(octaveNameTextBlock);
				//Canvas.SetZIndex(octaveNameTextBlock, 1);
			}
		}