我的最愛圖片調整

This commit is contained in:
jasonchenwork 2025-04-15 14:32:22 +08:00
parent a4c33e9fc8
commit 2ef9ec5075
2 changed files with 29 additions and 12 deletions

View File

@ -84,7 +84,7 @@ namespace DualScreenDemo
{
Name = "enterFavoriteButton"
};
ResizeAndPositionButton(enterFavoriteButton, 842, 652, 70, 65);
ResizeAndPositionButton(enterFavoriteButton, 842, 662, 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, 652, 70, 65);
ResizeAndPositionButton(newFavoriteButton, 921, 662, 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, 652, 70, 65);
ResizeAndPositionButton(refillFavoriteButton, 999, 662, 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, 652, 70, 65);
ResizeAndPositionButton(closeFavoriteButton, 1078, 662, 70, 65);
closeFavoriteButton.BackgroundImage = Image.FromFile(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛-15.jpg"));
closeFavoriteButton.BackgroundImageLayout = ImageLayout.Stretch;
closeFavoriteButton.FlatStyle = FlatStyle.Flat;
@ -163,7 +163,6 @@ namespace DualScreenDemo
{
mobileNumber += clickedButton.Tag.ToString();
Console.WriteLine("Number button clicked: " + clickedButton.Tag.ToString());
phonenumber = mobileNumber;
FavoritePictureBox.Invalidate();
@ -177,8 +176,8 @@ namespace DualScreenDemo
using (Font font = new Font("Arial", 24))
using (Brush brush = new SolidBrush(Color.Black))
{
int x = 16;
int y = 68;
int x = 30;
int y = 100;
if (showError)
{
@ -307,7 +306,7 @@ namespace DualScreenDemo
if (!FavoritePictureBox.Visible)
{
ShowImageOnFavoritePictureBox(Path.Combine(Application.StartupPath, @"themes\superstar\其他介面\其他_我的最愛.jpg"));
ShowImageOnFavoritePictureBox(Path.Combine(Application.StartupPath, @"themes\superstar\我的最愛\我的最愛_工作區域.jpg"));
SetFavoritePictureBoxAndButtonsVisibility(true);
}
else
@ -330,7 +329,7 @@ namespace DualScreenDemo
private void ShowImageOnFavoritePictureBox(string imagePath)
{
Bitmap originalImage = new Bitmap(imagePath);
/*Bitmap originalImage = new Bitmap(imagePath);
Console.WriteLine(String.Format("Original Image Size: {0}x{1}", originalImage.Width, originalImage.Height));
@ -347,7 +346,25 @@ namespace DualScreenDemo
ResizeAndPositionPictureBox(FavoritePictureBox, cropArea.X, cropArea.Y, 416, 323);
FavoritePictureBox.Visible = true;
FavoritePictureBox.Visible = true;*/
if (File.Exists(imagePath))
{
// 直接載入完整圖
Bitmap image = new Bitmap(imagePath);
// 顯示在 PictureBox 上
FavoritePictureBox.Image = image;
// 設定 PictureBox 的大小與位置(依你的需要調整)
ResizeAndPositionPictureBox(FavoritePictureBox, 1084, 445, image.Width, image.Height);
FavoritePictureBox.Visible = true;
}
else
{
Console.WriteLine("圖片檔案不存在:" + imagePath);
}
}
private void ToggleFavoritePictureBoxButtonsVisibility()

View File

@ -1847,8 +1847,8 @@ namespace DualScreenDemo
int screenW = Screen.PrimaryScreen.Bounds.Width;
int screenH = Screen.PrimaryScreen.Bounds.Height;
float widthRatio = screenW / (float)1440;
float heightRatio = screenH / (float)900;
float widthRatio = screenW / (float)1980;
float heightRatio = screenH / (float)1080;
pictureBox.Location = new Point(