• R/O
  • SSH
  • HTTPS

mlapplication: Commit


Commit MetaInfo

Revision72 (tree)
Time2018-02-26 21:26:41
Authoryukio_miura

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunk/ML.DBAccess/DataBase/99.共有/ソース/稼働日.txt (revision 0)
+++ trunk/ML.DBAccess/DataBase/99.共有/ソース/稼働日.txt (revision 72)
@@ -0,0 +1,106 @@
1+'C50????n?c?Ɠ???̓??t???擾????
2+'?y?????z
3+'@dtSIME :?N?_?ƂȂ???t
4+'@intUPD_DATE :?c?Ɠ???
5+Public Function Get_C50SIME(dtSIME As Date) As Variant
6+ Dim DB As Database
7+ Dim T1 As Recordset
8+ Dim SQL As String
9+ Dim YYMM As Date
10+ Dim DD As Integer
11+ Dim addDD As Integer '???Z???????
12+ Dim intUPD_DATE_Loop As Integer
13+ Dim dtTMP As Date
14+ Dim intUPD_DATE As Integer
15+ Dim RetC50YYMM1 As Date
16+ Dim RetC50DD1 As Integer
17+
18+ Set DB = CurrentDb()
19+
20+ 'dtSIME?̔N?????擾????
21+ YYMM = CDate(Format(dtSIME, "yyyy/mm"))
22+
23+ 'dtSIME?̓??ɂ????擾????
24+ DD = Format(dtSIME, "dd") + 1
25+
26+ '?N?_????ϐ??ɑޔ?
27+ dtTMP = dtSIME
28+
29+ 'C91????c?Ɠ??????擾
30+ intUPD_DATE = NVL(DLookup("C91_UPD1", "C91_FILE", "C91_KEY1='UPD_DATE' AND C91_NO1=0"))
31+
32+ If intUPD_DATE = 0 Then Exit Function
33+
34+ addDD = 0
35+
36+ SQL = "SELECT * FROM C50_FILE"
37+ SQL = SQL & " WHERE C50_YYMM1>=" & DT_Str(YYMM)
38+ Set T1 = DB.OpenRecordset(SQL, dbOpenSnapshot)
39+ If Not T1.EOF Then
40+
41+ Do
42+ If DD > 31 Then
43+ T1.MoveNext
44+ DD = 1
45+ Else
46+ If IsNull(T1.Fields("C50_KUBN" & Format(DD, "00")).Value) Then
47+ T1.MoveNext
48+ If T1.EOF = True Then
49+ addDD = 0
50+ Exit Do
51+ End If
52+ DD = 1
53+ End If
54+ End If
55+ 'C50_KUBNxx
56+ If T1.Fields("C50_KUBN" & Format(DD, "00")).Value = 0 Then
57+ addDD = addDD + 1
58+ End If
59+
60+ RetC50YYMM1 = T1.Fields("C50_YYMM1").Value
61+ RetC50DD1 = DD
62+
63+ DD = DD + 1
64+
65+ Loop Until addDD = intUPD_DATE
66+
67+ End If
68+ T1.Close
69+ DB.Close
70+
71+ '?N?_???ɉ??Z?????𑫂?
72+ If addDD <> 0 Then
73+ Get_C50SIME = CDate(Format(RetC50YYMM1, "yyyy/mm") & "/" & Format(RetC50DD1, "00"))
74+ Else
75+ Get_C50SIME = Null
76+ End If
77+
78+End Function
79+
80+'?????Ƃ??Ďw?肵?????t???x?????ʏ?????𔻒肷??
81+'Get_C50Flg = True:?x?? False:?ʏ??
82+Public Function Get_C50Flg(dt As Date) As Boolean
83+ Dim DB As Database
84+ Dim T1 As Recordset
85+ Dim SQL As String
86+ Dim intDD As Integer
87+ Dim intC50KB1 As Integer
88+
89+ Set DB = CurrentDb()
90+
91+ SQL = "SELECT * FROM C50_FILE"
92+ SQL = SQL & " WHERE C50_YYMM1<=" & DT_Str(dt)
93+ SQL = SQL & " ORDER BY C50_YYMM1 DESC"
94+ Set T1 = DB.OpenRecordset(SQL, dbOpenSnapshot)
95+ If Not T1.EOF Then
96+ intDD = Format(dt, "dd")
97+ intC50KB1 = T1.Fields("C50_KUBN" & Format(intDD, "00")).Value
98+ If intC50KB1 = 1 Then
99+ Get_C50Flg = True
100+ Else
101+ Get_C50Flg = False
102+ End If
103+ End If
104+ T1.Close
105+ DB.Close
106+End Function
\ No newline at end of file
--- trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/Person.vb (revision 0)
+++ trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/Person.vb (revision 72)
@@ -0,0 +1,61 @@
1+
2+''' <summary>
3+''' 【クラス名】Person
4+''' 【機能概要】ユーザー情報?
5+''' </summary>
6+''' <history>
7+''' [y.miura] 14.11.27 001 コメント表記変更
8+''' </history>
9+Public Class Person
10+
11+ ''' <summary>コンストラクタ生成</summary>
12+ Public Sub New()
13+ Me.ID = String.Empty
14+ Me.Name = String.Empty
15+ End Sub
16+
17+ ''' <summary>コンストラクタ生成</summary>
18+ ''' <param name="id">ユーザーID</param>
19+ ''' <param name="name">ユーザー名</param>
20+ Public Sub New(ByVal id As String, _
21+ ByVal name As String)
22+ Me.New()
23+
24+ Me.ID = id
25+ Me.Name = name
26+ End Sub
27+
28+ ''' <summary>ユーザーID</summary>
29+ Private m_ID As String
30+
31+ ''' <summary>ユーザー名</summary>
32+ Private m_Name As String
33+
34+ ''' <summary>ユーザーID</summary>
35+ Public Property ID() As String
36+ Get
37+ Return Me.m_ID
38+ End Get
39+ Set(ByVal value As String)
40+ Me.m_ID = value
41+ End Set
42+ End Property
43+
44+ ''' <summary>ユーザー名</summary>
45+ Public Property Name() As String
46+ Get
47+ Return Me.m_Name
48+ End Get
49+ Set(ByVal value As String)
50+ Me.m_Name = value
51+ End Set
52+ End Property
53+
54+ ''' <summary>ユーザーID取得</summary>
55+ Public ReadOnly Property Display() As String
56+ Get
57+ Return String.Format("{0}", Me.ID)
58+ End Get
59+ End Property
60+
61+End Class
--- trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/tscMultiColumnComboBox.vb (revision 0)
+++ trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/tscMultiColumnComboBox.vb (revision 72)
@@ -0,0 +1,425 @@
1+
2+Imports System
3+Imports System.ComponentModel
4+Imports System.Drawing
5+Imports System.Windows.Forms
6+Imports System.Runtime.InteropServices
7+
8+''' <summary>
9+''' 【クラス名】tscMultiColumnComboBox
10+''' 【機能概要】コンボボックスのカスタムコントロール
11+''' </summary>
12+''' <history>
13+''' [y.miura] 14.11.27 001 コメント表記変更
14+''' [y.miura] 14.12.09 002 SetValueItemsメソッドを追加
15+''' [y.miura] 14.12.10 003 値リストに空白行を追加する処理を追加、及び空白行の追加有無を指定するAirLineAddプロパティを追加
16+''' [y.miura] 14.12.26 004 高さをItemHeightで指定可能にする機能を追加
17+''' [方法]DrawModeプロパティをDrawMode.OwnerDrawFixedに設定する
18+''' [y.miura] 15.01.13 005 004の調整
19+''' [y.miura] 15.01.20 006 004の調整(Enabled = False時に背景色がグレーにならない件を修正)
20+''' </history>
21+<System.Drawing.ToolboxBitmap(GetType(ComboBox))>
22+Public Class tscMultiColumnComboBox
23+ Inherits System.Windows.Forms.ComboBox
24+
25+#Region " 共通変数・定数"
26+
27+ ''' <summary>複数列表示する際の列情報</summary>
28+ Private m_ColumnData As ComboBoxColumnData
29+
30+ ''' <summary>フォーカス取得時に設定する背景色</summary>
31+ Private m_GotFocusColor As System.Drawing.Color = System.Drawing.Color.Cyan
32+
33+ ''' <summary>DataSouceプロパティ用のDataTableにおける表示順列名</summary>
34+ Private m_SeqColumnName = "SEQ_Column"
35+
36+ ''' <summary>値リストに対する空白行挿入有無</summary>
37+ Private m_AirLineAdd As Boolean = True
38+
39+ ''' <summary>値リストにおけるコードと名称のセパレータ文字</summary>
40+ Private Const DATASOURCE_DISPLAY_SEP As String = ":"
41+
42+#End Region
43+
44+#Region " プロパティ"
45+
46+ ''' <summary>複数列表示する際の情報を取得または設定します</summary>
47+ <Browsable(False)> _
48+ <DefaultValue(GetType(ComboBoxColumnData), Nothing)> _
49+ Public Property ColumnData() As ComboBoxColumnData
50+ Get
51+ Return Me.m_ColumnData
52+ End Get
53+ Set(ByVal value As ComboBoxColumnData)
54+ Me.m_ColumnData = value
55+ End Set
56+ End Property
57+
58+ ''' <summary>フォーカス取得時に設定する背景色を取得または設定します</summary>
59+ Public Overridable Property GotForcusColor() As System.Drawing.Color
60+ Get
61+ Return Me.m_GotFocusColor
62+ End Get
63+
64+ Set(value As System.Drawing.Color)
65+ Me.m_GotFocusColor = value
66+ End Set
67+ End Property
68+
69+ ' ADD 003 y.miura 2014/12/10 >>
70+ ''' <summary>値リストに空白行を挿入するかを設定します</summary>
71+ <Description("値リストに空白行を挿入するかを設定します")> _
72+ <Category("表示")> _
73+ <Browsable(True)> _
74+ Public Property AirLineAdd As Boolean
75+ Get
76+ Return Me.m_AirLineAdd
77+ End Get
78+ Set(value As Boolean)
79+ Me.m_AirLineAdd = value
80+ End Set
81+ End Property
82+ ' ADD 003 y.miura 2014/12/10 >>
83+
84+#End Region
85+
86+#Region " メソッド"
87+
88+ ' MOD 005 y.miura 2015.01.13 >>
89+
90+ ''' <summary>OnDrawItemイベント</summary>
91+ ''' <param name="e">DrawItemEventArgs</param>
92+ Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs)
93+
94+ ' 背景を描画する
95+ ' 項目が選択されている時は強調表示される
96+ e.DrawBackground()
97+
98+ Dim cmb As ComboBox = CType(Me, ComboBox)
99+ ' 項目に表示する文字列
100+ Dim txt As String = Me.CreateDrawText(cmb, e.Index)
101+ ' 使用するブラシ
102+ Using b As New SolidBrush(e.ForeColor)
103+
104+ ' 文字列を描画する
105+ Dim ym As Single = _
106+ (e.Bounds.Height - e.Graphics.MeasureString(txt, cmb.Font).Height) / 2
107+ e.Graphics.DrawString(txt, cmb.Font, b, e.Bounds.X, e.Bounds.Y + ym)
108+
109+ End Using
110+
111+ ' フォーカスを示す四角形を描画
112+ e.DrawFocusRectangle()
113+
114+ End Sub
115+
116+ ''' <summary>OnMeasureItemイベント</summary>
117+ ''' <param name="e">MeasureItemEventArgs</param>
118+ Protected Overrides Sub OnMeasureItem(ByVal e As System.Windows.Forms.MeasureItemEventArgs)
119+
120+ Dim cmb As ComboBox = CType(Me, ComboBox)
121+ ' 項目に表示する文字列
122+ Dim txt As String = Me.CreateDrawText(cmb, e.Index)
123+ ' 項目の高さを決定
124+ e.ItemHeight = CInt(e.Graphics.MeasureString(txt, cmb.Font).Height)
125+
126+ End Sub
127+
128+ ''' <summary>CreateDrawTextメソッド</summary>
129+ ''' <param name="cmb">対象コンボボックス</param>
130+ ''' <param name="index">選択された値リストのインデックス</param>
131+ Private Function CreateDrawText(ByVal cmb As ComboBox, _
132+ ByVal index As Integer) As String
133+
134+ If index > -1 Then
135+
136+ ' 描画文字列を生成
137+ Dim item As Object = cmb.Items(index)
138+ Dim dispObject As Object = item
139+ Dim valueObject As Object = Nothing
140+
141+ If cmb.DataSource IsNot Nothing Then
142+ Dim bmb As BindingManagerBase = cmb.BindingContext(cmb.DataSource)
143+ Dim properties As PropertyDescriptorCollection = bmb.GetItemProperties()
144+
145+ Dim dispProp As PropertyDescriptor = properties(cmb.DisplayMember)
146+ Dim valueProp As PropertyDescriptor = properties(cmb.ValueMember)
147+
148+ If dispProp IsNot Nothing Then
149+ dispObject = dispProp.GetValue(item)
150+ End If
151+ If valueProp IsNot Nothing Then
152+ valueObject = valueProp.GetValue(item)
153+ End If
154+ End If
155+ If valueObject Is Nothing Then
156+ Return TypeDescriptor.GetConverter(dispObject).ConvertToString(dispObject)
157+ Else
158+ Return TypeDescriptor.GetConverter(dispObject).ConvertToString(dispObject)
159+ End If
160+ Else
161+ Return cmb.Text
162+ End If
163+ End Function
164+
165+ 'Protected Overrides Sub OnDrawItem(ByVal e As System.Windows.Forms.DrawItemEventArgs)
166+ ' If e.Index = -1 Then
167+ ' Return
168+ ' End If
169+
170+ ' ' 背景を描画
171+ ' If Me.Enabled = False Then
172+
173+ ' ' 既定の描画がされている
174+
175+ ' ElseIf (e.State And DrawItemState.Selected) = DrawItemState.Selected Then
176+
177+ ' ' 選択中
178+ ' Using sb As New SolidBrush(e.BackColor)
179+ ' e.Graphics.FillRectangle(sb, e.Bounds)
180+ ' End Using
181+
182+ ' Else
183+ ' Using sb As New SolidBrush(e.BackColor)
184+ ' e.Graphics.FillRectangle(sb, e.Bounds)
185+ ' End Using
186+
187+ ' End If
188+
189+ ' Dim item As Object = Me.Items(e.Index)
190+ ' If item Is Nothing Then
191+ ' Return
192+ ' End If
193+
194+ ' ' テキストを描画
195+ ' If (e.State And DrawItemState.ComboBoxEdit) = DrawItemState.ComboBoxEdit Then
196+ ' ' コンボボックスの部分 (DropDownStyle = DropDownList のみ)
197+ ' Using sf As New StringFormat
198+ ' sf.LineAlignment = StringAlignment.Center
199+
200+ ' If Me.ColumnData Is Nothing Then
201+ ' ' 文字列を表示
202+ ' Using sb As SolidBrush = Me.CreateForeBlush(e)
203+ ' e.Graphics.DrawString(item.ToString, e.Font, sb, e.Bounds, sf)
204+ ' End Using
205+
206+ ' Else
207+ ' ' 複数列表示
208+ ' Using sb As SolidBrush = Me.CreateForeBlush(e)
209+ ' If Me.DisplayMember = String.Empty Then
210+ ' e.Graphics.DrawString(Me.ColumnData.DisplayValue(item, 0), e.Font, sb, e.Bounds, sf)
211+ ' Else
212+ ' e.Graphics.DrawString(Me.ColumnData.DisplayValue(item, Me.DisplayMember), e.Font, sb, e.Bounds, sf)
213+ ' End If
214+ ' End Using
215+
216+ ' End If
217+ ' End Using
218+
219+ ' Else
220+ ' ' ドロップダウンの部分
221+ ' Using sf As New StringFormat
222+ ' sf.LineAlignment = StringAlignment.Center
223+
224+ ' If Me.ColumnData Is Nothing Then
225+ ' ' 文字列を表示
226+ ' Using sb As SolidBrush = Me.CreateForeBlush(e)
227+ ' e.Graphics.DrawString(item.ToString, e.Font, sb, e.Bounds, sf)
228+ ' End Using
229+
230+ ' Else
231+ ' ' 複数列表示
232+ ' Dim offsetX As Integer = e.Bounds.X
233+ ' For i As Integer = 0 To Me.ColumnData.ColumnCount - 1
234+ ' Dim r As New Rectangle(offsetX, e.Bounds.Y, Me.ColumnData.Width(i), e.Bounds.Height)
235+
236+ ' ' 項目
237+ ' Dim pad As Padding = Me.ColumnData.Padding(i)
238+ ' Dim valueRect As New Rectangle(r.X + pad.Left, r.Y + pad.Top, r.Width - pad.Left - pad.Right, r.Height - pad.Top - pad.Bottom)
239+ ' Using sb As SolidBrush = Me.CreateForeBlush(e)
240+ ' e.Graphics.DrawString(Me.ColumnData.DisplayValue(item, i), e.Font, sb, valueRect, sf)
241+ ' End Using
242+
243+ ' ' 区切り線
244+ ' If i < Me.ColumnData.ColumnCount - 1 Then
245+ ' Dim lineX As Integer = offsetX + Me.ColumnData.Width(i) - 1
246+ ' e.Graphics.DrawLine(Pens.Gray, lineX, e.Bounds.Y, lineX, e.Bounds.Bottom)
247+ ' End If
248+
249+ ' offsetX += Me.ColumnData.Width(i)
250+ ' Next
251+
252+ ' End If
253+ ' End Using
254+
255+ ' End If
256+
257+ ' ' フォーカス枠を描画
258+ ' e.DrawFocusRectangle()
259+
260+ ' MyBase.OnDrawItem(e)
261+ 'End Sub
262+
263+ ' MOD 005 y.miura 2015.01.13 >>
264+
265+ ''' <summary>単色のブラシを作成する</summary>
266+ ''' <param name="e">DrawItemEventArgs</param>
267+ Private Function CreateForeBlush(ByVal e As System.Windows.Forms.DrawItemEventArgs) As SolidBrush
268+ If Me.Enabled = True Then
269+ Return New SolidBrush(e.ForeColor)
270+ Else
271+ Return New SolidBrush(SystemColors.GrayText)
272+ End If
273+ End Function
274+
275+ ' ADD 002 y.miura 2014/12/09 >>
276+
277+ ''' <summary>値リストを設定する</summary>
278+ ''' <param name="_dt">値リストのデータソースとなるDataTable</param>
279+ ''' <param name="_iKeta">コード部分の桁数</param>
280+ Public Sub SetValueItems(ByVal _dt As DataTable, _
281+ Optional ByVal _iKeta As Integer = 0)
282+ Dim dcValueItems_Seq As DataColumn
283+ Dim dcValueItems_Value As DataColumn
284+ Dim dcValueItems_Display As DataColumn
285+ Dim dtValueItems As New DataTable
286+ Dim drValueItems As DataRow
287+ Dim iSEQ As Integer = 0
288+
289+ Try
290+
291+ ' DataSourceプロパティ用のDataTableを作成する
292+ dcValueItems_Seq = New DataColumn
293+ dcValueItems_Seq.ColumnName = Me.m_SeqColumnName
294+ dtValueItems.Columns.Add(dcValueItems_Seq)
295+ dcValueItems_Value = New DataColumn
296+ dcValueItems_Value.ColumnName = Me.ValueMember
297+ dtValueItems.Columns.Add(dcValueItems_Value)
298+ dcValueItems_Display = New DataColumn
299+ dcValueItems_Display.ColumnName = Me.DisplayMember
300+ dtValueItems.Columns.Add(dcValueItems_Display)
301+
302+ ' 空白行挿入有無判定
303+ If Me.m_AirLineAdd = True Then
304+
305+ ' DataSourceの新規行を作成(空白行用)
306+ drValueItems = dtValueItems.Rows.Add
307+
308+ ' 空白行用の値をセット
309+ With drValueItems
310+
311+ .Item(Me.m_SeqColumnName) = -1
312+ .Item(Me.ValueMember) = ""
313+ .Item(Me.DisplayMember) = ""
314+
315+ End With
316+
317+ End If
318+
319+ ' DataSourceプロパティ用のDataTableにレコードを追加する
320+ For Each dr As DataRow In _dt.Rows
321+
322+ ' DataSourceの新規行を作成
323+ drValueItems = dtValueItems.Rows.Add
324+
325+ ' ValueMemberをセット
326+ drValueItems.Item(Me.ValueMember) = dr.Item(Me.ValueMember)
327+
328+ Dim sDisplayMemberValue As String = ""
329+ If _iKeta > 0 Then
330+
331+ ' コードを指定桁で固定長とする
332+ sDisplayMemberValue = dr.Item(Me.ValueMember).ToString.PadLeft(_iKeta)
333+
334+ Else
335+ sDisplayMemberValue = dr.Item(Me.ValueMember).ToString
336+ End If
337+
338+ ' DisplayMemberをセット
339+ drValueItems.Item(Me.DisplayMember) = sDisplayMemberValue & DATASOURCE_DISPLAY_SEP & dr.Item(Me.DisplayMember)
340+
341+ ' 表示順番号をセット
342+ drValueItems.Item(Me.m_SeqColumnName) = iSEQ
343+
344+ ' 表示順番号をインクリメント
345+ iSEQ += 1
346+
347+ Next
348+
349+ ' DataSourceプロパティにDataTableをセットする
350+ Me.DataSource = dtValueItems
351+
352+ Catch ex As Exception
353+ '' 呼び出し元へスロー
354+ Throw ex
355+ Finally
356+ End Try
357+
358+ End Sub
359+ ' ADD 002 y.miura 2014/12/09 >>
360+
361+#End Region
362+
363+#Region " イベント"
364+
365+ ''' <summary>OnLostFocusイベント</summary>
366+ ''' <param name="e">EventArgs</param>
367+ Protected Overrides Sub OnLostFocus(ByVal e As System.EventArgs)
368+ MyBase.OnLostFocus(e)
369+ Me.BackColor = System.Drawing.SystemColors.Window
370+ End Sub
371+
372+ ''' <summary>OnGotFocusイベント</summary>
373+ ''' <param name="e">EventArgs</param>
374+ Protected Overrides Sub OnGotFocus(ByVal e As System.EventArgs)
375+ MyBase.OnGotFocus(e)
376+ Me.BackColor = Me.m_GotFocusColor
377+ End Sub
378+
379+ ''' <summary>OnEnabledChangedイベント</summary>
380+ ''' ''' <param name="e">EventArgs</param>
381+ Protected Overrides Sub OnEnabledChanged(e As System.EventArgs)
382+ MyBase.OnEnabledChanged(e)
383+
384+ ' 活性時/非活性時でDropDownStyleを切り替える
385+ If Me.Enabled = True Then
386+ Me.DropDownStyle = ComboBoxStyle.DropDownList
387+ Else
388+ Me.DropDownStyle = ComboBoxStyle.DropDown
389+ End If
390+
391+ End Sub
392+
393+#End Region
394+
395+ ' ''' <summary>DrawIteイベント</summary>
396+ 'Private Sub tscMultiColumnComboBox_DrawItem(sender As Object, e As System.Windows.Forms.DrawItemEventArgs) Handles Me.DrawItem
397+
398+ ' ' 背景を描画する
399+ ' ' 項目が選択されている時は強調表示される
400+ ' e.DrawBackground()
401+
402+ ' Dim cmb As ComboBox = CType(sender, ComboBox)
403+ ' ' 項目に表示する文字列
404+ ' Dim sStringValue As String
405+ ' If (e.Index > -1) Then
406+ ' sStringValue = cmb.Items(e.Index).ToString()
407+ ' Else
408+ ' sStringValue = cmb.Text
409+ ' End If
410+
411+ ' ' 使用するブラシ
412+ ' Dim b As Brush = New SolidBrush(e.ForeColor)
413+ ' ' 文字列を描画する
414+ ' Dim ym As Single = (e.Bounds.Height - _
415+ ' e.Graphics.MeasureString(sStringValue, cmb.Font).Height) / 2
416+ ' e.Graphics.DrawString(sStringValue, cmb.Font, b, _
417+ ' e.Bounds.X, e.Bounds.Y + ym)
418+ ' b.Dispose()
419+
420+ ' ' フォーカスを示す四角形を描画
421+ ' e.DrawFocusRectangle()
422+
423+ 'End Sub
424+
425+End Class
--- trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/ComboBoxColumnData.vb (revision 0)
+++ trunk/ML.DBAccess/DataBase/99.共有/ソース/ComboBox/ComboBoxColumnData.vb (revision 72)
@@ -0,0 +1,115 @@
1+
2+Imports System
3+Imports System.Collections.Generic
4+Imports System.Reflection
5+Imports System.Windows.Forms
6+
7+''' <summary>
8+''' 【クラス名】ComboBoxColumnData
9+''' 【機能概要】コンボボックス列情報
10+''' </summary>
11+''' <history>
12+''' [y.miura] 14.11.27 001 コメント表記変更
13+''' </history>
14+Public Class ComboBoxColumnData
15+
16+ ''' <summary>コンストラクタ生成</summary>
17+ Public Sub New()
18+ Me.ColumnCount = 0
19+ Me.m_Width = New Integer() {}
20+ Me.m_Padding = New Padding() {}
21+ Me.m_DisplayName = New String() {}
22+ End Sub
23+
24+ ''' <summary>コンストラクタ生成</summary>
25+ ''' <param name="columnCount">列数</param>
26+ Public Sub New(ByVal columnCount As Integer)
27+ Me.New()
28+ Me.ColumnCount = columnCount
29+ End Sub
30+
31+ ''' <summary>列数</summary>
32+ Private m_ColumnCount As Integer
33+
34+ ''' <summary>列幅</summary>
35+ Private m_Width As Integer()
36+
37+ ''' <summary>項目の埋め込み</summary>
38+ Private m_Padding As Padding()
39+
40+ ''' <summary>列に表示するプロパティ名</summary>
41+ Private m_DisplayName As String()
42+
43+ ''' <summary>列数を取得または設定します</summary>
44+ Public Property ColumnCount() As Integer
45+ Get
46+ Return Me.m_ColumnCount
47+ End Get
48+ Set(ByVal value As Integer)
49+ If Me.m_ColumnCount = value Then
50+ Return
51+ End If
52+
53+ Me.m_ColumnCount = value
54+
55+ Array.Resize(Me.m_Width, value)
56+ Array.Resize(Me.m_Padding, value)
57+ Array.Resize(Me.m_DisplayName, value)
58+ End Set
59+ End Property
60+
61+ ''' <summary>列の幅を取得または設定します</summary>
62+ ''' <param name="index">列を示すインデックス</param>
63+ Public Property Width(ByVal index As Integer) As Integer
64+ Get
65+ Return Me.m_Width(index)
66+ End Get
67+ Set(ByVal value As Integer)
68+ Me.m_Width(index) = value
69+ End Set
70+ End Property
71+
72+ ''' <summary>項目の埋め込みを取得または設定します。</summary>
73+ ''' <param name="index">列を示すインデックス</param>
74+ Public Property Padding(ByVal index As Integer) As Padding
75+ Get
76+ Return Me.m_Padding(index)
77+ End Get
78+ Set(ByVal value As Padding)
79+ Me.m_Padding(index) = value
80+ End Set
81+ End Property
82+
83+ ''' <summary>列に表示するプロパティ名を取得または設定します</summary>
84+ ''' <param name="index">列を示すインデックス</param>
85+ Public Property DisplayName(ByVal index As Integer) As String
86+ Get
87+ Return Me.m_DisplayName(index)
88+ End Get
89+ Set(ByVal value As String)
90+ Me.m_DisplayName(index) = value
91+ End Set
92+ End Property
93+
94+ ''' <summary>オブジェクトから指定した列の値を取得します</summary>
95+ ''' <param name="item">オブジェクト</param>
96+ ''' <param name="index">値を取得する列のインデックス</param>
97+ Public Function DisplayValue(ByVal item As Object, _
98+ ByVal index As Integer) As String
99+ Dim pi As PropertyInfo = item.GetType.GetProperty( _
100+ Me.DisplayName(index), _
101+ BindingFlags.Instance OrElse BindingFlags.Public)
102+ Return pi.GetValue(item, Nothing).ToString
103+ End Function
104+
105+ ''' <summary>オブジェクトから指定したプロパティ名の値を取得します</summary>
106+ ''' <param name="item">オブジェクト</param>
107+ ''' <param name="name">値を取得するプロパティ名</param>
108+ Public Function DisplayValue(ByVal item As Object, ByVal name As String) As String
109+ Dim pi As PropertyInfo = item.GetType.GetProperty( _
110+ name, _
111+ BindingFlags.Instance OrElse BindingFlags.Public)
112+ Return pi.GetValue(item, Nothing).ToString
113+ End Function
114+
115+End Class
Show on old repository browser