private MainForm() { for (int i = 0; i < 0x10; i++) { PianoTracks[i] = true; } components = new Container(); // Main Menu openSDATToolStripMenuItem = new ToolStripMenuItem { Text = "Open SDAT", ShortcutKeys = Keys.Control | Keys.O }; openSDATToolStripMenuItem.Click += OpenSDAT; configToolStripMenuItem = new ToolStripMenuItem { Text = "Refresh Config", ShortcutKeys = Keys.Control | Keys.R }; configToolStripMenuItem.Click += ReloadConfig; fileToolStripMenuItem = new ToolStripMenuItem { Text = "File" }; fileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { openSDATToolStripMenuItem, configToolStripMenuItem }); mainMenu = new MenuStrip { Size = new Size(iWidth, 24) }; mainMenu.Items.AddRange(new ToolStripItem[] { fileToolStripMenuItem }); // Buttons playButton = new ThemedButton { ForeColor = Color.MediumSpringGreen, Location = new Point(5, 3), Text = "Play" }; playButton.Click += (o, e) => Play(); pauseButton = new ThemedButton { ForeColor = Color.DeepSkyBlue, Location = new Point(85, 3), Text = "Pause" }; pauseButton.Click += (o, e) => Pause(); stopButton = new ThemedButton { ForeColor = Color.MediumVioletRed, Location = new Point(166, 3), Text = "Stop" }; stopButton.Click += (o, e) => Stop(); playButton.Enabled = pauseButton.Enabled = stopButton.Enabled = false; playButton.Size = stopButton.Size = new Size(75, 23); pauseButton.Size = new Size(76, 23); // Numericals songNumerical = new ThemedNumeric { Enabled = false, Location = new Point(246, 4), Minimum = ushort.MinValue }; songNumerical.Size = new Size(45, 23); songNumerical.ValueChanged += (o, e) => LoadSong(); // Timer timer = new Timer(components); timer.Tick += UpdateUI; // Piano piano = new PianoControl { Anchor = AnchorStyles.Bottom, Location = new Point(0, 125 - 50 - 1), Size = new Size(iWidth, 50) }; // Volume bar int sWidth = (int)(iWidth / sfWidth); int sX = iWidth - sWidth - 4; volumeBar = new ColorSlider { Enabled = false, LargeChange = 20, Location = new Point(83, 45), Maximum = 100, Size = new Size(155, 27), SmallChange = 5 }; volumeBar.ValueChanged += VolumeBar_ValueChanged; // Playlist box songsComboBox = new ComboBox { Anchor = AnchorStyles.Top | AnchorStyles.Right, Enabled = false, Location = new Point(sX, 4), Size = new Size(sWidth, 23) }; songsComboBox.SelectedIndexChanged += SongsComboBox_SelectedIndexChanged; // Track info trackInfo = new TrackInfoControl { Dock = DockStyle.Fill, Size = new Size(iWidth, 690) }; // Split container splitContainer = new SplitContainer { BackColor = Theme.TitleBar, Dock = DockStyle.Fill, FixedPanel = FixedPanel.Panel1, IsSplitterFixed = true, Orientation = Orientation.Horizontal, Size = new Size(iWidth, iHeight), SplitterDistance = 125, SplitterWidth = 1 }; splitContainer.Panel1.Controls.AddRange(new Control[] { playButton, pauseButton, stopButton, songNumerical, songsComboBox, piano, volumeBar }); splitContainer.Panel2.Controls.Add(trackInfo); // MainForm AutoScaleDimensions = new SizeF(6, 13); AutoScaleMode = AutoScaleMode.Font; ClientSize = new Size(iWidth, iHeight); Controls.AddRange(new Control[] { splitContainer, mainMenu }); MainMenuStrip = mainMenu; MinimumSize = new Size(8 + iWidth + 8, 30 + iHeight + 8); // Borders SongPlayer.Instance.SongEnded += SongEnded; Resize += OnResize; Text = "NDS Music Studio"; // Taskbar Buttons if (TaskbarManager.IsPlatformSupported) { prevTButton = new ThumbnailToolBarButton(Resources.IconPrevious, "Previous Song"); prevTButton.Click += (o, e) => PlayPreviousSong(); toggleTButton = new ThumbnailToolBarButton(Resources.IconPlay, "Play"); toggleTButton.Click += (o, e) => TogglePlayback(); nextTButton = new ThumbnailToolBarButton(Resources.IconNext, "Next Song"); nextTButton.Click += (o, e) => PlayNextSong(); prevTButton.Enabled = toggleTButton.Enabled = nextTButton.Enabled = false; TaskbarManager.Instance.ThumbnailToolBars.AddButtons(Handle, prevTButton, toggleTButton, nextTButton); } }
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)); 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(); }