diff --git a/PrimaryFormParts/PrimaryForm.QRCode.cs b/PrimaryFormParts/PrimaryForm.QRCode.cs index 734ae3f..9c5287c 100644 --- a/PrimaryFormParts/PrimaryForm.QRCode.cs +++ b/PrimaryFormParts/PrimaryForm.QRCode.cs @@ -15,7 +15,7 @@ namespace DualScreenDemo try { - string imagePath = Path.Combine(Application.StartupPath, "themes/superstar/cropped_qrcode.jpg"); + string imagePath = Path.Combine(Application.StartupPath, "themes/superstar/cropped_qrcode.png"); if (!File.Exists(imagePath)) { Console.WriteLine("Base image not found: " + imagePath); @@ -81,7 +81,7 @@ namespace DualScreenDemo using (Graphics g = Graphics.FromImage(bitmap)) { - g.DrawImage(baseImage, 0, 0); + g.DrawImage(baseImage, new Rectangle(0, 0, bitmap.Width, bitmap.Height)); @@ -97,10 +97,10 @@ namespace DualScreenDemo } - ResizeAndPositionControl(pictureBoxQRCode, 975, 442, 226, 274); + ResizeAndPositionControl(pictureBoxQRCode, 975, 442, 225, 280); - Bitmap originalImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\cropped_qrcode.jpg")); + Bitmap originalImage = new Bitmap(Path.Combine(Application.StartupPath, "themes\\superstar\\cropped_qrcode.png")); Rectangle closeQRCodeCropArea = new Rectangle(198, 6, 22, 22); diff --git a/PrimaryFormParts/PrimaryForm.SoundEffects.cs b/PrimaryFormParts/PrimaryForm.SoundEffects.cs index c97d41b..e38ba0e 100644 --- a/PrimaryFormParts/PrimaryForm.SoundEffects.cs +++ b/PrimaryFormParts/PrimaryForm.SoundEffects.cs @@ -25,6 +25,28 @@ namespace DualScreenDemo { mediaPlayer = new WindowsMediaPlayer(); } + private void ConfigureImageButton(Button button, int posX, int posY, int width, int height, + string imagePath, EventHandler clickEventHandler) + { + Bitmap image = new Bitmap(imagePath); + button.SetBounds(posX, posY, image.Width, image.Height); + + // 載入圖片 + button.BackgroundImage = image; + button.BackgroundImageLayout = ImageLayout.Stretch; + + // 按鈕樣式設定 + button.FlatStyle = FlatStyle.Flat; + button.FlatAppearance.BorderSize = 0; + button.FlatAppearance.MouseDownBackColor = Color.Transparent; + button.FlatAppearance.MouseOverBackColor = Color.Transparent; + + // 點擊事件 + if (clickEventHandler != null) + button.Click += clickEventHandler; + + this.Controls.Add(button); + } private void InitializeSoundEffectButtons() { @@ -33,9 +55,9 @@ namespace DualScreenDemo { Name = "constructionButton", }; - ConfigureButton(constructionButton, 876, 494, 148, 64, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - ConstructionButton_Click); + string path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_工地.png"); + ConfigureImageButton(constructionButton, 1183, 634, 148, 64, + path, ConstructionButton_Click); this.Controls.Add(constructionButton); @@ -43,9 +65,9 @@ namespace DualScreenDemo { Name = "marketButton", }; - ConfigureButton(marketButton, 1037, 495, 148, 63, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - MarketButton_Click); + path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_市場.png"); + ConfigureImageButton(marketButton, 1394, 634, 148, 63, + path, MarketButton_Click); this.Controls.Add(marketButton); @@ -53,9 +75,9 @@ namespace DualScreenDemo { Name = "drivingButton", }; - ConfigureButton(drivingButton, 876, 570, 148, 63, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - DrivingButton_Click); + path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_開車.png"); + ConfigureImageButton(drivingButton, 1183, 720, 148, 63, + path, DrivingButton_Click); this.Controls.Add(drivingButton); @@ -63,9 +85,9 @@ namespace DualScreenDemo { Name = "airportButton", }; - ConfigureButton(airportButton, 1037, 570, 148, 63, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - AirportButton_Click); + path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_機場.png"); + ConfigureImageButton(airportButton, 1394, 720, 148, 63, + path, AirportButton_Click); this.Controls.Add(airportButton); @@ -73,9 +95,9 @@ namespace DualScreenDemo { Name = "officeButton", }; - ConfigureButton(officeButton, 876, 646, 148, 64, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - OfficeButton_Click); + path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_辦公室.png"); + ConfigureImageButton(officeButton, 1183, 806, 148, 64, + path, OfficeButton_Click); this.Controls.Add(officeButton); @@ -83,10 +105,9 @@ namespace DualScreenDemo { Name = "closeButton", }; - - ConfigureButton(closeButton, 1036, 646, 150, 63, - resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, resizedNormalStateImageForSceneSoundEffects, - CloseButton_Click); + path = Path.Combine(Application.StartupPath, @"themes\superstar\場景音效\場景音效_關閉.png"); + ConfigureImageButton(closeButton, 1394, 806, 150, 63, + path, CloseButton_Click); this.Controls.Add(closeButton); } @@ -141,23 +162,7 @@ namespace DualScreenDemo // 按鈕位置需要更改,底圖需要更改 private void ShowImageOnPictureBoxSceneSoundEffects(string imagePath) { - /* - Bitmap originalImage = new Bitmap(imagePath); - - Rectangle cropArea = new Rectangle(859, 427, 342, 295); - - - Bitmap croppedImage = CropImage(originalImage, cropArea); - - - pictureBoxSceneSoundEffects.Image = croppedImage; - - - ResizeAndPositionPictureBox(pictureBoxSceneSoundEffects, cropArea.X, cropArea.Y, cropArea.Width, cropArea.Height); - - pictureBoxSceneSoundEffects.Visible = true; - */ if (File.Exists(imagePath)) { // 直接載入完整圖 @@ -167,7 +172,7 @@ namespace DualScreenDemo pictureBoxSceneSoundEffects.Image = image; // 設定 PictureBox 的大小與位置(依你的需要調整) - ResizeAndPositionPictureBox(pictureBoxSceneSoundEffects, 773, 380, image.Width , image.Height); + ResizeAndPositionPictureBox(pictureBoxSceneSoundEffects, 850, 450, image.Width , image.Height); pictureBoxSceneSoundEffects.Visible = true; } diff --git a/PrimaryFormParts/PrimaryForm.cs b/PrimaryFormParts/PrimaryForm.cs index b65fdd7..96bdac8 100644 --- a/PrimaryFormParts/PrimaryForm.cs +++ b/PrimaryFormParts/PrimaryForm.cs @@ -1303,7 +1303,7 @@ namespace DualScreenDemo this.Controls.Add(serviceBellButton); - InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 966, 97, 100, 99, "themes\\superstar\\ICON上方\\上方ICON_已點歌曲-09.png", OrderedSongsButton_Click); + InitializeButton(ref orderedSongsButton, ref orderedSongsNormalBackground, ref orderedSongsActiveBackground, "orderedSongsButton", 967, 97, 99, 99, "themes\\superstar\\ICON上方\\上方ICON_已點歌曲-09.png", OrderedSongsButton_Click); InitializeButton(ref myFavoritesButton, ref myFavoritesNormalBackground, ref myFavoritesActiveBackground, "myFavoritesButton", 1084, 97, 99, 99, "themes\\superstar\\ICON上方\\上方ICON_我的最愛-10.png", MyFavoritesButton_Click); diff --git a/bin/mainlog.txt b/bin/mainlog.txt index 0c6ef80..f9767b2 100644 --- a/bin/mainlog.txt +++ b/bin/mainlog.txt @@ -119,3 +119,17 @@ 於 DualScreenDemo.PrimaryForm.InitializeFormAndControls() 於 DualScreenDemo.PrimaryForm..ctor() 於 DualScreenDemo.Program.Main() +[2025/5/12 上午 09:23:32] System.OutOfMemoryException: 記憶體不足。 + 於 System.Drawing.Bitmap.Clone(Rectangle rect, PixelFormat format) + 於 DualScreenDemo.PrimaryForm.ConfigureButton(Button button, Int32 posX, Int32 posY, Int32 width, Int32 height, Bitmap normalStateImage, Bitmap mouseOverImage, Bitmap mouseDownImage, EventHandler clickEventHandler) + 於 DualScreenDemo.PrimaryForm.InitializeSoundEffectButtons() + 於 DualScreenDemo.PrimaryForm.InitializeFormAndControls() + 於 DualScreenDemo.PrimaryForm..ctor() + 於 DualScreenDemo.Program.Main() +[2025/5/12 上午 09:28:27] System.OutOfMemoryException: 記憶體不足。 + 於 System.Drawing.Bitmap.Clone(Rectangle rect, PixelFormat format) + 於 DualScreenDemo.PrimaryForm.ConfigureButton(Button button, Int32 posX, Int32 posY, Int32 width, Int32 height, Bitmap normalStateImage, Bitmap mouseOverImage, Bitmap mouseDownImage, EventHandler clickEventHandler) + 於 DualScreenDemo.PrimaryForm.InitializeSoundEffectButtons() + 於 DualScreenDemo.PrimaryForm.InitializeFormAndControls() + 於 DualScreenDemo.PrimaryForm..ctor() + 於 DualScreenDemo.Program.Main() diff --git a/bin/themes/superstar/cropped_qrcode.jpg b/bin/themes/superstar/cropped_qrcode.jpg1 similarity index 100% rename from bin/themes/superstar/cropped_qrcode.jpg rename to bin/themes/superstar/cropped_qrcode.jpg1 diff --git a/bin/themes/superstar/cropped_qrcode.png b/bin/themes/superstar/cropped_qrcode.png new file mode 100644 index 0000000..5c36796 Binary files /dev/null and b/bin/themes/superstar/cropped_qrcode.png differ diff --git a/bin/themes/superstar/toggle_light.jpg b/bin/themes/superstar/toggle_light.jpg deleted file mode 100644 index 058ca07..0000000 Binary files a/bin/themes/superstar/toggle_light.jpg and /dev/null differ diff --git a/bin/themes/superstar/場景音效/場景音效.png b/bin/themes/superstar/場景音效/場景音效.png index 2f994a8..cc8f844 100644 Binary files a/bin/themes/superstar/場景音效/場景音效.png and b/bin/themes/superstar/場景音效/場景音效.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_工地.png b/bin/themes/superstar/場景音效/場景音效_工地.png new file mode 100644 index 0000000..0bb9b65 Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_工地.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_市場.png b/bin/themes/superstar/場景音效/場景音效_市場.png new file mode 100644 index 0000000..9f58c8d Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_市場.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_機場.png b/bin/themes/superstar/場景音效/場景音效_機場.png new file mode 100644 index 0000000..be74195 Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_機場.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_辦公室.png b/bin/themes/superstar/場景音效/場景音效_辦公室.png new file mode 100644 index 0000000..536c871 Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_辦公室.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_開車.png b/bin/themes/superstar/場景音效/場景音效_開車.png new file mode 100644 index 0000000..9df3e8c Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_開車.png differ diff --git a/bin/themes/superstar/場景音效/場景音效_關閉.png b/bin/themes/superstar/場景音效/場景音效_關閉.png new file mode 100644 index 0000000..0a31863 Binary files /dev/null and b/bin/themes/superstar/場景音效/場景音效_關閉.png differ