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

diff --git a/HotelPms.Share.Windows/Util/ComboBoxItem.cs b/HotelPms.Share.Windows/Util/ComboBoxItem.cs
new file mode 100644
index 0000000..b11a155
--- /dev/null
+++ b/HotelPms.Share.Windows/Util/ComboBoxItem.cs
@@ -0,0 +1,83 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.Windows.Forms;
+
+namespace HotelPms.Share.Windows.Util
+{
+    public class ComboBoxItem
+    {
+        private string m_Key = string.Empty;
+
+        public string Key
+        {
+            get { return m_Key; }
+            set { m_Key = value; }
+        }
+
+        private string m_Text = string.Empty;
+
+        public string Text
+        {
+            get { return m_Text; }
+            set { m_Text = value; }
+        }
+
+        private object m_Tag = null;
+
+        public object Tag
+        {
+            get { return m_Tag; }
+            set { m_Tag = value; }
+        }
+
+        public ComboBoxItem(string key, string text)
+        {
+            this.m_Key = key;
+            this.m_Text = text;
+        }
+
+        public override string ToString()
+        {
+            return m_Text;
+        }
+
+        public static void AddComboBox(ComboBox obj, Type type)
+        {
+            AddComboBox(obj, type, false, -1);
+        }
+
+        public static void AddComboBox(ComboBox obj, Type type, bool useBlank)
+        {
+            AddComboBox(obj, type, useBlank, -1);
+        }
+
+        public static void AddComboBox(ComboBox obj, Type type, bool useBlank, int defID)
+        {
+            int selIndex = 0;
+            obj.Items.Clear();
+            int i = 0;
+            if (useBlank)
+            {
+                obj.Items.Add(new ComboBoxItem("-1", string.Empty));
+                i++;
+            }
+
+            foreach (object item in Enum.GetValues(type))
+            {
+                int id = (int)item;
+                string name = item.ToString();
+                if (name.Contains("_"))
+                {
+                    string[] items = name.Split(new char[] { '_' });
+                    if (items.Length == 2) { name = string.Format("{0}({1})", items[0], items[1]); }
+                }
+
+                obj.Items.Add(new ComboBoxItem(id.ToString(), name));
+                if (id == defID) { selIndex = i; }
+                i++;
+            }
+            obj.SelectedIndex = selIndex;
+        }
+    }
+}

--
Gitblit v1.10.0