PrimaryForm 按鍵設定代碼清理重構

This commit is contained in:
allen.yan 2025-08-06 15:30:29 +08:00
parent 9ae5cf827a
commit 5deeb7843c

View File

@ -992,6 +992,8 @@ namespace DualScreenDemo
this.Controls.Add(button); this.Controls.Add(button);
} }
#region
private void InitializeOtherControls() private void InitializeOtherControls()
{ {
InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(未按).png", NewSongAlertButton_Click); InitializeButton(ref newSongAlertButton, ref newSongAlertNormalBackground, ref newSongAlertActiveBackground, "newSongAlertButton", 20, 98, 105, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_新歌快報(未按).png", NewSongAlertButton_Click);
@ -1008,26 +1010,13 @@ namespace DualScreenDemo
InitializeButton(ref categorySearchButton, ref categorySearchNormalBackground, ref categorySearchActiveBackground, "categorySearchButton", 726, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png", CategorySearchButton_Click); InitializeButton(ref categorySearchButton, ref categorySearchNormalBackground, ref categorySearchActiveBackground, "categorySearchButton", 726, 98, 106, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_類別查詢(未按).png", CategorySearchButton_Click);
Bitmap serviceBell = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png"));
Bitmap serviceBellHover = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png"));
//serviceBellButton = new Button { Text = "" };
//serviceBellButton.Name = "serviceBellButton";
//ConfigureButton(serviceBellButton, 848, 96, 101, 102,
// resizedMouseOverImage, resizedMouseOverImage, resizedMouseDownImage,
// (sender, e) => OnServiceBellButtonClick(sender, e));
//this.Controls.Add(serviceBellButton);
Rectangle serviceBellButtonCropArea = new Rectangle(843, 98, 107, 120); serviceBellButton = new Button { Text = "" };
InitializeButton( ConfigureButton(serviceBellButton, 843, 98, 107, 120,
ref serviceBellButton, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")),
"serviceBellButton", new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(未按).png")),
843, 98, 107, 120, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_服務鈴(已按).png")),
serviceBellButtonCropArea, (sender, e) => OnServiceBellButtonClick(sender, e));
serviceBell,
(sender, e) => OnServiceBellButtonClick(sender, e)
);
serviceBellButton.MouseEnter += (sender, e) => serviceBellButton.BackgroundImage = serviceBellHover;
serviceBellButton.MouseLeave += (sender, e) => serviceBellButton.BackgroundImage = serviceBell;
InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 961, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(未按).png", OrderedSongsButton_Click); InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 961, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_已點歌曲(未按).png", OrderedSongsButton_Click);
@ -1038,404 +1027,235 @@ namespace DualScreenDemo
InitializeButton(ref deliciousFoodButton, ref deliciousFoodNormalBackground, ref deliciousFoodActiveBackground, "deliciousFoodButton", 1315, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(未按).png", DeliciousFoodButton_Click); InitializeButton(ref deliciousFoodButton, ref deliciousFoodNormalBackground, ref deliciousFoodActiveBackground, "deliciousFoodButton", 1315, 98, 107, 120, "themes\\superstar\\button\\1.主類別\\主類別上方_美味菜單(未按).png", DeliciousFoodButton_Click);
//mobileSongRequestButton = new Button { Text = "" };
//mobileSongRequestButton.Name = "mobileSongRequestButton";
//ConfigureButton(mobileSongRequestButton, 1211, 669, 210, 70,
// resizedNormalStateImage, resizedMouseOverImage, resizedMouseDownImage,
// MobileSongRequestButton_Click);
Bitmap mobileSongRequest = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")); mobileSongRequestButton = new Button { Text = "" };
mobileSongRequestButton.Name = "mobileSongRequestButton";
Rectangle mobileSongRequestButtonCropArea = new Rectangle(1198, 629, 223, 88); ConfigureButton(mobileSongRequestButton, 1198, 629, 223, 88,
InitializeButton( new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")),
ref mobileSongRequestButton, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")),
"mobileSongRequestButton", new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別上方_手機點歌.png")),
1198, 629, 223, 88, MobileSongRequestButton_Click);
mobileSongRequestButtonCropArea,
mobileSongRequest,
MobileSongRequestButton_Click
);
Bitmap qieGe=new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")); qieGeButton = new Button { Text = "" };
qieGeButton.Name = "qieGeButton";
ConfigureButton(qieGeButton, 20, 738, 92, 147,
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_切歌.png")),
(sender, e) => videoPlayerForm.PlayNextSong());
Rectangle qieGeButtonCropArea = new Rectangle(20, 738, 92, 147);
InitializeButton(
ref qieGeButton,
"qieGeButton",
20, 738, 92, 147,
qieGeButtonCropArea,
qieGe,
(sender, e) => videoPlayerForm.PlayNextSong()
);
this.Controls.Add(qieGeButton);
musicUpButton = new Button { Text = "" }; musicUpButton = new Button { Text = "" };
musicUpButton.Name = "musicUpButton"; musicUpButton.Name = "musicUpButton";
ResizeAndPositionButton(musicUpButton, 128, 738, 93, 62); ConfigureButton(musicUpButton, 128, 738, 93, 62,
Rectangle musicUpButtonCropArea = new Rectangle(128, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")),
//musicUpButton.BackgroundImage = normalStateImage.Clone(musicUpButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")),
musicUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂++.png")),
//musicUpButton.BackColor = Color.Transparent; (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑", "a2 b3 a4"); });
musicUpButton.BackgroundImageLayout = ImageLayout.Stretch;
musicUpButton.FlatStyle = FlatStyle.Flat;
musicUpButton.FlatAppearance.BorderSize = 0;
//musicUpButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//musicUpButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
musicUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↑","a2 b3 a4"); };
musicUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
musicUpButton.MouseLeave += (sender, e) => musicUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂+.png"));
musicUpButton.MouseDown += (sender, e) => musicUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂++.png"));
this.Controls.Add(musicUpButton);
musicDownButton = new Button { Text = "" }; musicDownButton = new Button { Text = "" };
musicDownButton.Name = "musicDownButton"; musicDownButton.Name = "musicDownButton";
ResizeAndPositionButton(musicDownButton, 128, 823, 93, 62); ConfigureButton(musicDownButton, 128, 823, 93, 62,
Rectangle musicDownButtonCropArea = new Rectangle(128, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")),
//musicDownButton.BackgroundImage = normalStateImage.Clone(musicDownButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")),
musicDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂--.png")),
//musicDownButton.BackColor = Color.Transparent; (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓", "a2 b4 a4"); });
musicDownButton.BackgroundImageLayout = ImageLayout.Stretch;
musicDownButton.FlatStyle = FlatStyle.Flat;
musicDownButton.FlatAppearance.BorderSize = 0;
//musicDownButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//musicDownButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
musicDownButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("音量 ↓","a2 b4 a4"); };
musicDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
musicDownButton.MouseLeave += (sender, e) => musicDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音樂-.png"));
musicDownButton.MouseDown += (sender, e) => musicDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_音樂--.png"));
this.Controls.Add(musicDownButton);
micUpButton = new Button { Text = "" }; micUpButton = new Button { Text = "" };
micUpButton.Name = "micUpButton"; micUpButton.Name = "micUpButton";
ResizeAndPositionButton(micUpButton, 238, 738, 93, 62); ConfigureButton(micUpButton, 238, 738, 93, 62,
Rectangle micUpButtonCropArea = new Rectangle(238, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")),
//micUpButton.BackgroundImage = normalStateImage.Clone(micUpButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")),
micUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風++.png")),
//micUpButton.BackColor = Color.Transparent; (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑", "a2 b5 a4"); });
micUpButton.BackgroundImageLayout = ImageLayout.Stretch;
micUpButton.FlatStyle = FlatStyle.Flat;
micUpButton.FlatAppearance.BorderSize = 0;
//micUpButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//micUpButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
micUpButton.MouseDown += (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↑","a2 b5 a4"); };
micUpButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
micUpButton.MouseLeave += (sender, e) => micUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風+.png"));
micUpButton.MouseDown += (sender, e) => micUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風++.png"));
this.Controls.Add(micUpButton);
micDownButton = new Button { Text = "" }; micDownButton = new Button { Text = "" };
micDownButton.Name = "micDownButton"; micDownButton.Name = "micDownButton";
ResizeAndPositionButton(micDownButton, 238, 823, 93, 62); ConfigureButton(micDownButton, 238, 823, 93, 62,
Rectangle micDownButtonCropArea = new Rectangle(238, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")),
//micDownButton.BackgroundImage = normalStateImage.Clone(micDownButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")),
micDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風--.png")),
//micDownButton.BackColor = Color.Transparent; (sender, e) => { OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓", "a2 b6 a4"); });
micDownButton.BackgroundImageLayout = ImageLayout.Stretch;
micDownButton.FlatStyle = FlatStyle.Flat;
micDownButton.FlatAppearance.BorderSize = 0;
//micDownButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//micDownButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
micDownButton.MouseDown += (sender, e) =>{ OverlayForm.MainForm.ShowTopRightLabel("麥克風 ↓","a2 b6 a4"); };
micDownButton.MouseUp += (sender, e) => { OverlayForm.MainForm.RedisplayTopRigthLabel(); };
micDownButton.MouseLeave += (sender, e) => micDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_麥克風-.png"));
micDownButton.MouseDown += (sender, e) => micDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\音樂及麥克風icon_麥克風--.png"));
this.Controls.Add(micDownButton);
originalSongButton = new Button { Text = "" }; originalSongButton = new Button { Text = "" };
originalSongButton.Name = "originalSongButton"; originalSongButton.Name = "originalSongButton";
ResizeAndPositionButton(originalSongButton, 347, 738, 93, 62); ConfigureButton(originalSongButton, 347, 738, 93, 62,
Rectangle originalSongButtonCropArea = new Rectangle(347, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")),
//originalSongButton.BackgroundImage = normalStateImage.Clone(originalSongButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")),
originalSongButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_原唱.png")),
//originalSongButton.BackColor = Color.Transparent; OriginalSongButton_Click);
originalSongButton.BackgroundImageLayout = ImageLayout.Stretch;
originalSongButton.FlatStyle = FlatStyle.Flat;
originalSongButton.FlatAppearance.BorderSize = 0;
//originalSongButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//originalSongButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
originalSongButton.Click += OriginalSongButton_Click;
this.Controls.Add(originalSongButton);
replayButton = new Button { Text = "" }; replayButton = new Button { Text = "" };
replayButton.Name = "replayButton"; replayButton.Name = "replayButton";
ResizeAndPositionButton(replayButton, 347, 823, 93, 62); ConfigureButton(replayButton, 347, 823, 93, 62,
Rectangle replayButtonCropArea = new Rectangle(347, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")),
//replayButton.BackgroundImage = normalStateImage.Clone(replayButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")),
replayButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_重唱.png")),
//replayButton.BackColor = Color.Transparent; ReplayButton_Click);
replayButton.BackgroundImageLayout = ImageLayout.Stretch;
replayButton.FlatStyle = FlatStyle.Flat;
replayButton.FlatAppearance.BorderSize = 0;
//replayButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//replayButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
replayButton.Click += ReplayButton_Click;
this.Controls.Add(replayButton);
pauseButton = new Button{ pauseButton = new Button{
Text = "", Text = "",
Name = "pauseButton" Name = "pauseButton" };
}; ConfigureButton(pauseButton, 456, 738, 93, 62,
ResizeAndPositionButton(pauseButton, 456, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
Rectangle pauseButtonCropArea = new Rectangle(456, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
//pauseButton.BackgroundImage = normalStateImage.Clone(pauseButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
pauseButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")); PauseButton_Click);
//pauseButton.BackColor = Color.Transparent;
pauseButton.BackgroundImageLayout = ImageLayout.Stretch;
pauseButton.FlatStyle = FlatStyle.Flat;
pauseButton.FlatAppearance.BorderSize = 0;
//pauseButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//pauseButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
pauseButton.Click += PauseButton_Click;
this.Controls.Add(pauseButton);
playButton = new Button { playButton = new Button
{
Text = "", Text = "",
Name = "playButton", Name = "playButton",
Visible = false Visible = false
}; };
ResizeAndPositionButton(playButton, 456, 738, 93, 62); ConfigureButton(playButton, 456, 738, 93, 62,
Rectangle playButtonCropArea = new Rectangle(456, 740, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
//playButton.BackgroundImage = normalStateImage.Clone(playButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
playButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_暫停.png")),
//playButton.BackColor = Color.Transparent; PlayButton_Click);
playButton.BackgroundImageLayout = ImageLayout.Stretch;
playButton.FlatStyle = FlatStyle.Flat;
playButton.FlatAppearance.BorderSize = 0;
//playButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//playButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
playButton.Click += PlayButton_Click;
this.Controls.Add(playButton);
muteButton = new Button { Text = "" }; muteButton = new Button { Text = "" };
muteButton.Name = "muteButton"; muteButton.Name = "muteButton";
ResizeAndPositionButton(muteButton, 456, 823, 93, 62); ConfigureButton(muteButton, 456, 823, 93, 62,
Rectangle muteButtonCropArea = new Rectangle(456, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")),
//muteButton.BackgroundImage = normalStateImage.Clone(muteButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")),
muteButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_靜音.png")),
//muteButton.BackColor = Color.Transparent; MuteUnmuteButton_Click);
muteButton.BackgroundImageLayout = ImageLayout.Stretch;
muteButton.FlatStyle = FlatStyle.Flat;
muteButton.FlatAppearance.BorderSize = 0;
//muteButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//muteButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
muteButton.Click += MuteUnmuteButton_Click;
this.Controls.Add(muteButton);
maleKeyButton = new Button { Text = "" }; maleKeyButton = new Button { Text = "" };
maleKeyButton.Name = "maleKeyButton"; maleKeyButton.Name = "maleKeyButton";
ResizeAndPositionButton(maleKeyButton, 564, 738, 93, 62); ConfigureButton(maleKeyButton, 564, 738, 93, 62,
Rectangle maleKeyButtonCropArea = new Rectangle(564, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
//maleKeyButton.BackgroundImage = normalStateImage.Clone(maleKeyButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
maleKeyButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_男調.png")),
//maleKeyButton.BackColor = Color.Transparent; MaleKeyButton_Click);
maleKeyButton.BackgroundImageLayout = ImageLayout.Stretch;
maleKeyButton.FlatStyle = FlatStyle.Flat;
maleKeyButton.Click += MaleKeyButton_Click;
maleKeyButton.FlatAppearance.BorderSize = 0;
//maleKeyButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//maleKeyButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
this.Controls.Add(maleKeyButton);
femaleKeyButton = new Button { Text = "" }; femaleKeyButton = new Button { Text = "" };
femaleKeyButton.Name = "femaleKeyButton"; femaleKeyButton.Name = "femaleKeyButton";
ResizeAndPositionButton(femaleKeyButton, 565, 823, 93, 62); ConfigureButton(femaleKeyButton, 565, 823, 93, 62,
Rectangle femaleKeyButtonCropArea = new Rectangle(565, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")),
//femaleKeyButton.BackgroundImage = normalStateImage.Clone(femaleKeyButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")),
femaleKeyButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_女調.png")),
//femaleKeyButton.BackColor = Color.Transparent; FemaleKeyButton_Click);
femaleKeyButton.BackgroundImageLayout = ImageLayout.Stretch;
femaleKeyButton.FlatStyle = FlatStyle.Flat;
femaleKeyButton.FlatAppearance.BorderSize = 0;
//femaleKeyButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//femaleKeyButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
femaleKeyButton.Click += FemaleKeyButton_Click;
this.Controls.Add(femaleKeyButton);
standardKeyButton = new Button { Text = "" }; standardKeyButton = new Button { Text = "" };
standardKeyButton.Name = "standardKeyButton"; standardKeyButton.Name = "standardKeyButton";
ResizeAndPositionButton(standardKeyButton, 674, 738, 93, 62); ConfigureButton(standardKeyButton, 674, 738, 93, 62,
Rectangle standardKeyButtonCropArea = new Rectangle(674, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")),
//standardKeyButton.BackgroundImage = normalStateImage.Clone(standardKeyButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")),
standardKeyButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_標準調.png")),
//standardKeyButton.BackColor = Color.Transparent; StandardKeyButton_Click);
standardKeyButton.BackgroundImageLayout = ImageLayout.Stretch;
standardKeyButton.FlatStyle = FlatStyle.Flat;
standardKeyButton.FlatAppearance.BorderSize = 0;
//standardKeyButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//standardKeyButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
standardKeyButton.Click += StandardKeyButton_Click;
this.Controls.Add(standardKeyButton);
soundEffectButton = new Button { Text = "" }; soundEffectButton = new Button { Text = "" };
soundEffectButton.Name = "soundEffectButton"; soundEffectButton.Name = "soundEffectButton";
ResizeAndPositionButton(soundEffectButton, 674, 823, 93, 62); ConfigureButton(soundEffectButton, 674, 823, 93, 62,
Rectangle soundEffectButtonCropArea = new Rectangle(674, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")),
//soundEffectButton.BackgroundImage = normalStateImage.Clone(soundEffectButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")),
soundEffectButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_音效.png")),
//soundEffectButton.BackColor = Color.Transparent; SoundEffectButton_Click);
soundEffectButton.BackgroundImageLayout = ImageLayout.Stretch;
soundEffectButton.FlatStyle = FlatStyle.Flat;
soundEffectButton.FlatAppearance.BorderSize = 0;
//soundEffectButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//soundEffectButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
soundEffectButton.Click += SoundEffectButton_Click;
this.Controls.Add(soundEffectButton);
pitchUpButton = new Button { Text = "" }; pitchUpButton = new Button { Text = "" };
pitchUpButton.Name = "pitchUpButton"; pitchUpButton.Name = "pitchUpButton";
ResizeAndPositionButton(pitchUpButton, 784, 738, 93, 62); ConfigureButton(pitchUpButton, 784, 738, 93, 62,
Rectangle pitchUpButtonCropArea = new Rectangle(784, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")),
//pitchUpButton.BackgroundImage = normalStateImage.Clone(pitchUpButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")),
pitchUpButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_升調.png")),
//pitchUpButton.BackColor = Color.Transparent; PitchUpButton_Click);
pitchUpButton.BackgroundImageLayout = ImageLayout.Stretch;
pitchUpButton.FlatStyle = FlatStyle.Flat;
pitchUpButton.FlatAppearance.BorderSize = 0;
//pitchUpButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//pitchUpButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
pitchUpButton.Click += PitchUpButton_Click;
this.Controls.Add(pitchUpButton);
pitchDownButton = new Button { Text = "" }; pitchDownButton = new Button { Text = "" };
pitchDownButton.Name = "pitchDownButton"; pitchDownButton.Name = "pitchDownButton";
ResizeAndPositionButton(pitchDownButton, 784, 823, 93, 62); ConfigureButton(pitchDownButton, 784, 823, 93, 62,
Rectangle pitchDownButtonCropArea = new Rectangle(784, 823, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")),
//pitchDownButton.BackgroundImage = normalStateImage.Clone(pitchDownButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")),
pitchDownButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_降調.png")),
//pitchDownButton.BackColor = Color.Transparent; PitchDownButton_Click);
pitchDownButton.BackgroundImageLayout = ImageLayout.Stretch;
pitchDownButton.FlatStyle = FlatStyle.Flat;
pitchDownButton.FlatAppearance.BorderSize = 0;
//pitchDownButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//pitchDownButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
pitchDownButton.Click += PitchDownButton_Click;
this.Controls.Add(pitchDownButton);
syncScreenButton = new Button { Text = "" }; syncScreenButton = new Button { Text = "" };
syncScreenButton.Name = "syncScreenButton"; syncScreenButton.Name = "syncScreenButton";
ResizeAndPositionButton(syncScreenButton, 893, 736, 92, 149); ConfigureButton(syncScreenButton, 893, 736, 92, 149,
Rectangle syncScreenButtonCropArea = new Rectangle(893, 736, 92, 149); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")),
//syncScreenButton.BackgroundImage = normalStateImage.Clone(syncScreenButtonCropArea, normalStateImage.PixelFormat); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")),
syncScreenButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_同步畫面.png")),
//syncScreenButton.BackColor = Color.Transparent; SyncScreenButton_Click);
syncScreenButton.BackgroundImageLayout = ImageLayout.Stretch;
syncScreenButton.FlatStyle = FlatStyle.Flat;
syncScreenButton.FlatAppearance.BorderSize = 0;
//syncScreenButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//syncScreenButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
syncScreenButton.Click += SyncScreenButton_Click;
this.Controls.Add(syncScreenButton);
toggleLightButton = new Button { Text = "" }; toggleLightButton = new Button { Text = "" };
toggleLightButton.Name = "toggleLightButton"; toggleLightButton.Name = "toggleLightButton";
ConfigureButton(toggleLightButton, 1002, 736, 92, 149,
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png")),
ToggleLightButton_Click);
ResizeAndPositionButton(toggleLightButton, 1002, 736, 92, 149);
Rectangle toggleLightButtonCropArea = new Rectangle(1002, 736, 92, 149);
//toggleLightButton.BackgroundImage = normalStateImage.Clone(toggleLightButtonCropArea, normalStateImage.PixelFormat);
toggleLightButton.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_燈光控制.png"));
//toggleLightButton.BackColor = Color.Transparent;
toggleLightButton.BackgroundImageLayout = ImageLayout.Stretch;
toggleLightButton.FlatStyle = FlatStyle.Flat;
toggleLightButton.FlatAppearance.BorderSize = 0;
//toggleLightButton.FlatAppearance.MouseOverBackColor = Color.Transparent;
//toggleLightButton.FlatAppearance.MouseDownBackColor = Color.Transparent;
toggleLightButton.Click += ToggleLightButton_Click;
this.Controls.Add(toggleLightButton); btnPreviousPage = new Button { Text = "" };
btnPreviousPage.Name = "btnPreviousPageButton";
Bitmap PPage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")); ConfigureButton(btnPreviousPage, 1110, 738, 93, 62,
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")),
Rectangle previousPageButtonCropArea = new Rectangle(1110, 738, 93, 62); new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")),
InitializeButton( new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_上一頁.png")),
ref btnPreviousPage, PreviousPageButton_Click);
"btnPreviousPage",
1111, 738, 93, 62,
previousPageButtonCropArea,
PPage,
PreviousPageButton_Click
);
btnReturn = new Button { Text = "" }; btnReturn = new Button { Text = "" };
btnReturn.Name = "btnReturn"; btnReturn.Name = "btnReturn";
ConfigureButton(btnReturn, 1220, 738, 93, 62,
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png")),
ShouYeButton_Click);
ResizeAndPositionButton(btnReturn, 1220, 738, 93, 62);
Rectangle returnButtonCropArea = new Rectangle(1220, 738, 93, 62);
//btnReturn.BackgroundImage = normalStateImage.Clone(returnButtonCropArea, normalStateImage.PixelFormat);
btnReturn.BackgroundImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_退出.png"));
//btnReturn.BackColor = Color.Transparent;
btnReturn.BackgroundImageLayout = ImageLayout.Stretch;
btnReturn.FlatStyle = FlatStyle.Flat;
btnReturn.FlatAppearance.BorderSize = 0;
//btnReturn.FlatAppearance.MouseOverBackColor = Color.Transparent;
//btnReturn.FlatAppearance.MouseDownBackColor = Color.Transparent;
btnReturn.Click += ShouYeButton_Click;
this.Controls.Add(btnReturn); btnNextPage = new Button { Text = "" };
btnNextPage.Name = "btnNextPage";
ConfigureButton(btnNextPage, 1330, 738, 93, 62,
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")),
new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png")),
NextPageButton_Click);
Bitmap NPage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_下一頁.png"));
Rectangle nextPageButtonCropArea = new Rectangle(1330, 738, 93, 62); btnApplause = new Button { Text = "" };
InitializeButton( btnApplause.Name = "btnApplause";
ref btnNextPage, ConfigureButton(btnApplause, 1110, 823, 93, 62,
"btnNextPage", new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
1330, 738, 93, 62, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
nextPageButtonCropArea, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png")),
NPage, ApplauseButton_Click);
NextPageButton_Click
);
Bitmap aPPaulse = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_掌聲.png"));
Rectangle applauseButtonCropArea = new Rectangle(1110, 823, 93, 62); btnSimplifiedChinese = new Button { Text = "" };
InitializeButton( btnSimplifiedChinese.Name = "btnSimplifiedChinese";
ref btnApplause, ConfigureButton(btnSimplifiedChinese, 1330, 823, 93, 62,
"btnApplause", new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")),
1110, 823, 93, 62, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")),
applauseButtonCropArea, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png")),
aPPaulse, SimplifiedChineseButton_Click);
ApplauseButton_Click
);
Bitmap SChinese = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_簡體.png"));
Rectangle simplifiedChineseButtonCropArea = new Rectangle(1330, 823, 93, 62); btnTraditionalChinese = new Button { Text = "" };
InitializeButton( btnTraditionalChinese.Name = "btnTraditionalChinese";
ref btnSimplifiedChinese, ConfigureButton(btnTraditionalChinese, 1220, 823, 93, 62,
"btnSimplifiedChinese", new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")),
1330, 823, 93, 62, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")),
simplifiedChineseButtonCropArea, new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png")),
SChinese, TraditionalChineseButton_Click);
SimplifiedChineseButton_Click
);
Bitmap bTChinese = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\button\\1.主類別\\主類別下方_繁體.png"));
Rectangle traditionalChineseButtonCropArea = new Rectangle(1220, 823, 93, 62);
InitializeButton(
ref btnTraditionalChinese,
"btnTraditionalChinese",
1220, 823, 93, 62,
traditionalChineseButtonCropArea,
bTChinese,
TraditionalChineseButton_Click
);
/* 關閉應用程式按鈕*/ /* 關閉應用程式按鈕*/
exitButton = new Button { }; exitButton = new Button { };
@ -1444,6 +1264,8 @@ namespace DualScreenDemo
resizedNormalStateImage, resizedMouseOverImage, resizedMouseDownImage, resizedNormalStateImage, resizedMouseOverImage, resizedMouseDownImage,
(sender, e) => Application.Exit());*/ (sender, e) => Application.Exit());*/
} }
#endregion
private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, EventHandler clickEventHandler) private void InitializeButton(ref Button button, ref Bitmap normalBackground, ref Bitmap activeBackground, string buttonName, int x, int y, int width, int height, string imagePath, EventHandler clickEventHandler)
{ {
@ -2182,7 +2004,8 @@ namespace DualScreenDemo
}; };
// 初始化服務鈴圖標 // 初始化服務鈴圖標
serviceBellPictureBox = new PictureBox { serviceBellPictureBox = new PictureBox
{
Visible = true, Visible = true,
BackColor = Color.Transparent, BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage, SizeMode = PictureBoxSizeMode.StretchImage,
@ -2191,7 +2014,8 @@ namespace DualScreenDemo
}; };
// 添加服務鈴點擊事件 // 添加服務鈴點擊事件
serviceBellPictureBox.Click += (sender, e) => { serviceBellPictureBox.Click += (sender, e) =>
{
if (serviceBellButton != null) if (serviceBellButton != null)
{ {
OnServiceBellButtonClick(sender, e); OnServiceBellButtonClick(sender, e);
@ -2199,7 +2023,8 @@ namespace DualScreenDemo
}; };
// 使用 PictureBox 並加載小圖片 // 使用 PictureBox 並加載小圖片
buttonMiddle = new PictureBox { buttonMiddle = new PictureBox
{
Visible = true, Visible = true,
BackColor = Color.Transparent, BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage, SizeMode = PictureBoxSizeMode.StretchImage,
@ -2207,7 +2032,8 @@ namespace DualScreenDemo
Cursor = System.Windows.Forms.Cursors.Hand Cursor = System.Windows.Forms.Cursors.Hand
}; };
buttonTopRight = new PictureBox { buttonTopRight = new PictureBox
{
Visible = true, Visible = true,
BackColor = Color.Transparent, BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage, SizeMode = PictureBoxSizeMode.StretchImage,
@ -2215,7 +2041,8 @@ namespace DualScreenDemo
Cursor = System.Windows.Forms.Cursors.Hand Cursor = System.Windows.Forms.Cursors.Hand
}; };
buttonTopLeft = new PictureBox { buttonTopLeft = new PictureBox
{
Visible = true, Visible = true,
BackColor = Color.Transparent, BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage, SizeMode = PictureBoxSizeMode.StretchImage,
@ -2223,7 +2050,8 @@ namespace DualScreenDemo
Cursor = System.Windows.Forms.Cursors.Hand Cursor = System.Windows.Forms.Cursors.Hand
}; };
buttonThanks = new PictureBox { buttonThanks = new PictureBox
{
Visible = true, Visible = true,
BackColor = Color.Transparent, BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage, SizeMode = PictureBoxSizeMode.StretchImage,
@ -2258,7 +2086,8 @@ namespace DualScreenDemo
buttonThanks.BringToFront(); buttonThanks.BringToFront();
// 重新計算按鈕位置 // 重新計算按鈕位置
sendOffPanel.Resize += (s, e) => { sendOffPanel.Resize += (s, e) =>
{
UpdateSendOffButtonPositions(); UpdateSendOffButtonPositions();
sendOffPanel.Invalidate(); // 重新繪製面板以更新顯示 sendOffPanel.Invalidate(); // 重新繪製面板以更新顯示
}; };
@ -2269,7 +2098,8 @@ namespace DualScreenDemo
/// 動態按鈕座標位置設定(依據螢幕大小) /// 動態按鈕座標位置設定(依據螢幕大小)
/// </summary> /// </summary>
private void UpdateSendOffButtonPositions() private void UpdateSendOffButtonPositions()
{ Size designSize = new Size(1920, 1080); {
Size designSize = new Size(1920, 1080);
var panelWidth = sendOffPanel.Width; var panelWidth = sendOffPanel.Width;
var panelHeight = sendOffPanel.Height; var panelHeight = sendOffPanel.Height;