initial commit
This commit is contained in:
37
Cs_HMI/SubProject/AGVControl/BatteryLevelGauge.Designer.cs
generated
Normal file
37
Cs_HMI/SubProject/AGVControl/BatteryLevelGauge.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
partial class BatteryLevelGauge
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 구성 요소 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
93
Cs_HMI/SubProject/AGVControl/BatteryLevelGauge.cs
Normal file
93
Cs_HMI/SubProject/AGVControl/BatteryLevelGauge.cs
Normal file
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public partial class BatteryLevelGauge : Control
|
||||
{
|
||||
float _vlevel = 50;
|
||||
public float VLevel { get { return _vlevel; } set { _vlevel = value; } }
|
||||
public float Volt { get; set; } = 0;
|
||||
public String sign { get; set; } = "%";
|
||||
public float CurA { get; set; } = 0;
|
||||
public float MaxA { get; set; } = 0;
|
||||
|
||||
bool isopen = false;
|
||||
public Boolean IsOpen { get { return isopen; } set { isopen = value; this.Invalidate(); } }
|
||||
|
||||
public Color BorderColor { get; set; } = Color.DimGray;
|
||||
|
||||
public BatteryLevelGauge()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Set Optimized Double Buffer to reduce flickering
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
// Redraw when resized
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
|
||||
this.Resize += arLabel_Resize;
|
||||
}
|
||||
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
pe.Graphics.InterpolationMode = InterpolationMode.High;
|
||||
pe.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
pe.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
//base.OnPaint(pe);
|
||||
pe.Graphics.FillRectangle(new SolidBrush(BackColor), DisplayRectangle);
|
||||
|
||||
var r = new RectangleF(this.DisplayRectangle.Left + Padding.Left,
|
||||
this.DisplayRectangle.Top + Padding.Top,
|
||||
this.DisplayRectangle.Width - Padding.Left - Padding.Right,
|
||||
this.DisplayRectangle.Height - Padding.Top - Padding.Bottom);
|
||||
|
||||
pe.Graphics.FillRectangle(new SolidBrush(this.BackColor), r);
|
||||
|
||||
|
||||
var w = r.Width * (this.VLevel / 100f);
|
||||
var lr = new RectangleF(r.Left, r.Top, w, r.Height);
|
||||
|
||||
Color bColor = Color.Red;
|
||||
if (VLevel > 80) bColor = Color.YellowGreen;
|
||||
else if (VLevel > 60) bColor = Color.Yellow;
|
||||
else if (VLevel > 40) bColor = Color.Orange;
|
||||
else if (VLevel > 20) bColor = Color.Tomato;
|
||||
else bColor = Color.Red;
|
||||
pe.Graphics.FillRectangle(new SolidBrush(bColor), lr);
|
||||
|
||||
Color textcolor = this.ForeColor;
|
||||
if (IsOpen == false) textcolor = Color.Black;
|
||||
var smg = IsOpen ? $"{ this.VLevel:N0}{ this.sign}" : "연결안됨";
|
||||
|
||||
pe.Graphics.DrawString(smg, this.Font, new SolidBrush(textcolor), r,
|
||||
new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
|
||||
pe.Graphics.DrawRectangle(Pens.Black, r.Left, r.Top, r.Width, r.Height);
|
||||
|
||||
|
||||
}
|
||||
void arLabel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Cs_HMI/SubProject/AGVControl/GuideSensor.Designer.cs
generated
Normal file
37
Cs_HMI/SubProject/AGVControl/GuideSensor.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
namespace Narumi.UC
|
||||
{
|
||||
partial class GuideSensor
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 구성 요소 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
106
Cs_HMI/SubProject/AGVControl/GuideSensor.cs
Normal file
106
Cs_HMI/SubProject/AGVControl/GuideSensor.cs
Normal file
@@ -0,0 +1,106 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace Narumi.UC
|
||||
{
|
||||
public partial class GuideSensor : Control
|
||||
{
|
||||
public int SensorValue { get; set; } = 0;
|
||||
public bool LMark { get; set; } = false;
|
||||
public bool RMark { get; set; } = false;
|
||||
|
||||
public GuideSensor()
|
||||
{
|
||||
InitializeComponent();
|
||||
// Set Optimized Double Buffer to reduce flickering
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
// Redraw when resized
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
|
||||
this.Resize += arLabel_Resize;
|
||||
}
|
||||
void arLabel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
var boxcount = 11;
|
||||
|
||||
var r = new RectangleF(this.DisplayRectangle.Left + Padding.Left,
|
||||
this.DisplayRectangle.Top + Padding.Top,
|
||||
this.DisplayRectangle.Width - Padding.Left - Padding.Right,
|
||||
this.DisplayRectangle.Height - Padding.Top - Padding.Bottom);
|
||||
|
||||
var term = 3;
|
||||
var w = ((r.Width -1) - (term * (boxcount - 1))) / boxcount;
|
||||
var h = r.Height -1;
|
||||
|
||||
pe.Graphics.FillRectangle(new SolidBrush(this.BackColor), this.DisplayRectangle);
|
||||
//pe.Graphics.DrawRectangle(Pens.Red, r.Left, r.Top, r.Width, r.Height);
|
||||
|
||||
for (int i = 0; i < boxcount; i++)
|
||||
{
|
||||
var x = r.Left + i * term + i * w;
|
||||
var y = r.Top;
|
||||
var r2 = new RectangleF(x, y, w, h);
|
||||
|
||||
if (this.Enabled == false)
|
||||
{
|
||||
pe.Graphics.FillRectangle(Brushes.LightGray, r2);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (i == 0)
|
||||
{
|
||||
if (LMark)
|
||||
pe.Graphics.FillRectangle(Brushes.SkyBlue, r2);
|
||||
else
|
||||
pe.Graphics.FillRectangle(Brushes.LightGray, r2);
|
||||
}
|
||||
else if (i == 9)
|
||||
{
|
||||
if (RMark)
|
||||
pe.Graphics.FillRectangle(Brushes.SkyBlue, r2);
|
||||
else
|
||||
pe.Graphics.FillRectangle(Brushes.LightGray, r2);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (SensorValue == i)
|
||||
pe.Graphics.FillRectangle(Brushes.Tomato, r2);
|
||||
else
|
||||
pe.Graphics.FillRectangle(Brushes.LightGray, r2);
|
||||
}
|
||||
|
||||
pe.Graphics.DrawRectangle(Pens.DimGray, r2.Left,r2.Top,r2.Width,r2.Height);
|
||||
|
||||
if (i == 0 || i == 10)
|
||||
{
|
||||
pe.Graphics.DrawString("M/K", this.Font,
|
||||
new SolidBrush(this.ForeColor), r2,
|
||||
new StringFormat
|
||||
{
|
||||
Alignment = StringAlignment.Center,
|
||||
LineAlignment = StringAlignment.Center
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
37
Cs_HMI/SubProject/AGVControl/MyRadioButton.Designer.cs
generated
Normal file
37
Cs_HMI/SubProject/AGVControl/MyRadioButton.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
partial class MyRadioButton
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 구성 요소 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
88
Cs_HMI/SubProject/AGVControl/MyRadioButton.cs
Normal file
88
Cs_HMI/SubProject/AGVControl/MyRadioButton.cs
Normal file
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public partial class MyRadioButton : RadioButton
|
||||
{
|
||||
public int CheckWidth { get; set; } = 30;
|
||||
public Color CheckOnColor { get; set; } = Color.OrangeRed;
|
||||
public Color CheckOffColor { get; set; } = Color.DimGray;
|
||||
public Color Bordercolor { get; set; } = Color.DimGray;
|
||||
public int BorderSize { get; set; } = 2;
|
||||
public int BorderRadius { get; set; } = 7;
|
||||
public MyRadioButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
// Set Optimized Double Buffer to reduce flickering
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
// Redraw when resized
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
|
||||
this.Resize += arLabel_Resize;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
pe.Graphics.InterpolationMode = InterpolationMode.High;
|
||||
pe.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
pe.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
pe.Graphics.Clear(this.BackColor);
|
||||
|
||||
var XPosition = this.DisplayRectangle.Left;
|
||||
var YPosition = this.DisplayRectangle.Top;
|
||||
using (GraphicsPath Path = new GraphicsPath())
|
||||
{
|
||||
Path.AddLine(XPosition + BorderRadius, YPosition, XPosition + Width - (BorderRadius * 2), YPosition);
|
||||
Path.AddArc(XPosition + Width - (BorderRadius * 2), YPosition, BorderRadius * 2, BorderRadius * 2, 270, 90);
|
||||
Path.AddLine(XPosition + Width, YPosition + BorderRadius, XPosition + Width, YPosition + Height - (BorderRadius * 2));
|
||||
Path.AddArc(XPosition + Width - (BorderRadius * 2), YPosition + Height - (BorderRadius * 2), BorderRadius * 2, BorderRadius * 2, 0, 90);
|
||||
Path.AddLine(XPosition + Width - (BorderRadius * 2), YPosition + Height, XPosition + BorderRadius, YPosition + Height);
|
||||
Path.AddArc(XPosition, YPosition + Height - (BorderRadius * 2), BorderRadius * 2, BorderRadius * 2, 90, 90);
|
||||
Path.AddLine(XPosition, YPosition + Height - (BorderRadius * 2), XPosition, YPosition + BorderRadius);
|
||||
Path.AddArc(XPosition, YPosition, BorderRadius * 2, BorderRadius * 2, 180, 90);
|
||||
Path.CloseFigure();
|
||||
|
||||
|
||||
|
||||
|
||||
var r1 = new Rectangle(
|
||||
DisplayRectangle.Left, DisplayRectangle.Top,
|
||||
CheckWidth,
|
||||
DisplayRectangle.Height - 1);
|
||||
var r2 = new Rectangle(r1.Right + 3, r1.Top, DisplayRectangle.Width - r1.Width - 3 - Padding.Right, r1.Height);
|
||||
var CC = Checked ? CheckOnColor : CheckOffColor;
|
||||
pe.Graphics.FillRectangle(new SolidBrush(CC), r1);
|
||||
StringFormat sf = new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center };
|
||||
if (this.TextAlign == ContentAlignment.MiddleLeft) sf.Alignment = StringAlignment.Near;
|
||||
else if (this.TextAlign == ContentAlignment.MiddleRight) sf.Alignment = StringAlignment.Far;
|
||||
pe.Graphics.DrawString(this.Text, this.Font, new SolidBrush(ForeColor), r2, sf);
|
||||
//pe.Graphics.DrawRectangle(new Pen(this.Bordercolor, this.BorderSize), DisplayRectangle);
|
||||
this.Region = new System.Drawing.Region(Path);
|
||||
|
||||
|
||||
pe.Graphics.DrawPath(new Pen(this.Bordercolor, this.BorderSize), Path);
|
||||
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
void arLabel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
}
|
||||
}
|
||||
36
Cs_HMI/SubProject/AGVControl/Properties/AssemblyInfo.cs
Normal file
36
Cs_HMI/SubProject/AGVControl/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// 어셈블리에 대한 일반 정보는 다음 특성 집합을 통해
|
||||
// 제어됩니다. 어셈블리와 관련된 정보를 수정하려면
|
||||
// 이러한 특성 값을 변경하세요.
|
||||
[assembly: AssemblyTitle("AGVControl")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("AGVControl")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2020")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// ComVisible을 false로 설정하면 이 어셈블리의 형식이 COM 구성 요소에
|
||||
// 표시되지 않습니다. COM에서 이 어셈블리의 형식에 액세스하려면
|
||||
// 해당 형식에 대해 ComVisible 특성을 true로 설정하세요.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// 이 프로젝트가 COM에 노출되는 경우 다음 GUID는 typelib의 ID를 나타냅니다.
|
||||
[assembly: Guid("8cb883c0-99c3-4dd4-b017-f9b92010a806")]
|
||||
|
||||
// 어셈블리의 버전 정보는 다음 네 가지 값으로 구성됩니다.
|
||||
//
|
||||
// 주 버전
|
||||
// 부 버전
|
||||
// 빌드 번호
|
||||
// 수정 버전
|
||||
//
|
||||
// 모든 값을 지정하거나 아래와 같이 '*'를 사용하여 빌드 번호 및 수정 번호를
|
||||
// 기본값으로 할 수 있습니다.
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
37
Cs_HMI/SubProject/AGVControl/RoundButton.Designer.cs
generated
Normal file
37
Cs_HMI/SubProject/AGVControl/RoundButton.Designer.cs
generated
Normal file
@@ -0,0 +1,37 @@
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
partial class RoundButton
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 구성 요소 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
63
Cs_HMI/SubProject/AGVControl/RoundButton.cs
Normal file
63
Cs_HMI/SubProject/AGVControl/RoundButton.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Drawing.Drawing2D;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public partial class RoundButton : Button
|
||||
{
|
||||
public int CornerRadius { get; set; } = 7;
|
||||
public RoundButton()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Set Optimized Double Buffer to reduce flickering
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
// Redraw when resized
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
|
||||
this.Resize += arLabel_Resize;
|
||||
}
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pevent)
|
||||
{
|
||||
pevent.Graphics.InterpolationMode = InterpolationMode.High;
|
||||
pevent.Graphics.SmoothingMode = SmoothingMode.AntiAlias;
|
||||
pevent.Graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
|
||||
|
||||
var XPosition = this.DisplayRectangle.Left;
|
||||
var YPosition = this.DisplayRectangle.Top;
|
||||
using (GraphicsPath Path = new GraphicsPath())
|
||||
{
|
||||
Path.AddLine(XPosition + CornerRadius, YPosition, XPosition + Width - (CornerRadius * 2), YPosition);
|
||||
Path.AddArc(XPosition + Width - (CornerRadius * 2), YPosition, CornerRadius * 2, CornerRadius * 2, 270, 90);
|
||||
Path.AddLine(XPosition + Width, YPosition + CornerRadius, XPosition + Width, YPosition + Height - (CornerRadius * 2));
|
||||
Path.AddArc(XPosition + Width - (CornerRadius * 2), YPosition + Height - (CornerRadius * 2), CornerRadius * 2, CornerRadius * 2, 0, 90);
|
||||
Path.AddLine(XPosition + Width - (CornerRadius * 2), YPosition + Height, XPosition + CornerRadius, YPosition + Height);
|
||||
Path.AddArc(XPosition, YPosition + Height - (CornerRadius * 2), CornerRadius * 2, CornerRadius * 2, 90, 90);
|
||||
Path.AddLine(XPosition, YPosition + Height - (CornerRadius * 2), XPosition, YPosition + CornerRadius);
|
||||
Path.AddArc(XPosition, YPosition, CornerRadius * 2, CornerRadius * 2, 180, 90);
|
||||
Path.CloseFigure();
|
||||
this.Region = new System.Drawing.Region(Path);
|
||||
}
|
||||
base.OnPaint(pevent);
|
||||
}
|
||||
|
||||
void arLabel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
36
Cs_HMI/SubProject/AGVControl/ValueSelect.Designer.cs
generated
Normal file
36
Cs_HMI/SubProject/AGVControl/ValueSelect.Designer.cs
generated
Normal file
@@ -0,0 +1,36 @@
|
||||
namespace AGVControl
|
||||
{
|
||||
partial class ValueSelect
|
||||
{
|
||||
/// <summary>
|
||||
/// 필수 디자이너 변수입니다.
|
||||
/// </summary>
|
||||
private System.ComponentModel.IContainer components = null;
|
||||
|
||||
/// <summary>
|
||||
/// 사용 중인 모든 리소스를 정리합니다.
|
||||
/// </summary>
|
||||
/// <param name="disposing">관리되는 리소스를 삭제해야 하면 true이고, 그렇지 않으면 false입니다.</param>
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && (components != null))
|
||||
{
|
||||
components.Dispose();
|
||||
}
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
#region 구성 요소 디자이너에서 생성한 코드
|
||||
|
||||
/// <summary>
|
||||
/// 디자이너 지원에 필요한 메서드입니다.
|
||||
/// 이 메서드의 내용을 코드 편집기로 수정하지 마세요.
|
||||
/// </summary>
|
||||
private void InitializeComponent()
|
||||
{
|
||||
components = new System.ComponentModel.Container();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
262
Cs_HMI/SubProject/AGVControl/ValueSelect.cs
Normal file
262
Cs_HMI/SubProject/AGVControl/ValueSelect.cs
Normal file
@@ -0,0 +1,262 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.Data;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Windows.Forms;
|
||||
|
||||
namespace AGVControl
|
||||
{
|
||||
public partial class ValueSelect : Control
|
||||
{
|
||||
public ValueSelect()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
// Set Optimized Double Buffer to reduce flickering
|
||||
this.SetStyle(ControlStyles.UserPaint, true);
|
||||
this.SetStyle(ControlStyles.AllPaintingInWmPaint, true);
|
||||
this.SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
|
||||
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
|
||||
|
||||
// Redraw when resized
|
||||
this.SetStyle(ControlStyles.ResizeRedraw, true);
|
||||
this.Resize += arLabel_Resize;
|
||||
this.MouseClick += ValueSelect_MouseClick;
|
||||
this.MouseEnter += (s1, e1) => { this.Cursor = Cursors.Hand; };
|
||||
this.MouseLeave += (s1, e1) => { this.Cursor = Cursors.Default; };
|
||||
}
|
||||
|
||||
private void ValueSelect_MouseClick(object sender, MouseEventArgs e)
|
||||
{
|
||||
//마우스클릭
|
||||
if (rectLButton.IsEmpty == false && rectLButton.Contains(e.Location))
|
||||
{
|
||||
if (SideButtonClickValue != 0.0)
|
||||
{
|
||||
var newvalue = this.Value - SideButtonClickValue;
|
||||
if (newvalue < MinValue) newvalue = MinValue;
|
||||
this.Value = newvalue;
|
||||
}
|
||||
|
||||
if (ButtonClick != null) ButtonClick(this, new ButtonClickEventArgs(MouseButtons.Left));
|
||||
}
|
||||
|
||||
|
||||
if (rectRButton.IsEmpty == false && rectRButton.Contains(e.Location))
|
||||
{
|
||||
if (SideButtonClickValue != 0.0)
|
||||
{
|
||||
var newvalue = this.Value + SideButtonClickValue;
|
||||
if (newvalue > MaxValue) newvalue = MaxValue;
|
||||
this.Value = newvalue;
|
||||
}
|
||||
|
||||
if (ButtonClick != null) ButtonClick(this, new ButtonClickEventArgs(MouseButtons.Right));
|
||||
}
|
||||
|
||||
|
||||
if (rectCButton.IsEmpty == false && rectCButton.Contains(e.Location))
|
||||
if (ButtonClick != null) ButtonClick(this, new ButtonClickEventArgs(MouseButtons.Middle));
|
||||
}
|
||||
|
||||
private Rectangle rectLButton;
|
||||
private Rectangle rectRButton;
|
||||
private Rectangle rectCButton;
|
||||
private Boolean bMakeRect = true;
|
||||
|
||||
private double _minvalue = 0.0;
|
||||
private double _maxvalue = 9999999999.0;
|
||||
public double MinValue { get { return _minvalue; } set { _minvalue = value; Invalidate(); } }
|
||||
|
||||
public double MaxValue { get { return _maxvalue; } set { _maxvalue = value; Invalidate(); } }
|
||||
|
||||
|
||||
|
||||
private UInt16 _decimalposition = 0;
|
||||
private string _buttonwdith = string.Empty;
|
||||
private double _value = 0;
|
||||
private Color _border = Color.Lime;
|
||||
private double buttongabp;
|
||||
public double SideButtonClickValue { get { return buttongabp; } set { buttongabp = value; Invalidate(); } }
|
||||
|
||||
private Color _backbutton = Color.White;
|
||||
private Color _sidebutto = Color.Black;
|
||||
|
||||
public Color BackColorButton { get { return _backbutton; } set { _backbutton = value; Invalidate(); } }
|
||||
public Color ForeColorButton { get { return _sidebutto; } set { _sidebutto = value; Invalidate(); } }
|
||||
|
||||
|
||||
|
||||
public Color ColorBorder { get { return _border; } set { _border = value; Invalidate(); } }
|
||||
|
||||
public override string Text
|
||||
{
|
||||
get => Value.ToString();
|
||||
set
|
||||
{
|
||||
if (double.TryParse(value, out double dblval) == true)
|
||||
this.Value = dblval;
|
||||
}
|
||||
}
|
||||
|
||||
public double Value
|
||||
{
|
||||
get { return _value; }
|
||||
set
|
||||
{
|
||||
if (_value != value)
|
||||
{
|
||||
//이 값이 범위를 초과했는지 확인
|
||||
if (value < MinValue)
|
||||
{
|
||||
_value = MinValue;
|
||||
//throw new Exception(string.Format("입력값이 컨트롤의 최소값보다 작습니다(입력:{0},최소값:{1})",value,MinValue));
|
||||
}
|
||||
else if (value > MaxValue)
|
||||
{
|
||||
_value = MaxValue;
|
||||
//throw new Exception(string.Format("입력값이 컨트롤의 최대값보다 작습니다(입력:{0},최대값:{1})", value, MaxValue));
|
||||
}
|
||||
else
|
||||
{
|
||||
_value = value;
|
||||
|
||||
}
|
||||
Invalidate();
|
||||
if (ValueChanged != null) ValueChanged(this, new EventArgs());
|
||||
}
|
||||
}
|
||||
}
|
||||
public UInt16 DecimalPosition { get { return _decimalposition; } set { _decimalposition = value; Invalidate(); } }
|
||||
public string ButtonWidth { get { return _buttonwdith; } set { _buttonwdith = value; Invalidate(); } }
|
||||
|
||||
private string _nulldisplay = string.Empty;
|
||||
public string NullDisplay { get { return _nulldisplay; } set { _nulldisplay = value; Invalidate(); } }
|
||||
|
||||
private Font _sidefont;
|
||||
public Font FontSideButton { get { if (_sidefont == null) return this.Font; else return _sidefont; } set { _sidefont = value; Invalidate(); } }
|
||||
|
||||
void arLabel_Resize(object sender, EventArgs e)
|
||||
{
|
||||
this.bMakeRect = true;
|
||||
Invalidate();
|
||||
}
|
||||
|
||||
public class ButtonClickEventArgs : EventArgs
|
||||
{
|
||||
public MouseButtons Button;
|
||||
public ButtonClickEventArgs(MouseButtons button)
|
||||
{
|
||||
this.Button = button;
|
||||
// Console.WriteLine("button clickc : " +button.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
public event EventHandler<ButtonClickEventArgs> ButtonClick;
|
||||
public event EventHandler ValueChanged;
|
||||
|
||||
protected override void OnPaint(PaintEventArgs pe)
|
||||
{
|
||||
//base.OnPaint(pe);
|
||||
if (bMakeRect) MakeRect();
|
||||
|
||||
|
||||
|
||||
StringFormat sf = new StringFormat();
|
||||
sf.Alignment = StringAlignment.Center;
|
||||
sf.LineAlignment = StringAlignment.Center;
|
||||
sf.Trimming = StringTrimming.None;
|
||||
sf.FormatFlags = StringFormatFlags.NoWrap;
|
||||
|
||||
//좌측버튼표시
|
||||
if (rectLButton.IsEmpty == false)
|
||||
{
|
||||
pe.Graphics.FillRectangle(new SolidBrush(BackColorButton), rectLButton);
|
||||
pe.Graphics.DrawString("<<", this.FontSideButton, new SolidBrush(this.ForeColorButton), rectLButton, sf);
|
||||
}
|
||||
|
||||
if (rectRButton.IsEmpty == false)
|
||||
{
|
||||
pe.Graphics.FillRectangle(new SolidBrush(BackColorButton), rectRButton);
|
||||
pe.Graphics.DrawString(">>", this.FontSideButton, new SolidBrush(this.ForeColorButton), rectRButton, sf);
|
||||
}
|
||||
|
||||
//값표시
|
||||
string valuestr;
|
||||
if (Value == 0.0 && string.IsNullOrEmpty(NullDisplay) == false)
|
||||
valuestr = NullDisplay;
|
||||
else
|
||||
valuestr = Value.ToString("N" + DecimalPosition.ToString());
|
||||
|
||||
pe.Graphics.FillRectangle(new SolidBrush(BackColor), rectCButton);
|
||||
pe.Graphics.DrawString(valuestr, this.Font, new SolidBrush(this.ForeColor), rectCButton, sf);
|
||||
sf.Dispose();
|
||||
|
||||
|
||||
//테두리표시
|
||||
if (rectLButton.IsEmpty == false)
|
||||
pe.Graphics.DrawRectangle(new Pen(ColorBorder), rectLButton);
|
||||
if (rectRButton.IsEmpty == false)
|
||||
pe.Graphics.DrawRectangle(new Pen(ColorBorder), rectRButton);
|
||||
pe.Graphics.DrawRectangle(new Pen(ColorBorder), rectCButton);
|
||||
}
|
||||
|
||||
void MakeRect()
|
||||
{
|
||||
int bWidth;
|
||||
if (string.IsNullOrEmpty(ButtonWidth) == false)
|
||||
{
|
||||
if (ButtonWidth.EndsWith("%"))
|
||||
{
|
||||
if (int.TryParse(ButtonWidth.Substring(0, ButtonWidth.Length - 1), out bWidth) == false)
|
||||
bWidth = 0; //숫자로 바꾸는거 실패
|
||||
else bWidth = (int)(this.DisplayRectangle.Width * (bWidth / 100.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (int.TryParse(ButtonWidth, out bWidth) == false)
|
||||
bWidth = 0;
|
||||
}
|
||||
}
|
||||
else bWidth = 0;
|
||||
|
||||
if (bWidth > 0)
|
||||
{
|
||||
int buttongap = 1;
|
||||
//각버튼간 2px 간격을 띄운다.
|
||||
bWidth = bWidth - buttongap * 2;
|
||||
rectLButton = new Rectangle(
|
||||
DisplayRectangle.Left,
|
||||
DisplayRectangle.Top,
|
||||
bWidth,
|
||||
DisplayRectangle.Height - 1);
|
||||
|
||||
rectCButton = new Rectangle(
|
||||
rectLButton.Right + buttongap,
|
||||
DisplayRectangle.Top,
|
||||
DisplayRectangle.Width - rectLButton.Width * 2 - buttongap * 2,
|
||||
DisplayRectangle.Height - 1);
|
||||
|
||||
rectRButton = new Rectangle(
|
||||
rectCButton.Right + buttongap,
|
||||
DisplayRectangle.Top,
|
||||
bWidth - 1,
|
||||
DisplayRectangle.Height - 1);
|
||||
}
|
||||
else
|
||||
{
|
||||
rectLButton = Rectangle.Empty;
|
||||
rectRButton = Rectangle.Empty;
|
||||
rectCButton = new Rectangle(DisplayRectangle.Left,
|
||||
DisplayRectangle.Top,
|
||||
DisplayRectangle.Width - 1,
|
||||
DisplayRectangle.Height - 1);
|
||||
}
|
||||
bMakeRect = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
81
Cs_HMI/SubProject/AGVControl/agvControl.csproj
Normal file
81
Cs_HMI/SubProject/AGVControl/agvControl.csproj
Normal file
@@ -0,0 +1,81 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{8CB883C0-99C3-4DD4-B017-F9B92010A806}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>AGVControl</RootNamespace>
|
||||
<AssemblyName>AGVControl</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.8</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<TargetFrameworkProfile />
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<Prefer32Bit>false</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BatteryLevelGauge.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="BatteryLevelGauge.Designer.cs">
|
||||
<DependentUpon>BatteryLevelGauge.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="GuideSensor.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="GuideSensor.Designer.cs">
|
||||
<DependentUpon>GuideSensor.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="MyRadioButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MyRadioButton.Designer.cs">
|
||||
<DependentUpon>MyRadioButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="RoundButton.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="RoundButton.Designer.cs">
|
||||
<DependentUpon>RoundButton.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ValueSelect.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
<Compile Include="ValueSelect.Designer.cs">
|
||||
<DependentUpon>ValueSelect.cs</DependentUpon>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
||||
Reference in New Issue
Block a user