Files
ATV_STDLabelAttach/Handler/Sub/UIControl/PrintDirection.cs
ChiKyun Kim 9a7d1d27c7 프로젝트 구조 개선 및 README.md 추가
- UIControl 프로젝트 구조 변경 (CapCleaningControl → Sub/UIControl)
- arAjinextek 라이브러리 통합 및 구조 개선
- 새로운 arAjinextek_Union 프로젝트 추가
- 솔루션 파일에 README.md 추가
- QR 모드에서 WMS RCV 태그 인식 기능 강화
- 데이터베이스 스키마 업데이트 및 관련 클래스 수정
- 프린터 및 바코드 장치 연동 로직 개선

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-07 08:35:56 +09:00

107 lines
2.9 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace UIControl
{
public partial class PrintDirection : UserControl
{
public PrintDirection()
{
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);
this.SetStyle(ControlStyles.ContainerControl, false);
this.SetStyle(ControlStyles.Selectable, true);
this.Resize += Loader_Resize;
BorderColor = Color.Black;
}
[DisplayName("AR_TITLEFONT")]
public Font TitleFont { get; set; }
Boolean bRemake = true;
void Loader_Resize(object sender, EventArgs e)
{
if (this.Width < 16) this.Width = 16;
if (this.Height < 16) this.Height = 16;
bRemake = true;
}
public Color BorderColor { get; set; }
List<RectangleF> rects = new List<RectangleF>();
[DisplayName("AR_COLORS")]
public Color[] colors { get; set; }
[DisplayName("AR_TITLES")]
public string[] titles { get; set; }
protected override void OnPaint(PaintEventArgs e)
{
base.OnPaint(e);
var disprect = new Rectangle(DisplayRectangle.Left, DisplayRectangle.Top, DisplayRectangle.Width - 1, DisplayRectangle.Height - 1); ;
if (bRemake)
{
rects.Clear();
var w = (disprect.Width - 2) / 3f;
var h = (disprect.Height - 2) / 3f;
for (int i = 2; i >= 0; i--)
{
for (int j = 0; j < 3; j++)
{
var rect = new RectangleF(j * w + 2, i * h + 2, w - 2, h - 2);
rects.Add(rect);
}
}
}
for (int i = 0; i < rects.Count; i++)
{
var item = this.rects[i];
if (this.colors != null && i < this.colors.Length)
{
var color = this.colors[i];
if (color != Color.Transparent)
e.Graphics.FillRectangle(new SolidBrush(color), item);
}
//테두리 그리기
if (BorderColor != Color.Transparent)
e.Graphics.DrawRect(item, BorderColor, 1);
if (this.titles != null && i < this.titles.Length)
{
var title = this.titles[i];
if (string.IsNullOrEmpty(title) == false)
{
using (var br = new SolidBrush(this.ForeColor))
{
if (i == 4 && TitleFont != null)
e.Graphics.DrawString(title, this.TitleFont, br, rects[i], new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
else
e.Graphics.DrawString(title, this.Font, br, rects[i], new StringFormat { Alignment = StringAlignment.Center, LineAlignment = StringAlignment.Center });
}
}
}
}
//전체외곽
//e.Graphics.DrawRect(disprect, Color.Black, 1);
}
public void SetColor(int idx, Color color)
{
this.colors[idx] = color;
}
}
}