From 1a1c8e71fcd14858f595029f089b2d4a00202b32 Mon Sep 17 00:00:00 2001
From: ogi <Administrator@S-OGI-PC>
Date: Fri, 05 Dec 2025 09:24:16 +0900
Subject: [PATCH] プロジェクトファイルを追加。
---
HotelPms.Share.Windows/Component/AntLabel.cs | 168 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 168 insertions(+), 0 deletions(-)
diff --git a/HotelPms.Share.Windows/Component/AntLabel.cs b/HotelPms.Share.Windows/Component/AntLabel.cs
new file mode 100644
index 0000000..71c860a
--- /dev/null
+++ b/HotelPms.Share.Windows/Component/AntLabel.cs
@@ -0,0 +1,168 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+using System.Drawing.Drawing2D;
+using System.Drawing;
+using System.ComponentModel;
+using Timer = System.Windows.Forms.Timer;
+
+namespace HotelPms.Share.Windows.Component
+{
+ public class AntLabel : Label
+ {
+ private int m_BeginX = 0;
+ private Timer timer1;
+ private System.ComponentModel.IContainer components;
+ private StringFormat sf = null;
+ private bool m_AnimationEnabled = false;
+
+ public bool AnimationEnabled
+ {
+ get { return m_AnimationEnabled; }
+ set
+ {
+ m_AnimationEnabled = value;
+ timer1.Enabled = m_AnimationEnabled;
+ this.Invalidate();
+ }
+ }
+
+ private int m_Interval = 300;
+
+ public int Interval
+ {
+ get { return m_Interval; }
+ set
+ {
+ m_Interval = value;
+ if (timer1 != null)
+ {
+ timer1.Interval = m_Interval;
+ this.Invalidate();
+ }
+ }
+ }
+
+ public AntLabel()
+ {
+ InitializeComponent();
+ sf = new StringFormat();
+ sf.Alignment = StringAlignment.Center;
+ sf.LineAlignment = StringAlignment.Center;
+ timer1.Enabled = false;
+ }
+
+ private LinearGradientMode m_GradientMode = LinearGradientMode.Vertical;
+ [Description("EndBackColor"), Category("CTextBoxArray動作")]
+ public LinearGradientMode GradientMode
+ {
+ get { return m_GradientMode; }
+ set { m_GradientMode = value; this.Invalidate(); }
+ }
+
+
+ private Color m_EndBackColor = Color.FromArgb(120, 150, 150);
+
+ [Description("EndBackColor"), Category("CTextBoxArray動作")]
+ public Color EndBackColor
+ {
+ get { return m_EndBackColor; }
+ set { m_EndBackColor = value; this.Invalidate(); }
+ }
+
+ protected override void OnPaint(PaintEventArgs e)
+ {
+ base.OnPaint(e);
+
+ int offset = 3;
+ Rectangle r = new Rectangle(offset, offset, this.ClientRectangle.Width - offset, this.ClientRectangle.Height - offset);
+
+ if (m_AnimationEnabled)
+ {
+ using (LinearGradientBrush lgb = new LinearGradientBrush(new Rectangle(m_BeginX, 0, this.Width, this.Height), Color.White, Color.Gainsboro, LinearGradientMode.Horizontal))
+ {
+ Color[] colors = new Color[]
+ {
+ Color.FromArgb(255, 0, 0),
+ Color.FromArgb(255, 0, 0),
+ Color.FromArgb(255, 128, 0),
+ Color.FromArgb(255, 255, 0),
+ Color.FromArgb(0, 255, 0),
+ Color.FromArgb(0, 255, 128),
+ Color.FromArgb(0, 255, 255),
+ Color.FromArgb(0, 128, 255),
+ Color.FromArgb(0, 0, 255),
+ Color.FromArgb(0, 0, 255),
+ };
+
+ int num_colors = colors.Length;
+ float[] blend_positions = new float[num_colors];
+ for (int i = 0; i < num_colors; i++)
+ {
+ blend_positions[i] = i / (num_colors - 1f);
+ }
+
+ ColorBlend color_blend = new ColorBlend();
+ color_blend.Colors = colors;
+ color_blend.Positions = blend_positions;
+ lgb.InterpolationColors = color_blend;
+
+ //e.Graphics.Clear(this.BackColor);
+ using (LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, m_EndBackColor, BackColor, m_GradientMode))
+ {
+ brush.SetSigmaBellShape(0.4f, 0.45f); //创建基于钟形曲线的渐变过渡过程。
+ e.Graphics.FillRectangle(brush, this.ClientRectangle);
+ }
+
+ // Draw the string again.
+ e.Graphics.DrawString(this.Text, this.Font, lgb, r, sf);
+ }
+ }
+ else
+ {
+ using (Brush defBrush = new SolidBrush(this.ForeColor))
+ {
+ //e.Graphics.Clear(this.BackColor);
+ using (LinearGradientBrush brush = new LinearGradientBrush(this.ClientRectangle, m_EndBackColor, BackColor, m_GradientMode))
+ {
+ brush.SetSigmaBellShape(0.4f, 0.45f); //创建基于钟形曲线的渐变过渡过程。
+ e.Graphics.FillRectangle(brush, this.ClientRectangle);
+ }
+
+ e.Graphics.DrawString(this.Text, this.Font, defBrush, r, sf);
+ }
+ }
+ }
+
+ private void InitializeComponent()
+ {
+ this.components = new System.ComponentModel.Container();
+ this.timer1 = new System.Windows.Forms.Timer(this.components);
+ this.SuspendLayout();
+ //
+ // timer1
+ //
+ this.timer1.Interval = 1000;
+ this.timer1.Tick += new System.EventHandler(this.timer1_Tick);
+ this.ResumeLayout(false);
+
+ }
+
+ private void timer1_Tick(object sender, EventArgs e)
+ {
+ try
+ {
+ timer1.Enabled = false;
+ m_BeginX += 5;
+ if (m_BeginX > this.Width) { m_BeginX = 0; }
+ this.Invalidate();
+ }
+ catch { }
+ finally
+ {
+ timer1.Enabled = true;
+ }
+ }
+ }
+}
--
Gitblit v1.10.0