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/FunctionKeyBar.cs |  210 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 210 insertions(+), 0 deletions(-)

diff --git a/HotelPms.Share.Windows/Component/FunctionKeyBar.cs b/HotelPms.Share.Windows/Component/FunctionKeyBar.cs
new file mode 100644
index 0000000..d1b6a4d
--- /dev/null
+++ b/HotelPms.Share.Windows/Component/FunctionKeyBar.cs
@@ -0,0 +1,210 @@
+using System.Windows.Forms;
+using System.Drawing;
+using System.Drawing.Drawing2D;
+
+namespace HotelPms.Share.Windows.Component
+{
+    public partial class FunctionKeyBar : System.Windows.Forms.Control
+    {
+        private float m_Split = 5;
+        StringFormat format = new StringFormat();
+        RectangleF[] cellsRectTitle = new RectangleF[12];
+        RectangleF[] cellsRectKey = new RectangleF[12];
+        private string[] m_KeyContext = new string[] { string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty,
+                                                       string.Empty, string.Empty, string.Empty, string.Empty, string.Empty, string.Empty};
+
+        /// <summary>
+        /// F1の機能名
+        /// </summary>
+        public string KeyContextF01
+        {
+            set { m_KeyContext[0] = value; Invalidate(); }
+            get { return m_KeyContext[0]; }
+        }
+
+        /// <summary>
+        /// F2の機能名
+        /// </summary>
+        public string KeyContextF02
+        {
+            set { m_KeyContext[1] = value; Invalidate(); }
+            get { return m_KeyContext[1]; }
+        }
+
+        /// <summary>
+        /// F3の機能名
+        /// </summary>
+        public string KeyContextF03
+        {
+            set { m_KeyContext[2] = value; Invalidate(); }
+            get { return m_KeyContext[2]; }
+        }
+
+        /// <summary>
+        /// F4の機能名
+        /// </summary>
+        public string KeyContextF04
+        {
+            set { m_KeyContext[3] = value; Invalidate(); }
+            get { return m_KeyContext[3]; }
+        }
+
+        /// <summary>
+        /// F5の機能名
+        /// </summary>
+        public string KeyContextF05
+        {
+            set { m_KeyContext[4] = value; Invalidate(); }
+            get { return m_KeyContext[4]; }
+        }
+
+        /// <summary>
+        /// F6の機能名
+        /// </summary>
+        public string KeyContextF06
+        {
+            set { m_KeyContext[5] = value; Invalidate(); }
+            get { return m_KeyContext[5]; }
+        }
+
+        /// <summary>
+        /// F7の機能名
+        /// </summary>
+        public string KeyContextF07
+        {
+            set { m_KeyContext[6] = value; Invalidate(); }
+            get { return m_KeyContext[6]; }
+        }
+
+        /// <summary>
+        /// F8の機能名
+        /// </summary>
+        public string KeyContextF08
+        {
+            set { m_KeyContext[7] = value; Invalidate(); }
+            get { return m_KeyContext[7]; }
+        }
+
+        /// <summary>
+        /// F9の機能名
+        /// </summary>
+        public string KeyContextF09
+        {
+            set { m_KeyContext[8] = value; Invalidate(); }
+            get { return m_KeyContext[8]; }
+        }
+
+        /// <summary>
+        /// F10の機能名
+        /// </summary>
+        public string KeyContextF10
+        {
+            set { m_KeyContext[9] = value; Invalidate(); }
+            get { return m_KeyContext[9]; }
+        }
+
+        /// <summary>
+        /// F11の機能名
+        /// </summary>
+        public string KeyContextF11
+        {
+            set { m_KeyContext[10] = value; Invalidate(); }
+            get { return m_KeyContext[10]; }
+        }
+
+        /// <summary>
+        /// F12の機能名
+        /// </summary>
+        public string KeyContextF12
+        {
+            set { m_KeyContext[11] = value; Invalidate(); }
+            get { return m_KeyContext[11]; }
+        }
+
+        private Color m_CaptionBeginColor = Color.Maroon;
+
+        public Color CaptionBeginColor
+        {
+            get { return m_CaptionBeginColor; }
+            set { m_CaptionBeginColor = value; Invalidate(); }
+        }
+
+        private Color m_CaptionEndColor = Color.Gold;
+
+        public Color CaptionEndColor
+        {
+            get { return m_CaptionEndColor; }
+            set { m_CaptionEndColor = value; Invalidate(); }
+        }
+
+
+        public FunctionKeyBar()
+        {
+            SetStyle(ControlStyles.AllPaintingInWmPaint | ControlStyles.ResizeRedraw | ControlStyles.Opaque | ControlStyles.UserPaint | ControlStyles.DoubleBuffer | ControlStyles.Selectable | ControlStyles.UserMouse, true);
+            format.Alignment = StringAlignment.Center;
+            format.LineAlignment = StringAlignment.Center;            
+        }
+
+        protected override void OnPaint(PaintEventArgs e)
+        {
+            float width = (float)(this.Width - this.Padding.Left - this.Padding.Right - 2 * m_Split);
+            float height = (float)(this.Height - this.Padding.Top - this.Padding.Bottom);
+
+            float cellWidth = width / 12F;
+            float cellHeight = height / 2F;
+
+            float x = this.Padding.Left;
+            for (int i = 0; i < 12; i++)
+            { 
+                //上
+                cellsRectTitle[i] = new RectangleF(new PointF(x, this.Padding.Top), new SizeF(cellWidth, cellHeight));
+                
+                //下
+                cellsRectKey[i] = new RectangleF(new PointF(x, this.Padding.Top + cellHeight), new SizeF(cellWidth, cellHeight));
+               
+                x += cellWidth;
+                if ((i + 1) % 4 == 0) { x += m_Split; }
+            }
+
+            e.Graphics.FillRectangle(new SolidBrush(this.BackColor), 0, 0, this.Width, this.Height);
+            //e.Graphics.FillRectangles(Brushes.Maroon, cellsRectTitle);
+
+            for (int i = 0; i < 12; i++)
+            {
+                using (LinearGradientBrush brush = new LinearGradientBrush(cellsRectTitle[i], m_CaptionBeginColor, m_CaptionEndColor, LinearGradientMode.Vertical))
+                {
+                    brush.SetSigmaBellShape(0.4f, 0.45f);   //创建基于钟形曲线的渐变过渡过程。
+                    e.Graphics.FillRectangle(brush, cellsRectTitle[i]);
+                }
+            }
+           
+            e.Graphics.DrawRectangles(System.Drawing.Pens.Black, cellsRectTitle);
+
+            for (int i = 0; i < 12; i++)
+            {
+                string key = string.Format("F{0}", i + 1);
+                e.Graphics.DrawString(key, this.Font, Brushes.White, cellsRectTitle[i], format);
+
+                if (m_KeyContext[i].Length > 0)
+                {
+                    using (LinearGradientBrush brush = new LinearGradientBrush(cellsRectKey[i], Color.FromArgb(50, 169, 200), Color.FromArgb(0, 109, 189), LinearGradientMode.Vertical))
+                    {
+
+                        brush.SetSigmaBellShape(0.4f, 0.45f);   //创建基于钟形曲线的渐变过渡过程。
+                        e.Graphics.FillRectangle(brush, cellsRectKey[i]);
+                    }
+                }
+                else
+                {
+                    e.Graphics.FillRectangle(new SolidBrush((m_KeyContext[i].Length > 0) ? Color.FromArgb(0, 109, 189) : this.BackColor), cellsRectKey[i].X, cellsRectKey[i].Y, cellsRectKey[i].Width, cellsRectKey[i].Height);
+                }
+                e.Graphics.DrawRectangle(System.Drawing.Pens.Black, cellsRectKey[i].X, cellsRectKey[i].Y, cellsRectKey[i].Width, cellsRectKey[i].Height);
+                if (m_KeyContext[i].Length > 0) { e.Graphics.DrawString(m_KeyContext[i], this.Font, Brushes.Yellow, cellsRectKey[i], format); }
+            }
+            
+
+            base.OnPaint(e);
+        }
+        
+    }
+}

--
Gitblit v1.10.0