using OverlayFormObj; using System.IO; namespace DualScreenDemo { public partial class PrimaryForm : Form { public Panel primaryScreenPanel; public Panel videoPanel; public Button syncServiceBellButton; public Button syncCutSongButton; public Button syncReplayButton; public Button syncOriginalSongButton; public Button syncMuteButton; public Button syncPauseButton; public Button syncPlayButton; public Button syncVolumeUpButton; public Button syncVolumeDownButton; public Button syncMicUpButton; public Button syncMicDownButton; public Button syncCloseButton; private void InitializeSyncScreen() { this.primaryScreenPanel = new System.Windows.Forms.Panel(); this.videoPanel = new System.Windows.Forms.Panel(); this.syncServiceBellButton = new System.Windows.Forms.Button(); this.syncCutSongButton = new System.Windows.Forms.Button(); this.syncReplayButton = new System.Windows.Forms.Button(); this.syncOriginalSongButton = new System.Windows.Forms.Button(); this.syncMuteButton = new System.Windows.Forms.Button(); this.syncPauseButton = new System.Windows.Forms.Button(); this.syncPlayButton = new System.Windows.Forms.Button(); this.syncVolumeUpButton = new System.Windows.Forms.Button(); this.syncVolumeDownButton = new System.Windows.Forms.Button(); this.syncMicUpButton = new System.Windows.Forms.Button(); this.syncMicDownButton = new System.Windows.Forms.Button(); this.syncCloseButton = new System.Windows.Forms.Button(); this.SuspendLayout(); ResizeAndPositionControl(this.primaryScreenPanel, 0, 0, 1440, 900); this.primaryScreenPanel.TabIndex = 0; this.primaryScreenPanel.BorderStyle = BorderStyle.None; this.primaryScreenPanel.BackColor = System.Drawing.Color.Black; ResizeAndPositionControl(this.videoPanel, 0, 0, 1200, 900); this.videoPanel.TabIndex = 0; this.videoPanel.BorderStyle = BorderStyle.None; this.videoPanel.BackColor = System.Drawing.Color.Black; var data=LoadBtnConfigData(); // 同步畫面 服務鈴 ConfigureButton(this.syncServiceBellButton, 1240, 17, 161, 161, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["ServiceBell"])), //(sender, e) => SendCommandThroughSerialPort("a2 53 a4")); (sender,e)=>OnServiceBellButtonClick(sender,e)); ConfigureButton(this.syncCutSongButton, 1218, 195, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["CutSong"])), (sender, e) => videoPlayerForm.PlayNextSong()); ConfigureButton(this.syncReplayButton, 1218, 265, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Replay"])), ReplayButton_Click); // 有人聲入口位置 ConfigureButton(this.syncOriginalSongButton, 1218, 335, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Original"])), (sender,e) => videoPlayerForm.ToggleVocalRemoval()); ConfigureButton(this.syncMuteButton, 1218, 406, 205, 55, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Mute"])), MuteUnmuteButton_Click); ConfigureButton(this.syncPauseButton, 1218, 475, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Stop"])), SyncPauseButton_Click); ConfigureButton(this.syncPlayButton, 1218, 475, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Play"])), SyncPlayButton_Click); ConfigureButton(this.syncVolumeUpButton, 1218, 546, 205, 55, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolGain"])), null); this.syncVolumeUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↑ ","a2 b3 a4"); }; ConfigureButton(this.syncVolumeDownButton, 1218, 616, 205, 55, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MusicVolDown"])), null); this.syncVolumeDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("音量 ↓ ","a2 b4 a4");}; ConfigureButton(this.syncMicUpButton, 1218, 686, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolGain"])), null); this.syncMicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↑ ","a2 b5 a4");}; ConfigureButton(this.syncMicDownButton, 1218, 756, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["MicVolDown"])), null); this.syncMicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabelTime("麥克風 ↓ ","a2 b6 a4");}; ConfigureButton(this.syncCloseButton, 1218, 826, 205, 56, new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])), new Bitmap(Path.Combine(serverPath, data["SyncScreen"]["Close"])), SyncCloseButton_Click); this.ClientSize = new System.Drawing.Size(1440, 900); this.Controls.Add(this.primaryScreenPanel); this.primaryScreenPanel.Controls.Add(this.videoPanel); videoPanel.Controls.Add(videoView0); this.Controls.Add(this.syncCloseButton); this.Name = "PrimaryForm"; this.ResumeLayout(false); } private void SyncPauseButton_Click(object sender, EventArgs e) { videoPlayerForm.Pause(); syncPauseButton.Visible = false; syncPlayButton.Visible = true; syncPlayButton.BringToFront(); pauseButton.Visible = false; playButton.Visible = true; } private void SyncPlayButton_Click(object sender, EventArgs e) { videoPlayerForm.Play(); syncPauseButton.Visible = true; syncPauseButton.BringToFront(); syncPlayButton.Visible = false; pauseButton.Visible = true; playButton.Visible = false; } private void SyncCloseButton_Click(object sender, EventArgs e) { VideoPlayerForm.Instance.ClosePrimaryScreenPanel(); } private void SyncScreenButton_Click(object sender, EventArgs e) { videoPlayerForm.IsSyncToPrimaryMonitor = true; videoPlayerForm.SyncToPrimaryMonitor(); } } }