UI顯示調整(BUG修正)

This commit is contained in:
jasonchenwork 2025-04-17 15:53:19 +08:00
parent 2a329413f4
commit 1cae6f9313
3 changed files with 35 additions and 27 deletions

View File

@ -24,16 +24,16 @@ namespace DualScreenDemo
int[,] coords = new int[,]
{
{799, 508, 70, 65},
{794, 508, 70, 65},
{878, 508, 70, 65},
{957, 508, 70, 65},
{1036, 508, 70, 65},
{1115, 508, 70, 65},
{799, 580, 70, 65},
{962, 508, 70, 65},
{1046, 508, 70, 65},
{1130, 508, 70, 65},
{794, 580, 70, 65},
{878, 580, 70, 65},
{957, 580, 70, 65},
{1036, 580, 70, 65},
{1115, 580, 70, 65}
{962, 580, 70, 65},
{1046, 580, 70, 65},
{1130, 580, 70, 65}
};
int screenW = Screen.PrimaryScreen.Bounds.Width;
@ -84,7 +84,7 @@ namespace DualScreenDemo
{
Name = "enterFavoriteButton"
};
ResizeAndPositionButton(enterFavoriteButton, 842, 662, 70, 65);
ResizeAndPositionButton(enterFavoriteButton, 832, 657, 70, 65);
enterFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛-12.jpg"));
enterFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
enterFavoriteButton.FlatStyle = FlatStyle.Flat;
@ -99,7 +99,7 @@ namespace DualScreenDemo
{
Name = "newFavoriteButton"
};
ResizeAndPositionButton(newFavoriteButton, 921, 662, 70, 65);
ResizeAndPositionButton(newFavoriteButton, 916, 657, 70, 65);
newFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛-13.jpg"));
newFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
newFavoriteButton.FlatStyle = FlatStyle.Flat;
@ -114,7 +114,7 @@ namespace DualScreenDemo
{
Name = "refillFavoriteButton"
};
ResizeAndPositionButton(refillFavoriteButton, 999, 662, 70, 65);
ResizeAndPositionButton(refillFavoriteButton, 999, 657, 70, 65);
refillFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛-14.jpg"));
refillFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
refillFavoriteButton.FlatStyle = FlatStyle.Flat;
@ -129,7 +129,7 @@ namespace DualScreenDemo
{
Name = "closeFavoriteButton"
};
ResizeAndPositionButton(closeFavoriteButton, 1078, 662, 70, 65);
ResizeAndPositionButton(closeFavoriteButton, 1083, 657, 70, 65);
closeFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛-15.jpg"));
closeFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
closeFavoriteButton.FlatStyle = FlatStyle.Flat;
@ -173,11 +173,19 @@ namespace DualScreenDemo
{
if (!string.IsNullOrEmpty(mobileNumber))
{
using (Font font = new Font("Arial", 24))
using (Brush brush = new SolidBrush(Color.Black))
{
int x = 30;
int y = 100;
int screenW = Screen.PrimaryScreen.Bounds.Width;
int screenH = Screen.PrimaryScreen.Bounds.Height;
float widthRatio = screenW / 1920f;
float heightRatio = screenH / 1080f;
// 轉成縮放後的座標
int x = (int)(30 * widthRatio);
int y = (int)(90 * heightRatio);
Font font = new Font("Arial", 24*heightRatio);
if (showError)
{
@ -373,7 +381,7 @@ namespace DualScreenDemo
FavoritePictureBox.Image = image;
// 設定 PictureBox 的大小與位置(依你的需要調整)
ResizeAndPositionPictureBox(FavoritePictureBox, 1084, 445, image.Width, image.Height);
ResizeAndPositionPictureBox(FavoritePictureBox, 773, 380, (int)(image.Width * 0.8f) , (int)(image.Height * 0.8f));
FavoritePictureBox.Visible = true;
}

View File

@ -25,7 +25,7 @@ namespace DualScreenDemo
vodButton = new Button();
vodButton.Text = "";
ResizeAndPositionButton(vodButton, xPosition - 119, yPosition + 40, 110, 50);
ResizeAndPositionButton(vodButton, xPosition - 119, yPosition + 35, 110, 50);
vodButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\點播介面\點播介面_點歌.png"));
vodButton.BackgroundImageLayout = ImageLayout.Stretch;
vodButton.FlatStyle = FlatStyle.Flat;
@ -39,7 +39,7 @@ namespace DualScreenDemo
insertButton = new Button();
insertButton.Text = "";
ResizeAndPositionButton(insertButton, xPosition + 2 , yPosition + 40, 110, 50);
ResizeAndPositionButton(insertButton, xPosition + 12 , yPosition + 35, 110, 50);
insertButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\點播介面\點播介面_插播.png"));
insertButton.BackgroundImageLayout = ImageLayout.Stretch;
insertButton.FlatStyle = FlatStyle.Flat;
@ -53,7 +53,7 @@ namespace DualScreenDemo
albumButton = new Button();
albumButton.Text = "";
ResizeAndPositionButton(albumButton, xPosition + 122, yPosition + 40, 140, 50);
ResizeAndPositionButton(albumButton, xPosition + 142, yPosition + 35, 140, 50);
albumButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\點播介面\點播介面_歷年專輯.png"));
albumButton.BackgroundImageLayout = ImageLayout.Stretch;
albumButton.FlatStyle = FlatStyle.Flat;
@ -67,7 +67,7 @@ namespace DualScreenDemo
favoriteButton = new Button();
favoriteButton.Text = "";
ResizeAndPositionButton(favoriteButton, xPosition + 272, yPosition + 40, 140, 50);
ResizeAndPositionButton(favoriteButton, xPosition + 302, yPosition + 35, 140, 50);
favoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\點播介面\點播介面_我的最愛.png"));
favoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
favoriteButton.FlatStyle = FlatStyle.Flat;
@ -96,7 +96,7 @@ namespace DualScreenDemo
vodScreenCloseButton = new Button();
vodScreenCloseButton.Text = "";
ResizeAndPositionButton(vodScreenCloseButton, xPosition + 422, yPosition + 40, 110, 50);
ResizeAndPositionButton(vodScreenCloseButton, xPosition + 462, yPosition + 35, 110, 50);
vodScreenCloseButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\點播介面\點播介面_關閉.png"));
vodScreenCloseButton.BackgroundImageLayout = ImageLayout.Stretch;
vodScreenCloseButton.FlatStyle = FlatStyle.Flat;

View File

@ -1811,10 +1811,10 @@ namespace DualScreenDemo
VodScreenPictureBox.Image = originalImage;
int screenWidth = 1920;
int screenHeight = 1080;
int pictureBoxWidth = 938;
int pictureBoxHeight = 209;
int screenWidth = 1440;
int screenHeight = 900;
int pictureBoxWidth = (int)(938*0.8f);
int pictureBoxHeight = (int)(209*0.8f);
int xPosition = (screenWidth - pictureBoxWidth) / 2;
int yPosition = (screenHeight - pictureBoxHeight) / 2;
@ -1865,8 +1865,8 @@ namespace DualScreenDemo
int screenW = Screen.PrimaryScreen.Bounds.Width;
int screenH = Screen.PrimaryScreen.Bounds.Height;
float widthRatio = screenW / (float)1980;
float heightRatio = screenH / (float)1080;
float widthRatio = screenW / (float)1440;
float heightRatio = screenH / (float)900;
pictureBox.Location = new Point(