Commit 30aca5c0 LN

调试修改

1 个父辈 b4cfc899
......@@ -105,28 +105,35 @@ class NanjingSDotIO : IOBase
/// </summary>
void iomonitor()
{
iomonitorrun = true;
while (iomonitorrun && systemrun)
try
{
Thread.Sleep(2);
try
iomonitorrun = true;
while (iomonitorrun && systemrun)
{
ReadDO();
Thread.Sleep(2);
try
{
ReadDO();
}
catch (SocketException)
{
if (tcpClient != null && tcpClient.Connected)
tcpClient.Close();
ConnectionState_Event?.Invoke(this, false);
iomonitorrun = false;
}
}
catch (SocketException)
if (systemrun)
{
if (tcpClient!=null && tcpClient.Connected)
tcpClient.Close();
ConnectionState_Event?.Invoke(this, false);
iomonitorrun = false;
do
{
Thread.Sleep(1000);
} while (systemrun && !Open());
}
}
if (systemrun)
catch (Exception ex)
{
do
{
Thread.Sleep(1000);
} while (systemrun && !Open());
TSA_V.Common.LogUtil.error($"IO模块{IP}出错:" + ex.ToString());
}
}
......
using System.Collections.Generic;
using System;
using System.Collections.Generic;
using System.Net.Http;
using TSA_V.Common;
using TSA_V.LoadCSVLibrary;
......@@ -36,7 +37,7 @@ namespace TSA_V.DeviceLibrary
{
string url = $"http://{ip}/wms/associate/lightTagsLed";
string json = JsonHelper.SerializeObject(getLedMaps(macs, ledvs));
Post(url, json);
Post(url, json,(open ? "打开所有":"关闭所有"));
}
}
public static LabelInfo GetLabel(TSAVPosition position, ComponetInfo com, bool opendLed = false)
......@@ -107,7 +108,7 @@ namespace TSA_V.DeviceLibrary
Dictionary<string, object> keyValuePairss = getLedMap(mac, ledrgb);
string json = JsonHelper.SerializeObject(keyValuePairss);
string value = $"[{json}]";
Post(url, value);
Post(url, value, mac + (openLed ?"开灯":"关灯"));
}
public static void UpdateScreen(LabelInfo label)
{
......@@ -141,35 +142,39 @@ namespace TSA_V.DeviceLibrary
}
string json = JsonHelper.SerializeObject(dic);
string value = $"[{json}]";
Post(url, value);
}
Post(url, value,"更新屏幕");
}
public static async void Post(string url, string json)
public static async void Post(string url, string json, string opName = "")
{
using (var client = new HttpClient())
{
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
try
{
using (var client = new HttpClient())
{
var contents = new StringContent($"{json}", null, "application/json");
request.Content = contents;
using (HttpResponseMessage response = await client.SendAsync(request) )
using (var request = new HttpRequestMessage(HttpMethod.Post, url))
{
if (response.IsSuccessStatusCode)
{
string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
}
else
var contents = new StringContent($"{json}", null, "application/json");
request.Content = contents;
using (HttpResponseMessage response = await client.SendAsync(request))
{
string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
if (response.IsSuccessStatusCode)
{
string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
}
else
{
string jsonResponse = response.Content.ReadAsStringAsync().Result;
LogUtil.info($"电子屏 {opName} 发送{json} 结果 {response.IsSuccessStatusCode}: " + jsonResponse);
}
}
}
}
}
catch (Exception ex)
{
LogUtil.info($"电子屏 {opName} 发送{json} 出错 {ex.ToString()}");
}
}
// {
// "mac":"99.96.19.64",
......
......@@ -55,6 +55,11 @@ namespace TSA_V.DeviceLibrary
currIndex = ConfigAppSettings.GetIntValue(Setting_Init.TagNumber);
isContinue = false;
}
else
{
LogUtil.info("开始程序【" + boardInfo.boardName + "】的插件,关闭所有灯");
LedLabelController.CloseAll();
}
IsShowAOI = false;
currPoint = null;
IsWorking = true;
......@@ -191,6 +196,11 @@ namespace TSA_V.DeviceLibrary
//上一个节点返回原点
PUSICANControl.AbsMove(PreNodeId, TSAVBean.RotateNode_DefaultPosition);
}
if (PreLabel != null)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
}
//if (TSAVBean.IsNeedSoldering)
//{
// LogUtil.info(" 程序【" + currBoard.boardName + "】需要焊接,打开烙铁灯 ");
......@@ -302,6 +312,7 @@ namespace TSA_V.DeviceLibrary
if (PreLabel != null)
{
LedLabelController.CloseLed(PreLabel.ip, PreLabel.mac);
Thread.Sleep(300);
}
//LedManager.LedOFFALL();
if (position.PositionType.Equals(1))
......
......@@ -12,6 +12,7 @@ using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using TSA_V.LoadCSVLibrary;
using UserFromControl;
namespace TSA_V
{
......@@ -316,8 +317,8 @@ namespace TSA_V
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.XValue = TSAVBean.X_Max/2;
xyMoveControl1.YValue = TSAVBean.Y_Max/2;
xyMoveControl1.MaxX =(int) TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max;
ProjectorControl.MaxX =(int) TSAVBean.X_Max;
ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
xyMoveControl1.ShowText = "";
rdbUpload.Checked = true;
......
......@@ -13,6 +13,7 @@ using TSA_V.Common;
using PUSICANLibrary;
using TSA_V.LoadCSVLibrary;
using AccAOI;
using UserFromControl;
namespace TSA_V
{
......@@ -41,8 +42,8 @@ namespace TSA_V
xyMoveControl1.XValue = nodex;
xyMoveControl1.YValue = nodey;
xyMoveControl1.MaxX = (int)TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max;
ProjectorControl.MaxX = (int)TSAVBean.X_Max;
ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
this.txtX.Text = x.ToString();
this.txtY.Text = y.ToString();
......@@ -122,8 +123,8 @@ namespace TSA_V
return;
}
xyMoveControl1.ShowPointEvent += XyMoveControl1_ShowPointEvent;
xyMoveControl1.MaxX = (int)TSAVBean.X_Max;
xyMoveControl1.MaxY = (int)TSAVBean.Y_Max;
ProjectorControl.MaxX = (int)TSAVBean.X_Max;
ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
this.PointList = list;
this.CurrIndex = currIndex;
ShowPoint();
......
......@@ -10,6 +10,7 @@ using System.Threading.Tasks;
using System.Windows.Forms;
using TSA_V.Common;
using TSA_V.DeviceLibrary;
using UserFromControl;
namespace TSA_V
{
......@@ -33,7 +34,7 @@ namespace TSA_V
// private bool hasShow = false;
private void FrmScreenTest_Load(object sender, EventArgs e)
{
this.Text = "显示测试_" + ScreenIndex;
this.Text = "投影_" + ScreenIndex;
this.StartPosition = FormStartPosition.Manual;
timer1.Start();
if (panel1.BackgroundImage != null)
......@@ -76,12 +77,13 @@ namespace TSA_V
TSAVBean.Y_Max = ScreenHeight;
TSAVBean.X_Min = 1;
TSAVBean.Y_Min = 1;
ProjectorControl.MaxX = (int)TSAVBean.X_Max;
ProjectorControl.MaxY = (int)TSAVBean.Y_Max;
ISShow = true;
this.Location = new Point(screen.Bounds.Left, screen.Bounds.Top);
this.Show();
LogUtil.info($"投影显示成功,屏幕索引={ ScreenIndex} , 位置X:{screen.Bounds.Left} ,Y:{screen.Bounds.Top} ");
LogUtil.info($"投影显示成功,屏幕索引={ ScreenIndex} , 位置X:{screen.Bounds.Left} ,Y:{screen.Bounds.Top} ,范围 X:{ScreenWidth},Y:{ScreenHeight}");
return true;
}
else
......@@ -118,22 +120,29 @@ namespace TSA_V
//循环画线
for (int i = 0; i <= Point_X_Length; i++)
{
float line = 0.2F;
float line = 2F;
float picLocationX = startX + lineWidth * i;
if (picLocationX >= ScreenWidth)
{
picLocationX = ScreenWidth - 2;
}
else if (picLocationX == 0)
{
picLocationX = 2;
}
grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
}
for (int i = 0; i <= Point_Y_Length; i++)
{
float line = 0.2F;
float line = 2F;
float picLocationY = startY + lineHeight * i;
if (picLocationY >= ScreenHeight)
{
picLocationY = ScreenHeight - 1;
}else if(picLocationY== 0)
{
picLocationY = 2;
}
grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
}
......
......@@ -32,7 +32,7 @@ namespace TSA_V
// private bool hasShow = false;
private void FrmScreenTest_Load(object sender, EventArgs e)
{
this.Text = "显示测试_" + ScreenIndex;
this.Text = "View_" + ScreenIndex;
this.StartPosition = FormStartPosition.Manual;
timer1.Start();
if (panel1.BackgroundImage != null)
......@@ -72,16 +72,16 @@ namespace TSA_V
ScreenWidth = screen.Bounds.Width;
ScreenHeight = screen.Bounds.Height;
TSAVBean.X_Max = ScreenWidth;
TSAVBean.Y_Max = ScreenHeight;
TSAVBean.X_Min = 1;
TSAVBean.Y_Min = 1;
//TSAVBean.X_Max = ScreenWidth;
//TSAVBean.Y_Max = ScreenHeight;
//TSAVBean.X_Min = 1;
//TSAVBean.Y_Min = 1;
ISShow = true;
this.Location = new Point(screen.Bounds.Left, screen.Bounds.Top);
this.Show();
LogUtil.info($"第二屏幕显示成功,屏幕索引={ ScreenIndex}, X: {screen.Bounds.Left} ,Y:{screen.Bounds.Top} ");
LogUtil.info($"第二屏幕显示成功,屏幕索引={ ScreenIndex}, X: {screen.Bounds.Left} ,Y:{screen.Bounds.Top}, 屏幕尺寸:X:{ScreenWidth} ,Y:{ScreenHeight} ");
return true;
}
else
......@@ -94,264 +94,264 @@ namespace TSA_V
private void FrmScreenTest_Shown(object sender, EventArgs e)
{
ShowPoint(new ProjectorPInfo(ScreenWidth / 2, ScreenHeight / 2));
DrawArea();
//ShowPoint(new ProjectorPInfo(ScreenWidth / 2, ScreenHeight / 2));
//DrawArea();
panAoi.BackColor = Color.Black;
panAoi.Visible = false;
}
public void DrawArea()
{
if (!ISShow)
{
return;
}
int startX = 0;
int startY = 0;
int Point_X_Length = 3;
int Point_Y_Length = 3;
int lineWidth = (ScreenWidth) / (Point_X_Length - 1);
int lineHeight = (ScreenHeight) / (Point_Y_Length - 1);
Graphics grfx = panel1.CreateGraphics();
Color color = Color.White;
grfx.SmoothingMode = SmoothingMode.HighQuality;
//public void DrawArea()
//{
// if (!ISShow)
// {
// return;
// }
// int startX = 0;
// int startY = 0;
// int Point_X_Length = 3;
// int Point_Y_Length = 3;
// int lineWidth = (ScreenWidth) / (Point_X_Length - 1);
// int lineHeight = (ScreenHeight) / (Point_Y_Length - 1);
// Graphics grfx = panel1.CreateGraphics();
// Color color = Color.White;
// grfx.SmoothingMode = SmoothingMode.HighQuality;
//循环画线
for (int i = 0; i <= Point_X_Length; i++)
{
float line = 0.2F;
float picLocationX = startX + lineWidth * i;
if (picLocationX >= ScreenWidth)
{
picLocationX = ScreenWidth - 2;
}
grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
// //循环画线
// for (int i = 0; i <= Point_X_Length; i++)
// {
// float line = 0.2F;
// float picLocationX = startX + lineWidth * i;
// if (picLocationX >= ScreenWidth)
// {
// picLocationX = ScreenWidth - 2;
// }
// grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
}
for (int i = 0; i <= Point_Y_Length; i++)
{
float line = 0.2F;
float picLocationY = startY + lineHeight * i;
if (picLocationY >= ScreenHeight)
{
picLocationY = ScreenHeight - 1;
}
grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
}
grfx.Dispose();
}
public void DrawLine()
{
if (!ISShow)
{
return;
}
int startX = 0;
int startY = 0;
int Point_X_Length = 21;
int Point_Y_Length = 21;
// }
// for (int i = 0; i <= Point_Y_Length; i++)
// {
// float line = 0.2F;
// float picLocationY = startY + lineHeight * i;
// if (picLocationY >= ScreenHeight)
// {
// picLocationY = ScreenHeight - 1;
// }
// grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
// }
// grfx.Dispose();
//}
//public void DrawLine()
//{
// if (!ISShow)
// {
// return;
// }
// int startX = 0;
// int startY = 0;
// int Point_X_Length = 21;
// int Point_Y_Length = 21;
int lineWidth = (ScreenWidth - startX * 2) / (Point_X_Length - 1);
int lineHeight = (ScreenHeight - startY * 2) / (Point_Y_Length - 1);
// int lineWidth = (ScreenWidth - startX * 2) / (Point_X_Length - 1);
// int lineHeight = (ScreenHeight - startY * 2) / (Point_Y_Length - 1);
Graphics grfx = panel1.CreateGraphics();
Color color = Color.White;
grfx.SmoothingMode = SmoothingMode.HighQuality;
// Graphics grfx = panel1.CreateGraphics();
// Color color = Color.LightGray;
// grfx.SmoothingMode = SmoothingMode.HighQuality;
//循环画线
for (int i = 0; i <= Point_X_Length; i++)
{
float line = 0.2F;
float picLocationX = startX + lineWidth * i;
if (i.Equals(Point_X_Length / 2))
{
line = 1;
}
else if (((i % 5).Equals(0)) && (i > 0) && (i < Point_X_Length))
{
line = 0.5F;
}
// //循环画线
// for (int i = 0; i <= Point_X_Length; i++)
// {
// float line = 0.2F;
// float picLocationX = startX + lineWidth * i;
// if (i.Equals(Point_X_Length / 2))
// {
// line = 1;
// }
// else if (((i % 5).Equals(0)) && (i > 0) && (i < Point_X_Length))
// {
// line = 0.5F;
// }
grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
// grfx.DrawLine(new Pen(color, line), picLocationX, startY, picLocationX, ScreenHeight);
}
for (int i = 0; i <= Point_Y_Length; i++)
{
float line = 0.2F;
float picLocationY = startY + lineHeight * i;
if (i.Equals(Point_Y_Length / 2))
{
line = 1;
}
else if (((i % 5).Equals(0)) && (i > 0) && (i < Point_Y_Length))
{
line = 0.5F;
}
grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
}
grfx.Dispose();
}
// }
// for (int i = 0; i <= Point_Y_Length; i++)
// {
// float line = 0.2F;
// float picLocationY = startY + lineHeight * i;
// if (i.Equals(Point_Y_Length / 2))
// {
// line = 1;
// }
// else if (((i % 5).Equals(0)) && (i > 0) && (i < Point_Y_Length))
// {
// line = 0.5F;
// }
// grfx.DrawLine(new Pen(color, line), startX, picLocationY, ScreenWidth, picLocationY);
// }
// grfx.Dispose();
//}
private Color CurrColor = Color.White;
//private Color CurrColor = Color.White;
public void ClearPoint()
{
try
{
if (!ISShow)
{
return;
}
Graphics g = this.panel1.CreateGraphics();
g.Clear(Color.Black);
g.Dispose();//释放资源
}
catch (Exception ex)
{
LogUtil.error("ClearPoint 出错:" + ex.ToString());
}
//public void ClearPoint()
//{
// try
// {
// if (!ISShow)
// {
// return;
// }
// Graphics g = this.panel1.CreateGraphics();
// g.Clear(Color.Black);
// g.Dispose();//释放资源
// }
// catch (Exception ex)
// {
// LogUtil.error("ClearPoint 出错:" + ex.ToString());
// }
}
private void DrawPoint(Graphics g, int x, int y, int type = 0, int sizeX = 2, int sizeY = 2, int lineLength = 2, string name = "")
{
if (sizeX < 2)
{
sizeX = 2;
}
if (sizeY < 2)
{
sizeY = 2;
}
LastX = x;
LastY = y;
LastSizeX = sizeX;
LastSizeY = sizeY;
LastType = type;
Pen pen = new Pen(CurrColor, lineLength);
//}
//private void DrawPoint(Graphics g, int x, int y, int type = 0, int sizeX = 2, int sizeY = 2, int lineLength = 2, string name = "")
//{
// if (sizeX < 2)
// {
// sizeX = 2;
// }
// if (sizeY < 2)
// {
// sizeY = 2;
// }
// LastX = x;
// LastY = y;
// LastSizeX = sizeX;
// LastSizeY = sizeY;
// LastType = type;
// Pen pen = new Pen(CurrColor, lineLength);
System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(CurrColor);
//点类型,1 = 点,2 = +,3 =|,4 = -,5 = 方形,6 = 圆圈
if (type.Equals(PointType_Define.PlusSign_2))
{
g.DrawLine(pen, new Point(x - sizeX, y), new Point(x + sizeX, y));
g.DrawLine(pen, new Point(x, y - sizeY), new Point(x, y + sizeY));
}
else if (type.Equals(PointType_Define.VerticalLine_3))
{
g.DrawLine(pen, new Point(x, y - sizeY), new Point(x, y + sizeY));
}
else if (type.Equals(PointType_Define.Line_4))
{
g.DrawLine(pen, new Point(x - sizeX, y), new Point(x + sizeX, y));
}
else if (type.Equals(PointType_Define.Rectangle_5))
{
g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
}
else if (type.Equals(PointType_Define.Cycle_6))
{
g.DrawEllipse(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
}
else if (type.Equals(PointType_Define.Plus_Up_7))
{
int plusSize = sizeX / 2;
int pX = x;
int pY = y - sizeY / 2 - lineLength - plusSize;
g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
// System.Drawing.SolidBrush myBrush = new System.Drawing.SolidBrush(CurrColor);
// //点类型,1 = 点,2 = +,3 =|,4 = -,5 = 方形,6 = 圆圈
// if (type.Equals(PointType_Define.PlusSign_2))
// {
// g.DrawLine(pen, new Point(x - sizeX, y), new Point(x + sizeX, y));
// g.DrawLine(pen, new Point(x, y - sizeY), new Point(x, y + sizeY));
// }
// else if (type.Equals(PointType_Define.VerticalLine_3))
// {
// g.DrawLine(pen, new Point(x, y - sizeY), new Point(x, y + sizeY));
// }
// else if (type.Equals(PointType_Define.Line_4))
// {
// g.DrawLine(pen, new Point(x - sizeX, y), new Point(x + sizeX, y));
// }
// else if (type.Equals(PointType_Define.Rectangle_5))
// {
// g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// }
// else if (type.Equals(PointType_Define.Cycle_6))
// {
// g.DrawEllipse(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// }
// else if (type.Equals(PointType_Define.Plus_Up_7))
// {
// int plusSize = sizeX / 2;
// int pX = x;
// int pY = y - sizeY / 2 - lineLength - plusSize;
// g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
// g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
}
else if (type.Equals(PointType_Define.Plus_Down_8))
{
g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// }
// else if (type.Equals(PointType_Define.Plus_Down_8))
// {
// g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
int plusSize = sizeX / 2;
int pX = x;
int pY = y + sizeY / 2 + lineLength + plusSize;
g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (type.Equals(PointType_Define.Plus_Left_9))
{
g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// int plusSize = sizeX / 2;
// int pX = x;
// int pY = y + sizeY / 2 + lineLength + plusSize;
// g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
// g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
// }
// else if (type.Equals(PointType_Define.Plus_Left_9))
// {
// g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
int plusSize = sizeY / 2;
int pX = x - sizeX / 2 - lineLength - plusSize;
int pY = y;
g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else if (type.Equals(PointType_Define.Plus_Right_10))
{
g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
// int plusSize = sizeY / 2;
// int pX = x - sizeX / 2 - lineLength - plusSize;
// int pY = y;
// g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
// g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
// }
// else if (type.Equals(PointType_Define.Plus_Right_10))
// {
// g.DrawRectangle(pen, x - sizeX / 2, y - sizeY / 2, sizeX, sizeY);
int plusSize = sizeY / 2;
int pX = x + sizeX / 2 + lineLength + plusSize;
int pY = y;
g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
}
else
{
g.FillEllipse(myBrush, new Rectangle(x - sizeX / 2, y - sizeY / 2, sizeX, sizeY));//画实心椭圆
}
if (!name.Equals(""))
{
int size = (sizeX + sizeY) / 2;
size = 30;
if (!CloseShowName)
{
g.DrawString(name, new Font("Arial ", size, FontStyle.Regular), Brushes.White, x - size + 5, y + size + 2);
}
}
}
public void ShowPoint(DeviceLibrary.ProjectorPInfo p)
{
if (!ISShow)
{
return;
}
Graphics g = panel1.CreateGraphics();
DrawPoint(g, p.PX, p.PY, p.PType, p.SizeX, p.SizeY, p.PenWidth, p.ShowText);
g.Dispose();
}
public void ShowPoint(bool showName, params SMTPointInfo[] points)
{
if (!ISShow)
{
return;
}
ClearPoint();
Graphics g = panel1.CreateGraphics();
foreach (SMTPointInfo point in points)
{
int type = point.PointType;
int x = (int)point.NodePositionX;
int y = (int)point.NodePositionY;
int sizex = point.PointSizeX;
int sizey = point.PointSizeY;
DrawPoint(g, x, y, type, sizex, sizey, point.PenWidth, "");
// int plusSize = sizeY / 2;
// int pX = x + sizeX / 2 + lineLength + plusSize;
// int pY = y;
// g.DrawLine(pen, new Point(pX - plusSize, pY), new Point(pX + plusSize, pY));
// g.DrawLine(pen, new Point(pX, pY - plusSize), new Point(pX, pY + plusSize));
// }
// else
// {
// g.FillEllipse(myBrush, new Rectangle(x - sizeX / 2, y - sizeY / 2, sizeX, sizeY));//画实心椭圆
// }
// if (!name.Equals(""))
// {
// int size = (sizeX + sizeY) / 2;
// size = 30;
// if (!CloseShowName)
// {
// g.DrawString(name, new Font("Arial ", size, FontStyle.Regular), Brushes.White, x - size + 5, y + size + 2);
// }
// }
//}
//public void ShowPoint(DeviceLibrary.ProjectorPInfo p)
//{
// if (!ISShow)
// {
// return;
// }
// Graphics g = panel1.CreateGraphics();
// DrawPoint(g, p.PX, p.PY, p.PType, p.SizeX, p.SizeY, p.PenWidth, p.ShowText);
// g.Dispose();
//}
//public void ShowPoint(bool showName, params SMTPointInfo[] points)
//{
// if (!ISShow)
// {
// return;
// }
// ClearPoint();
// Graphics g = panel1.CreateGraphics();
// foreach (SMTPointInfo point in points)
// {
// int type = point.PointType;
// int x = (int)point.NodePositionX;
// int y = (int)point.NodePositionY;
// int sizex = point.PointSizeX;
// int sizey = point.PointSizeY;
// DrawPoint(g, x, y, type, sizex, sizey, point.PenWidth, "");
if (showName)
{
int size = (sizex + sizey) / 2;
if (!CloseShowName)
{
if (point.CheckOK && (points.Length > 1))
{
g.DrawString(point.ShowText, new Font("Arial ", size, FontStyle.Regular), Brushes.Red, x - size / 2 + 5, y + size / 2 + 2);
}
else
{
g.DrawString(point.ShowText, new Font("Arial ", size, FontStyle.Regular), Brushes.White, x - size / 2 + 5, y + size / 2 + 2);
}
}
}
}
g.Dispose();
}
// if (showName)
// {
// int size = (sizex + sizey) / 2;
// if (!CloseShowName)
// {
// if (point.CheckOK && (points.Length > 1))
// {
// g.DrawString(point.ShowText, new Font("Arial ", size, FontStyle.Regular), Brushes.Red, x - size / 2 + 5, y + size / 2 + 2);
// }
// else
// {
// g.DrawString(point.ShowText, new Font("Arial ", size, FontStyle.Regular), Brushes.White, x - size / 2 + 5, y + size / 2 + 2);
// }
// }
// }
// }
// g.Dispose();
//}
private void timer1_Tick(object sender, EventArgs e)
{
......
......@@ -14,8 +14,8 @@ namespace UserFromControl
{
public partial class ProjectorControl : UserControl
{
public int MaxX = 1920;
public int MaxY = 1280;
public static int MaxX = 1920;
public static int MaxY = 1280;
public delegate bool ShowPointDelegate(ProjectorPInfo p);
public event ShowPointDelegate ShowPointEvent;
public ProjectorControl()
......@@ -31,7 +31,7 @@ namespace UserFromControl
PointType = TSAVBean.DefaultPType;
numSizeX.Maximum = MaxX / 2;
numSizeY.Maximum=MaxY/ 2;
//LogUtil.info($"投影点位范围:X:{MaxX},Y:{MaxY}");
typeList = new List<string>();
this.cmbType.Items.Clear();
typeList.AddRange(new string[] {
......@@ -130,6 +130,11 @@ namespace UserFromControl
numY.Text = targetValue.ToString();
ShowCurrPoint();
}
else
{
numY.Text = 1.ToString();
ShowCurrPoint();
}
}
private void btnLeft_Click(object sender, EventArgs e)
......@@ -141,6 +146,11 @@ namespace UserFromControl
numX.Text = targetValue.ToString();
ShowCurrPoint();
}
else
{
numX.Text = 1.ToString();
ShowCurrPoint();
}
}
private void btnRight_Click(object sender, EventArgs e)
......@@ -153,6 +163,11 @@ namespace UserFromControl
numX.Text = targetValue .ToString();
ShowCurrPoint();
}
else
{
numX.Text = MaxX.ToString();
ShowCurrPoint();
}
}
private void btnDown_Click(object sender, EventArgs e)
......@@ -164,6 +179,11 @@ namespace UserFromControl
numY.Text = targetValue .ToString();
ShowCurrPoint();
}
else
{
numY.Text = MaxY.ToString();
ShowCurrPoint();
}
}
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!