public void SetPiano(Piano p) { piano = p; }
float zoom; /* The current zoom level (1.0 == 100%) */ #endregion Fields #region Constructors /** Create a new instance of this Form. * This window has three child controls: * - The MidiPlayer * - The SheetMusic * - The scrollView, for scrolling the SheetMusic. * Create the menus. * Create the color dialog. */ public SheetMusicWindow() { Text = "Midi Sheet Music"; Icon = new Icon(GetType(), "NotePair.ico"); BackColor = Color.Gray; Rectangle bounds = System.Windows.Forms.Screen.PrimaryScreen.Bounds; Size = new Size(bounds.Width - 20, bounds.Height * 9/10); CreateMenu(); DisableMenus(); AutoScroll = false; if (System.Windows.Forms.Screen.PrimaryScreen.Bounds.Width >= 1200) { zoom = 1.5f; } else { zoom = 1.0f; } /* Create the player panel */ player = new MidiPlayer(); player.Parent = this; player.Dock = DockStyle.Top; player.BackColor = Color.LightGray; player.BorderStyle = BorderStyle.FixedSingle; piano = new Piano(); piano.Parent = this; // piano.BackColor = Color.LightGray; piano.Location = new Point(piano.Location.X, piano.Location.Y + player.Height); player.SetPiano(piano); scrollView = new Panel(); scrollView.Parent = this; scrollView.Location = new Point(scrollView.Location.X, scrollView.Location.Y + player.Height + piano.Height); scrollView.BackColor = Color.Gray; scrollView.AutoScroll = true; scrollView.HorizontalScroll.Enabled = true; scrollView.VerticalScroll.Enabled = true; selectMidi = new Label(); selectMidi.Font = new Font("Arial", 16, FontStyle.Bold); selectMidi.Text = "Use the menu File:Open to select a MIDI file"; selectMidi.Dock = DockStyle.Fill; selectMidi.TextAlign = ContentAlignment.TopCenter; selectMidi.Parent = scrollView; colordialog = new NoteColorDialog(); CreatePrintSettings(); // this.Width = Math.Max(this.Width, piano.Width + SheetMusic.NoteHeight*4); }