private MainForm() { for (int i = 0; i < PianoTracks.Length; i++) { PianoTracks[i] = true; } // File Menu openDSEItem = new ToolStripMenuItem { Text = Strings.MenuOpenDSE }; openDSEItem.Click += OpenDSE; openMLSSItem = new ToolStripMenuItem { Text = Strings.MenuOpenMLSS }; openMLSSItem.Click += OpenMLSS; openMP2KItem = new ToolStripMenuItem { Text = Strings.MenuOpenMP2K }; openMP2KItem.Click += OpenMP2K; openSDATItem = new ToolStripMenuItem { Text = Strings.MenuOpenSDAT }; openSDATItem.Click += OpenSDAT; fileItem = new ToolStripMenuItem { Text = Strings.MenuFile }; fileItem.DropDownItems.AddRange(new ToolStripItem[] { openDSEItem, openMLSSItem, openMP2KItem, openSDATItem }); // Data Menu trackViewerItem = new ToolStripMenuItem { ShortcutKeys = Keys.Control | Keys.T, Text = Strings.TrackViewerTitle }; trackViewerItem.Click += OpenTrackViewer; exportMIDIItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveMIDI }; exportMIDIItem.Click += ExportMIDI; exportWAVItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuSaveWAV }; exportWAVItem.Click += ExportWAV; dataItem = new ToolStripMenuItem { Text = Strings.MenuData }; dataItem.DropDownItems.AddRange(new ToolStripItem[] { trackViewerItem, exportMIDIItem, exportWAVItem }); // Playlist Menu endPlaylistItem = new ToolStripMenuItem { Enabled = false, Text = Strings.MenuEndPlaylist }; endPlaylistItem.Click += EndCurrentPlaylist; playlistItem = new ToolStripMenuItem { Text = Strings.MenuPlaylist }; playlistItem.DropDownItems.AddRange(new ToolStripItem[] { endPlaylistItem }); // Main Menu mainMenu = new MenuStrip { Size = new Size(intendedWidth, 24) }; mainMenu.Items.AddRange(new ToolStripItem[] { fileItem, dataItem, playlistItem }); // Buttons playButton = new ThemedButton { Enabled = false, ForeColor = Color.MediumSpringGreen, Text = Strings.PlayerPlay }; playButton.Click += (o, e) => Play(); pauseButton = new ThemedButton { Enabled = false, ForeColor = Color.DeepSkyBlue, Text = Strings.PlayerPause }; pauseButton.Click += (o, e) => Pause(); stopButton = new ThemedButton { Enabled = false, ForeColor = Color.MediumVioletRed, Text = Strings.PlayerStop }; stopButton.Click += (o, e) => Stop(); // Numerical songNumerical = new ThemedNumeric { Enabled = false, Minimum = 0, Visible = false }; songNumerical.ValueChanged += SongNumerical_ValueChanged; // Timer timer = new Timer(); timer.Tick += UpdateUI; // Piano piano = new PianoControl(); // Volume bar volumeBar = new ColorSlider { Enabled = false, LargeChange = 20, Maximum = 100, SmallChange = 5 }; volumeBar.ValueChanged += VolumeBar_ValueChanged; // Position bar positionBar = new ColorSlider { AcceptKeys = false, Enabled = false, Maximum = 0 }; positionBar.MouseUp += PositionBar_MouseUp; positionBar.MouseDown += PositionBar_MouseDown; // Playlist box songsComboBox = new ImageComboBox { Enabled = false }; songsComboBox.SelectedIndexChanged += SongsComboBox_SelectedIndexChanged; // Track info songInfo = new SongInfoControl { Dock = DockStyle.Fill }; // Split container splitContainer = new SplitContainer { BackColor = Theme.TitleBar, Dock = DockStyle.Fill, IsSplitterFixed = true, Orientation = Orientation.Horizontal, SplitterWidth = 1 }; splitContainer.Panel1.Controls.AddRange(new Control[] { playButton, pauseButton, stopButton, songNumerical, songsComboBox, piano, volumeBar, positionBar }); splitContainer.Panel2.Controls.Add(songInfo); // MainForm ClientSize = new Size(intendedWidth, intendedHeight); Controls.AddRange(new Control[] { splitContainer, mainMenu }); MainMenuStrip = mainMenu; MinimumSize = new Size(intendedWidth + (Width - intendedWidth), intendedHeight + (Height - intendedHeight)); // Borders Resize += OnResize; Text = Utils.ProgramName; // Taskbar Buttons if (TaskbarManager.IsPlatformSupported) { prevTButton = new ThumbnailToolBarButton(Resources.IconPrevious, Strings.PlayerPreviousSong); prevTButton.Click += PlayPreviousSong; toggleTButton = new ThumbnailToolBarButton(Resources.IconPlay, Strings.PlayerPlay); toggleTButton.Click += TogglePlayback; nextTButton = new ThumbnailToolBarButton(Resources.IconNext, Strings.PlayerNextSong); nextTButton.Click += PlayNextSong; prevTButton.Enabled = toggleTButton.Enabled = nextTButton.Enabled = false; TaskbarManager.Instance.ThumbnailToolBars.AddButtons(Handle, prevTButton, toggleTButton, nextTButton); } OnResize(null, null); }
void InitializeComponent() { components = new Container(); button1 = new ThemedButton(); richTextBoxMessage = new ThemedRichTextBox(); FlexibleMessageBoxFormBindingSource = new BindingSource(components); panel1 = new ThemedPanel(); pictureBoxForIcon = new PictureBox(); button2 = new ThemedButton(); button3 = new ThemedButton(); ((ISupportInitialize)(FlexibleMessageBoxFormBindingSource)).BeginInit(); panel1.SuspendLayout(); ((ISupportInitialize)(pictureBoxForIcon)).BeginInit(); SuspendLayout(); // // button1 // button1.Anchor = AnchorStyles.Bottom | AnchorStyles.Right; button1.AutoSize = true; button1.DialogResult = DialogResult.OK; button1.Location = new Point(11, 67); button1.MinimumSize = new Size(0, 24); button1.Name = "button1"; button1.Size = new Size(75, 24); button1.TabIndex = 2; button1.Text = "OK"; button1.UseVisualStyleBackColor = true; button1.Visible = false; // // richTextBoxMessage // richTextBoxMessage.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right); richTextBoxMessage.BorderStyle = BorderStyle.None; richTextBoxMessage.DataBindings.Add(new Binding("Text", FlexibleMessageBoxFormBindingSource, "MessageText", true, DataSourceUpdateMode.OnPropertyChanged)); richTextBoxMessage.Font = new Font(Theme.Font.FontFamily, 9); richTextBoxMessage.Location = new Point(50, 26); richTextBoxMessage.Margin = new Padding(0); richTextBoxMessage.Name = "richTextBoxMessage"; richTextBoxMessage.ReadOnly = true; richTextBoxMessage.ScrollBars = RichTextBoxScrollBars.Vertical; richTextBoxMessage.Size = new Size(200, 20); richTextBoxMessage.TabIndex = 0; richTextBoxMessage.TabStop = false; richTextBoxMessage.Text = "<Message>"; richTextBoxMessage.LinkClicked += new LinkClickedEventHandler(LinkClicked); // // panel1 // panel1.Anchor = (((AnchorStyles.Top | AnchorStyles.Bottom) | AnchorStyles.Left) | AnchorStyles.Right); panel1.Controls.Add(pictureBoxForIcon); panel1.Controls.Add(richTextBoxMessage); panel1.Location = new Point(-3, -4); panel1.Name = "panel1"; panel1.Size = new Size(268, 59); panel1.TabIndex = 1; // // pictureBoxForIcon // pictureBoxForIcon.BackColor = Color.Transparent; pictureBoxForIcon.Location = new Point(15, 19); pictureBoxForIcon.Name = "pictureBoxForIcon"; pictureBoxForIcon.Size = new Size(32, 32); pictureBoxForIcon.TabIndex = 8; pictureBoxForIcon.TabStop = false; // // button2 // button2.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); button2.DialogResult = DialogResult.OK; button2.Location = new Point(92, 67); button2.MinimumSize = new Size(0, 24); button2.Name = "button2"; button2.Size = new Size(75, 24); button2.TabIndex = 3; button2.Text = "OK"; button2.UseVisualStyleBackColor = true; button2.Visible = false; // // button3 // button3.Anchor = (AnchorStyles.Bottom | AnchorStyles.Right); button3.AutoSize = true; button3.DialogResult = DialogResult.OK; button3.Location = new Point(173, 67); button3.MinimumSize = new Size(0, 24); button3.Name = "button3"; button3.Size = new Size(75, 24); button3.TabIndex = 0; button3.Text = "OK"; button3.UseVisualStyleBackColor = true; button3.Visible = false; // // FlexibleMessageBoxForm // AutoScaleDimensions = new SizeF(6F, 13F); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(260, 102); Controls.Add(button3); Controls.Add(button2); Controls.Add(panel1); Controls.Add(button1); DataBindings.Add(new Binding("Text", FlexibleMessageBoxFormBindingSource, "CaptionText", true)); Icon = Properties.Resources.Icon; MaximizeBox = false; MinimizeBox = false; MinimumSize = new Size(276, 140); Name = "FlexibleMessageBoxForm"; SizeGripStyle = SizeGripStyle.Show; StartPosition = FormStartPosition.CenterParent; Text = "<Caption>"; Shown += new EventHandler(FlexibleMessageBoxForm_Shown); ((ISupportInitialize)(FlexibleMessageBoxFormBindingSource)).EndInit(); panel1.ResumeLayout(false); ((ISupportInitialize)(pictureBoxForIcon)).EndInit(); ResumeLayout(false); PerformLayout(); }