using Bro.Common.Interface;
|
using Bro.UI.Model.Winform;
|
|
namespace Bro.M135.Process.UI
|
{
|
public partial class CtrlPositionDisplay : UserControl
|
{
|
ImagePanel imagePanel = null;
|
Bitmap imageBackground = null;
|
int imageWidth = 2448;
|
int imageHeight = 2048;
|
|
public string PositionName { get; set; } = "";
|
|
public CtrlPositionDisplay()
|
{
|
InitializeComponent();
|
|
imagePanel = new ImagePanel();
|
imagePanel.Dock = DockStyle.Fill;
|
gbMain.Controls.Clear();
|
gbMain.Controls.Add(imagePanel);
|
}
|
|
public CtrlPositionDisplay(string pName, string backgroundPath)
|
{
|
InitializeComponent();
|
|
imagePanel = new ImagePanel();
|
imagePanel.Dock = DockStyle.Fill;
|
gbMain.Controls.Clear();
|
gbMain.Controls.Add(imagePanel);
|
|
//positionName = pName;
|
PositionName = gbMain.Text = pName;
|
|
if (File.Exists(backgroundPath))
|
{
|
imageBackground = new Bitmap(backgroundPath);
|
imageWidth = imageBackground.Width;
|
imageHeight = imageBackground.Height;
|
|
imagePanel.LoadImage(imageBackground);
|
}
|
}
|
|
public void UpdateProductResult(List<IShapeElement> eleList)
|
{
|
this.Invoke(() =>
|
{
|
Bitmap image = new Bitmap(imageWidth, imageHeight, System.Drawing.Imaging.PixelFormat.Format32bppArgb);
|
|
using (Graphics g = Graphics.FromImage(image))
|
{
|
if (imageBackground != null)
|
{
|
g.DrawImage(imageBackground, 0, 0);
|
}
|
|
eleList.ForEach(u => u.Draw(g));
|
}
|
|
imagePanel.LoadImage(image);
|
imagePanel.SetScreenSize();
|
});
|
}
|
}
|
}
|