送客畫面(動態調整位置/隱藏按鈕)
This commit is contained in:
parent
67d3588267
commit
3a127d0e3b
4
.gitignore
vendored
4
.gitignore
vendored
@ -4,6 +4,4 @@ Superstar_log.ldf
|
|||||||
.vs
|
.vs
|
||||||
build.bat
|
build.bat
|
||||||
*.exe
|
*.exe
|
||||||
bin/logfile.txt
|
bin/*
|
||||||
bin/secondary_graph.grf
|
|
||||||
bin/themes/superstar/_www/*
|
|
||||||
|
@ -291,7 +291,6 @@ namespace DualScreenDemo
|
|||||||
private Dictionary<Control, Point> initialControlPositions = new Dictionary<Control, Point>();
|
private Dictionary<Control, Point> initialControlPositions = new Dictionary<Control, Point>();
|
||||||
|
|
||||||
private Panel sendOffPanel;
|
private Panel sendOffPanel;
|
||||||
private PictureBox sendOffPictureBox;
|
|
||||||
|
|
||||||
private static Bitmap normalStateImageHotSong;
|
private static Bitmap normalStateImageHotSong;
|
||||||
private static Bitmap mouseDownImageHotSong;
|
private static Bitmap mouseDownImageHotSong;
|
||||||
@ -3404,26 +3403,18 @@ public class MultiPagePanel : Panel
|
|||||||
sendOffPanel = new Panel
|
sendOffPanel = new Panel
|
||||||
{
|
{
|
||||||
Dock = DockStyle.Fill,
|
Dock = DockStyle.Fill,
|
||||||
BackColor = Color.Black,
|
//BackColor = Color.Black,
|
||||||
Visible = false
|
BackgroundImage = LoadSendOffImage(),
|
||||||
};
|
BackgroundImageLayout = ImageLayout.Stretch
|
||||||
|
|
||||||
sendOffPictureBox = new PictureBox
|
|
||||||
{
|
|
||||||
Dock = DockStyle.Fill,
|
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
|
||||||
Image = LoadSendOffImage()
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 初始化服務鈴圖標
|
// 初始化服務鈴圖標
|
||||||
serviceBellPictureBox = new PictureBox {
|
serviceBellPictureBox = new PictureBox {
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Size = new Size(410, 130), // 调整为更大的尺寸
|
|
||||||
BackColor = Color.Transparent,
|
BackColor = Color.Transparent,
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||||
Image = LoadButtonImage("服務鈴.png"),
|
Image = LoadButtonImage("服務鈴.png"),
|
||||||
Cursor = System.Windows.Forms.Cursors.Hand,
|
Cursor = System.Windows.Forms.Cursors.Hand,
|
||||||
Location = new Point(757, 151) // 调整位置到顶部
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// 添加服務鈴點擊事件
|
// 添加服務鈴點擊事件
|
||||||
@ -3437,47 +3428,39 @@ public class MultiPagePanel : Panel
|
|||||||
// 使用 PictureBox 並加載小圖片
|
// 使用 PictureBox 並加載小圖片
|
||||||
buttonMiddle = new PictureBox {
|
buttonMiddle = new PictureBox {
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Size = new Size(80, 80), // 稍微縮小一點
|
|
||||||
BackColor = Color.Transparent,
|
BackColor = Color.Transparent,
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||||
Image = LoadButtonImage("巨.png"),
|
Image = null,//LoadButtonImage("巨.png")
|
||||||
Cursor = System.Windows.Forms.Cursors.Hand
|
Cursor = System.Windows.Forms.Cursors.Hand
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonTopRight = new PictureBox {
|
buttonTopRight = new PictureBox {
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Size = new Size(80, 80),
|
|
||||||
BackColor = Color.Transparent,
|
BackColor = Color.Transparent,
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||||
Image = LoadButtonImage("級.png"),
|
Image = null, //LoadButtonImage("級.png")
|
||||||
Cursor = System.Windows.Forms.Cursors.Hand
|
Cursor = System.Windows.Forms.Cursors.Hand
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonTopLeft = new PictureBox {
|
buttonTopLeft = new PictureBox {
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Size = new Size(150, 150),
|
BackColor = Color.Transparent,
|
||||||
BackColor = Color.FromArgb(255, 150, 180),
|
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||||
Image = LoadButtonImage("超.png"),
|
Image = null, //LoadButtonImage("超.png")
|
||||||
Cursor = System.Windows.Forms.Cursors.Hand
|
Cursor = System.Windows.Forms.Cursors.Hand
|
||||||
};
|
};
|
||||||
|
|
||||||
buttonThanks = new PictureBox {
|
buttonThanks = new PictureBox {
|
||||||
Visible = true,
|
Visible = true,
|
||||||
Size = new Size(150, 150),
|
BackColor = Color.Transparent,
|
||||||
BackColor = Color.FromArgb(255, 150, 180),
|
|
||||||
SizeMode = PictureBoxSizeMode.StretchImage,
|
SizeMode = PictureBoxSizeMode.StretchImage,
|
||||||
Image = LoadButtonImage("星.png"),
|
Image = null, //LoadButtonImage("星.png")
|
||||||
Cursor = System.Windows.Forms.Cursors.Hand
|
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;
|
buttonMiddle.Click += buttonMiddle_Click;
|
||||||
buttonTopRight.Click += buttonTopRight_Click;
|
buttonTopRight.Click += buttonTopRight_Click;
|
||||||
@ -3485,7 +3468,6 @@ public class MultiPagePanel : Panel
|
|||||||
buttonThanks.Click += buttonThanks_Click;
|
buttonThanks.Click += buttonThanks_Click;
|
||||||
|
|
||||||
// 添加控件到面板
|
// 添加控件到面板
|
||||||
sendOffPanel.Controls.Add(sendOffPictureBox);
|
|
||||||
sendOffPanel.Controls.Add(serviceBellPictureBox); // 添加服務鈴
|
sendOffPanel.Controls.Add(serviceBellPictureBox); // 添加服務鈴
|
||||||
sendOffPanel.Controls.Add(buttonMiddle);
|
sendOffPanel.Controls.Add(buttonMiddle);
|
||||||
sendOffPanel.Controls.Add(buttonTopRight);
|
sendOffPanel.Controls.Add(buttonTopRight);
|
||||||
@ -3498,9 +3480,37 @@ public class MultiPagePanel : Panel
|
|||||||
buttonTopRight.BringToFront();
|
buttonTopRight.BringToFront();
|
||||||
buttonTopLeft.BringToFront();
|
buttonTopLeft.BringToFront();
|
||||||
buttonThanks.BringToFront();
|
buttonThanks.BringToFront();
|
||||||
|
sendOffPanel.Resize += (s, e) => UpdateSendOffButtonPositions();
|
||||||
this.Controls.Add(sendOffPanel);
|
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)
|
private Image LoadButtonImage(string imageName)
|
||||||
@ -3528,7 +3538,7 @@ public class MultiPagePanel : Panel
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string filePath = Path.Combine(Application.StartupPath, "VOD_送客畫面.jpg");
|
string filePath = Path.Combine(Application.StartupPath, "themes\\superstar\\VOD_送客畫面.jpg");
|
||||||
if (File.Exists(filePath))
|
if (File.Exists(filePath))
|
||||||
{
|
{
|
||||||
return Image.FromFile(filePath);
|
return Image.FromFile(filePath);
|
||||||
|
Reference in New Issue
Block a user