TrendViewer, 차트 LegendText 변경한 셀이름으로 표시

This commit is contained in:
shark219-hub
2024-11-27 11:55:33 +09:00
parent cb6a25f0a2
commit 3781977741
9 changed files with 161 additions and 142 deletions

View File

@@ -12,6 +12,7 @@ using System.Data.SqlTypes;
using System.Diagnostics;
using vmsnet.Attributes;
using vmsnet.Configures;
using AR;
namespace vmsnet.HMI
{
@@ -1700,105 +1701,116 @@ namespace vmsnet.HMI
base.OnPaint(e);
//this.SuspendLayout();
///각영역을 새로 만들어야하는경우이다.
if (bMakeRect)
try
{
if (FullScreen)
///각영역을 새로 만들어야하는경우이다.
if (bMakeRect)
{
WindowRect = new RectangleF(Padding.Left, Padding.Top, this.Width - Padding.Left - Padding.Right, this.Height - Padding.Top - Padding.Bottom);
//TrendRect = new RectangleF(0,0,0,0);
// BarRect = new RectangleF(0, 0, 0, 0);
// NavRect = new RectangleF(0, 0, 0, 0);
if (FullScreen)
{
WindowRect = new RectangleF(Padding.Left, Padding.Top, this.Width - Padding.Left - Padding.Right, this.Height - Padding.Top - Padding.Bottom);
//TrendRect = new RectangleF(0,0,0,0);
// BarRect = new RectangleF(0, 0, 0, 0);
// NavRect = new RectangleF(0, 0, 0, 0);
}
else
{
WindowRect = new RectangleF(Padding.Left, Padding.Top, this.Width - Padding.Left - Padding.Right, this.Height - Padding.Top - Padding.Bottom);
//개별화면일경우
// int WindowWidth = SmallSize; // (int)((this.Width - Padding.Left - Padding.Right) * 0.4);
// int halfHeight = (int)((this.Height- Padding.Top - Padding.Bottom - 50-10) * 0.5);
// WindowRect = new RectangleF(Padding.Left, Padding.Top, WindowWidth, this.Height - Padding.Top - Padding.Bottom);
// NavRect = new RectangleF(WindowRect.Right + 10, WindowRect.Top, this.Width - WindowRect.Right - 10 - 1, 50);
// TrendRect = new RectangleF(NavRect.Left, WindowRect.Top + 50, this.Width - WindowRect.Right - 10 - 1, halfHeight);
// BarRect = new RectangleF(NavRect.Left, TrendRect.Bottom + 10, TrendRect.Width, halfHeight);
}
bMakeRect = false;
}
Buttons = new List<CButton>(0);
//Buttonstag = new List<Object>(0);
//Buttonstype = new List<EBUTTONTYPE>(0);
Boolean isnull = false;
if (!init) isnull = true;
else
{
WindowRect = new RectangleF(Padding.Left, Padding.Top, this.Width - Padding.Left - Padding.Right, this.Height - Padding.Top - Padding.Bottom);
//개별화면일경우
// int WindowWidth = SmallSize; // (int)((this.Width - Padding.Left - Padding.Right) * 0.4);
// int halfHeight = (int)((this.Height- Padding.Top - Padding.Bottom - 50-10) * 0.5);
// WindowRect = new RectangleF(Padding.Left, Padding.Top, WindowWidth, this.Height - Padding.Top - Padding.Bottom);
// NavRect = new RectangleF(WindowRect.Right + 10, WindowRect.Top, this.Width - WindowRect.Right - 10 - 1, 50);
// TrendRect = new RectangleF(NavRect.Left, WindowRect.Top + 50, this.Width - WindowRect.Right - 10 - 1, halfHeight);
// BarRect = new RectangleF(NavRect.Left, TrendRect.Bottom + 10, TrendRect.Width, halfHeight);
}
bMakeRect = false;
}
Buttons = new List<CButton>(0);
//Buttonstag = new List<Object>(0);
//Buttonstype = new List<EBUTTONTYPE>(0);
Boolean isnull = false;
if (!init) isnull = true;
else
{
if (this.WINDOW == null || this.GROUPS == null) isnull = true;
if (isnull && this.GROUPS.Length == 0) isnull = true;
}
//표시아이템이없다면 오류를 낸다.
if (isnull)
{
//progress
int bw = (int)(this.Width * 0.8);
int bh = 30;
Rectangle rr = new Rectangle((this.Width - bw) / 2, (this.Height - bh) / 2, bw, bh);
Rectangle FullRect = new Rectangle(0, 0, this.Width, this.Height);
using (var gradientBrush = new LinearGradientBrush(FullRect, Color.White, Color.White, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(gradientBrush, FullRect);
SizeF initsize = e.Graphics.MeasureString(initmsg, FONT_NANUM_20_BOLD);
e.Graphics.DrawString(initmsg, FONT_NANUM_20_BOLD, Brushes.Black, this.Width / 2 - initsize.Width / 2, this.Height / 2 - initsize.Height / 2 - bh - 20);
if (this.WINDOW == null || this.GROUPS == null) isnull = true;
if (isnull && this.GROUPS.Length == 0) isnull = true;
}
using (var lb = new LinearGradientBrush(rr, Color.LightBlue, Color.SkyBlue, LinearGradientMode.Vertical))
//표시아이템이없다면 오류를 낸다.
if (isnull)
{
if (initpercent > 100) initpercent = 100;
int perc = (int)(rr.Width * initpercent / 100);
e.Graphics.FillRectangle(lb, new Rectangle(rr.Left, rr.Top, perc, rr.Height));
e.Graphics.DrawRectangle(Pens.DarkGray, rr);
e.Graphics.DrawRectangle(Pens.DarkGoldenrod, FullRect.Left, FullRect.Top, FullRect.Width - 1, FullRect.Height - 1);
//progress
int bw = (int)(this.Width * 0.8);
int bh = 30;
Rectangle rr = new Rectangle((this.Width - bw) / 2, (this.Height - bh) / 2, bw, bh);
Rectangle FullRect = new Rectangle(0, 0, this.Width, this.Height);
using (var gradientBrush = new LinearGradientBrush(FullRect, Color.White, Color.White, LinearGradientMode.Vertical))
{
e.Graphics.FillRectangle(gradientBrush, FullRect);
SizeF initsize = e.Graphics.MeasureString(initmsg, FONT_NANUM_20_BOLD);
e.Graphics.DrawString(initmsg, FONT_NANUM_20_BOLD, Brushes.Black, this.Width / 2 - initsize.Width / 2, this.Height / 2 - initsize.Height / 2 - bh - 20);
}
using (var lb = new LinearGradientBrush(rr, Color.LightBlue, Color.SkyBlue, LinearGradientMode.Vertical))
{
if (initpercent > 100) initpercent = 100;
int perc = (int)(rr.Width * initpercent / 100);
e.Graphics.FillRectangle(lb, new Rectangle(rr.Left, rr.Top, perc, rr.Height));
e.Graphics.DrawRectangle(Pens.DarkGray, rr);
e.Graphics.DrawRectangle(Pens.DarkGoldenrod, FullRect.Left, FullRect.Top, FullRect.Width - 1, FullRect.Height - 1);
}
this.ResumeLayout();
return;
}
this.ResumeLayout();
return;
}
// AntiAliasing
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
// AntiAliasing
e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
//그룹목록
DrawGroups(e.Graphics); /* GROUPS 화면 Display !!! */
//그룹목록
DrawGroups(e.Graphics); /* GROUPS 화면 Display !!! */
//monitor off display
if (MonitorOn == false)
{
e.Graphics.FillRectangle(SB_WhiteSmoke_200, DisplayRectangle);
e.Graphics.DrawString("MONITOR PAUSE", FONT_TAHOMA_80_BOLD, Brushes.Gray, DisplayRectangle, new StringFormat
//monitor off display
if (MonitorOn == false)
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center,
});
}
//if (!FullScreen && ShowIndex >= 0)
{
//트렌드뷰용채널데이터를 새로 만드는경우
//if (bMakeTrendViewChData) MakeTrendViewChData();
//마지막데이터와 2초의 차이가 있다면 데이터를 생성해준다.
DateTime NOwdate = DateTime.Now;
TimeSpan ts = NOwdate - LastNotifyTime;
if (ts.TotalSeconds >= NotifyDataSecond)
{
//알림
if (OnNotifyData != null) OnNotifyData(NOwdate);
LastNotifyTime = NOwdate;
e.Graphics.FillRectangle(SB_WhiteSmoke_200, DisplayRectangle);
e.Graphics.DrawString("MONITOR PAUSE", FONT_TAHOMA_80_BOLD, Brushes.Gray, DisplayRectangle, new StringFormat
{
Alignment = StringAlignment.Center,
LineAlignment = StringAlignment.Center,
});
}
//if (!FullScreen && ShowIndex >= 0)
{
//트렌드뷰용채널데이터를 새로 만드는경우
//if (bMakeTrendViewChData) MakeTrendViewChData();
//마지막데이터와 2초의 차이가 있다면 데이터를 생성해준다.
DateTime NOwdate = DateTime.Now;
TimeSpan ts = NOwdate - LastNotifyTime;
if (ts.TotalSeconds >= NotifyDataSecond)
{
//알림
if (OnNotifyData != null) OnNotifyData(NOwdate);
LastNotifyTime = NOwdate;
}
}
}
catch (NullReferenceException ex1)
{
// UI 디스플레이 중, 예외발생 문제
}
catch (Exception ex)
{
// else error !!!
}
}