test #1

Merged
jasonchenwork merged 64 commits from test into master 2025-03-18 17:32:23 +08:00
2 changed files with 43 additions and 35 deletions
Showing only changes of commit 3a127d0e3b - Show all commits

4
.gitignore vendored
View File

@ -4,6 +4,4 @@ Superstar_log.ldf
.vs
build.bat
*.exe
bin/logfile.txt
bin/secondary_graph.grf
bin/themes/superstar/_www/*
bin/*

View File

@ -291,7 +291,6 @@ namespace DualScreenDemo
private Dictionary<Control, Point> initialControlPositions = new Dictionary<Control, Point>();
private Panel sendOffPanel;
private PictureBox sendOffPictureBox;
private static Bitmap normalStateImageHotSong;
private static Bitmap mouseDownImageHotSong;
@ -3404,26 +3403,18 @@ public class MultiPagePanel : Panel
sendOffPanel = new Panel
{
Dock = DockStyle.Fill,
BackColor = Color.Black,
Visible = false
};
sendOffPictureBox = new PictureBox
{
Dock = DockStyle.Fill,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadSendOffImage()
//BackColor = Color.Black,
BackgroundImage = LoadSendOffImage(),
BackgroundImageLayout = ImageLayout.Stretch
};
// 初始化服務鈴圖標
serviceBellPictureBox = new PictureBox {
Visible = true,
Size = new Size(410, 130), // 调整为更大的尺寸
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadButtonImage("服務鈴.png"),
Cursor = System.Windows.Forms.Cursors.Hand,
Location = new Point(757, 151) // 调整位置到顶部
};
// 添加服務鈴點擊事件
@ -3437,47 +3428,39 @@ public class MultiPagePanel : Panel
// 使用 PictureBox 並加載小圖片
buttonMiddle = new PictureBox {
Visible = true,
Size = new Size(80, 80), // 稍微縮小一點
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadButtonImage("巨.png"),
Image = null,//LoadButtonImage("巨.png")
Cursor = System.Windows.Forms.Cursors.Hand
};
buttonTopRight = new PictureBox {
Visible = true,
Size = new Size(80, 80),
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadButtonImage("級.png"),
Image = null, //LoadButtonImage("級.png")
Cursor = System.Windows.Forms.Cursors.Hand
};
buttonTopLeft = new PictureBox {
Visible = true,
Size = new Size(150, 150),
BackColor = Color.FromArgb(255, 150, 180),
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadButtonImage("超.png"),
Image = null, //LoadButtonImage("超.png")
Cursor = System.Windows.Forms.Cursors.Hand
};
buttonThanks = new PictureBox {
Visible = true,
Size = new Size(150, 150),
BackColor = Color.FromArgb(255, 150, 180),
BackColor = Color.Transparent,
SizeMode = PictureBoxSizeMode.StretchImage,
Image = LoadButtonImage("星.png"),
Image = null, //LoadButtonImage("星.png")
Cursor = System.Windows.Forms.Cursors.Hand
};
buttonTopLeft.Location = new Point(1598,490 ); // 右下
buttonTopRight.Location = new Point(Screen.PrimaryScreen.Bounds.Width - 80, 0); // 右上
buttonMiddle.Location = new Point(0,0); //左上
buttonThanks.Location = new Point(831,490);
// 設定按鈕的初始位置和大小
UpdateSendOffButtonPositions();
// 添加點擊事件
buttonMiddle.Click += buttonMiddle_Click;
buttonTopRight.Click += buttonTopRight_Click;
@ -3485,7 +3468,6 @@ public class MultiPagePanel : Panel
buttonThanks.Click += buttonThanks_Click;
// 添加控件到面板
sendOffPanel.Controls.Add(sendOffPictureBox);
sendOffPanel.Controls.Add(serviceBellPictureBox); // 添加服務鈴
sendOffPanel.Controls.Add(buttonMiddle);
sendOffPanel.Controls.Add(buttonTopRight);
@ -3498,9 +3480,37 @@ public class MultiPagePanel : Panel
buttonTopRight.BringToFront();
buttonTopLeft.BringToFront();
buttonThanks.BringToFront();
sendOffPanel.Resize += (s, e) => UpdateSendOffButtonPositions();
this.Controls.Add(sendOffPanel);
}
/// <summary>
/// 動態按鈕座標位置設定(依據螢幕大小)
/// </summary>
private void UpdateSendOffButtonPositions()
{ Size designSize = new Size(1920, 1080);
var panelWidth = sendOffPanel.Width;
var panelHeight = sendOffPanel.Height;
// 計算寬高的縮放比例
float scaleX = panelWidth / (float)designSize.Width;
float scaleY = panelHeight / (float)designSize.Height;
// 幫你設定的按鈕位置(以原始座標為基礎)
buttonTopLeft.Location = new Point((int)(1598 * scaleX), (int)(490 * scaleY));
buttonTopRight.Location = new Point(panelWidth - (int)(80 * scaleX), 0);
buttonMiddle.Location = new Point(0, 0);
buttonThanks.Location = new Point((int)(831 * scaleX), (int)(490 * scaleY));
// 設定按鈕縮放後的大小(原始尺寸 * 縮放比例)
buttonTopLeft.Size = new Size((int)(150 * scaleX), (int)(150 * scaleY));
buttonTopRight.Size = new Size((int)(80 * scaleX), (int)(80 * scaleY));
buttonMiddle.Size = new Size((int)(80 * scaleX), (int)(80 * scaleY));
buttonThanks.Size = new Size((int)(150 * scaleX), (int)(150 * scaleY));
// ========== 服務鈴位置與大小 ==========
serviceBellPictureBox.Location = new Point((int)(757 * scaleX), (int)(151 * scaleY));
serviceBellPictureBox.Size = new Size((int)(410 * scaleX), (int)(130 * scaleY));
}
// 添加載入按鈕圖片的方法
private Image LoadButtonImage(string imageName)
@ -3528,7 +3538,7 @@ public class MultiPagePanel : Panel
{
try
{
string filePath = Path.Combine(Application.StartupPath, "VOD_送客畫面.jpg");
string filePath = Path.Combine(Application.StartupPath, "themes\\superstar\\VOD_送客畫面.jpg");
if (File.Exists(filePath))
{
return Image.FromFile(filePath);