Пример #1
0
        private void DrawNote(Note note, DurationCFugue duration, bool dot, Octave[] actOctave, char orientation,
                              string hasAcc, bool hasTie, byte partIndex)
        {
            double height         = LayoutController.ElementHeight["N" + duration];
            Octave actualOctave   = actOctave[partIndex];
            double notePos        = LayoutController.GetNotePos(note, actualOctave, Parameters.Clefs[partIndex], partIndex);
            double top            = LayoutController.GetNoteTopMargin(notePos, height, orientation, partIndex);
            double noteLeftMargin = leftMargin;

            if (hasAcc != "")
            {
                DrawAccidental(notePos, hasAcc, orientation, partIndex);
                noteLeftMargin += LayoutController.accidentalOffset;
            }
            if (hasTie)
            {
                double notePosOffset = notePos + LayoutController.GetTieOffset(note, actualOctave, partIndex);
                DrawTie(layoutInterval + 2 * unitElementWidth, noteLeftMargin - layoutInterval - unitElementWidth, notePosOffset, orientation, partIndex);
            }

            Image image = new Image();

            image.HorizontalAlignment = HorizontalAlignment.Left;
            image.Source = LayoutController.GetNote(duration, dot, orientation);
            image.Height = height;
            image.Margin = new Thickness(noteLeftMargin, top, 0, 0);

            staffGrid.Children.Add(image);
            Grid.SetRow(image, partIndex);

            string has = LayoutController.HasLine(note, actualOctave);

            if (has != "")
            {
                DrawExtraLedgerLines(notePos, note, actualOctave, duration, noteLeftMargin, Convert.ToInt32(has), partIndex);
            }
        }