• R/O
  • SSH
  • HTTPS

mlapplication: Commit


Commit MetaInfo

Revision61 (tree)
Time2017-03-15 09:06:52
Authoryukio_miura

Log Message

(empty log message)

Change Summary

Incremental Difference

--- trunk/ML.Controls/uc6DateText.Designer.vb (revision 0)
+++ trunk/ML.Controls/uc6DateText.Designer.vb (revision 61)
@@ -0,0 +1,74 @@
1+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
2+Partial Class uc6DateText
3+ Inherits System.Windows.Forms.UserControl
4+
5+ 'UserControl1 は、コンポーネント一覧に後処理を実行するために dispose をオーバーライドします。
6+ <System.Diagnostics.DebuggerNonUserCode()> _
7+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8+ Try
9+ If disposing AndAlso components IsNot Nothing Then
10+ components.Dispose()
11+ End If
12+ Finally
13+ MyBase.Dispose(disposing)
14+ End Try
15+ End Sub
16+
17+ 'Windows フォーム デザイナーで必要です。
18+ Private components As System.ComponentModel.IContainer
19+
20+ 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。
21+ 'Windows フォーム デザイナーを使用して変更できます。
22+ 'コード エディターを使って変更しないでください。
23+ <System.Diagnostics.DebuggerStepThrough()> _
24+ Private Sub InitializeComponent()
25+ Me.DateTimePicker = New System.Windows.Forms.DateTimePicker()
26+ Me.txtUc6TextBox = New ML.Controls.uc6TextBox()
27+ Me.SuspendLayout()
28+ '
29+ 'DateTimePicker
30+ '
31+ Me.DateTimePicker.Anchor = CType(((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
32+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
33+ Me.DateTimePicker.CustomFormat = " YY"
34+ Me.DateTimePicker.Font = New System.Drawing.Font("MS UI Gothic", 9.75!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(128, Byte))
35+ Me.DateTimePicker.Format = System.Windows.Forms.DateTimePickerFormat.Custom
36+ Me.DateTimePicker.ImeMode = System.Windows.Forms.ImeMode.Off
37+ Me.DateTimePicker.Location = New System.Drawing.Point(73, 0)
38+ Me.DateTimePicker.Name = "DateTimePicker"
39+ Me.DateTimePicker.Size = New System.Drawing.Size(14, 20)
40+ Me.DateTimePicker.TabIndex = 1
41+ Me.DateTimePicker.TabStop = False
42+ '
43+ 'txtUc6TextBox
44+ '
45+ Me.txtUc6TextBox.Anchor = CType((((System.Windows.Forms.AnchorStyles.Top Or System.Windows.Forms.AnchorStyles.Bottom) _
46+ Or System.Windows.Forms.AnchorStyles.Left) _
47+ Or System.Windows.Forms.AnchorStyles.Right), System.Windows.Forms.AnchorStyles)
48+ Me.txtUc6TextBox.Font = New System.Drawing.Font("MS UI Gothic", 9.5!)
49+ Me.txtUc6TextBox.LengthCheckMode = ML.Common.[Const].En.enLengthCheckMode.ByteMode
50+ Me.txtUc6TextBox.Location = New System.Drawing.Point(0, 0)
51+ Me.txtUc6TextBox.MaxLength = 8
52+ Me.txtUc6TextBox.Name = "txtUc6TextBox"
53+ Me.txtUc6TextBox.PermitChars = New Char(-1) {}
54+ Me.txtUc6TextBox.Size = New System.Drawing.Size(73, 20)
55+ Me.txtUc6TextBox.TabIndex = 4
56+ Me.txtUc6TextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center
57+ '
58+ 'uc6DateText
59+ '
60+ Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 12.0!)
61+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
62+ Me.BackColor = System.Drawing.SystemColors.Control
63+ Me.Controls.Add(Me.DateTimePicker)
64+ Me.Controls.Add(Me.txtUc6TextBox)
65+ Me.Name = "uc6DateText"
66+ Me.Size = New System.Drawing.Size(87, 20)
67+ Me.ResumeLayout(False)
68+ Me.PerformLayout()
69+
70+ End Sub
71+ Friend WithEvents DateTimePicker As System.Windows.Forms.DateTimePicker
72+ Friend WithEvents txtUc6TextBox As uc6TextBox
73+
74+End Class
--- trunk/ML.Controls/uc6DateText.vb (revision 0)
+++ trunk/ML.Controls/uc6DateText.vb (revision 61)
@@ -0,0 +1,456 @@
1+
2+Imports System.Windows.Forms
3+Imports System.ComponentModel
4+
5+''' <summary>
6+''' 【クラス名】uc6DateText
7+''' 【機能概要】日付入力用ユーザーコントロール
8+''' </summary>
9+''' <history>
10+''' </history>
11+<System.Drawing.ToolboxBitmap(GetType(DateTimePicker))>
12+Public Class uc6DateText
13+
14+#Region " 共通変数・定数"
15+
16+ ''' <summary>表示処理実行中フラグ</summary>
17+ Private m_bCalcFlg As Boolean = False
18+
19+ ''' <summary>日付桁数</summary>
20+ Private m_iDketa As Integer = 8
21+
22+ ''' <summary>日付書式</summary>
23+ Private m_sDateFormat As String = ""
24+
25+ ''' <summary>DataGridViewEditコントロールフラグ</summary>
26+ Protected m_bDataGridViewEditing As Boolean = False
27+
28+#End Region
29+
30+#Region " プロパティ"
31+
32+ ''' <summary>Text</summary>
33+ Public Overrides Property Text() As String
34+ Get
35+ Return Me.txtUc6TextBox.Text
36+ End Get
37+ Set(ByVal value As String)
38+
39+ '' /付で入ってきたらいったん消す
40+ If IsDate(value) Then
41+ value = value.Replace("/", String.Empty)
42+ End If
43+
44+ '' 数値以外が入れられたら消す
45+ If Not IsNumeric(value) Then
46+ value = String.Empty
47+ Me.m_bCalcFlg = True
48+ Me.txtUc6TextBox.Text = value
49+ Me.m_bCalcFlg = False
50+ Exit Property
51+ End If
52+
53+ Me.m_bCalcFlg = True
54+ Me.txtUc6TextBox.Text = value
55+ Me.m_bCalcFlg = False
56+
57+ '' フォーカスがなかった時用の処理
58+ If Not Me.txtUc6TextBox.Focused Then
59+ Me.m_bCalcFlg = True
60+ Me.txtUc6TextBox.Text = Me.DateEditer
61+ Me.m_bCalcFlg = False
62+
63+ If IsDate(Me.txtUc6TextBox.Text) Then
64+
65+ Me.m_bCalcFlg = True
66+ If CDate(Me.txtUc6TextBox.Text) > Me.DateTimePicker.MaxDate Then
67+ Me.txtUc6TextBox.Text = String.Empty
68+ ElseIf CDate(txtUc6TextBox.Text) < Me.DateTimePicker.MinDate Then
69+ Me.txtUc6TextBox.Text = String.Empty
70+ Else
71+ Me.DateTimePicker.Value = Me.txtUc6TextBox.Text
72+ End If
73+ Me.m_bCalcFlg = False
74+
75+ End If
76+ End If
77+ End Set
78+ End Property
79+
80+ ''' <summary>Value</summary>
81+ ''' <remarks>Date型の値を格納する</remarks>
82+ Public Property Value As System.Nullable(Of Date)
83+ Get
84+ '' TscTextBox内の文字列が日付型ならDate型にキャストして返す
85+ '' TscTextBox内の文字列が日付型で無い場合はDateEditerの結果をDate型にキャストして返す。
86+ '' 結果も日付型でなければNothingを返す
87+ If IsDate(Me.txtUc6TextBox.Text) Then
88+ Return CDate(Me.txtUc6TextBox.Text)
89+ Else
90+ Dim dteDispDate As String = Me.DateEditer
91+
92+ If IsDate(dteDispDate) Then
93+ Return CDate(dteDispDate)
94+ Else
95+ Return Nothing
96+ End If
97+ End If
98+ End Get
99+ Set(value As System.Nullable(Of Date))
100+ '' セットされた値がNothingで無ければDateTimePicker.Valueにセットする
101+ '' セットされた値がNothingの場合は""をTscTextBoxにセットする
102+ If Not value Is Nothing Then
103+ Me.DateTimePicker.Value = value
104+ Else
105+ Me.m_bCalcFlg = True
106+ Me.txtUc6TextBox.Text = String.Empty
107+ Me.m_bCalcFlg = False
108+ End If
109+ End Set
110+ End Property
111+
112+ ''' <summary>背景色</summary>
113+ Public Property BackColorText() As System.Drawing.Color
114+ Get
115+ Return Me.txtUc6TextBox.BackColor
116+ End Get
117+ Set(ByVal value As System.Drawing.Color)
118+ Me.txtUc6TextBox.BackColor = value
119+ End Set
120+ End Property
121+
122+ ''' <summary>文字位置</summary>
123+ Public Property TextAlign() As System.Windows.Forms.HorizontalAlignment
124+ Get
125+ Return Me.txtUc6TextBox.TextAlign
126+ End Get
127+ Set(ByVal value As System.Windows.Forms.HorizontalAlignment)
128+ Me.txtUc6TextBox.TextAlign = value
129+ End Set
130+ End Property
131+
132+ ''' <summary>日付書式</summary>
133+ Public Property DateFormat As String
134+ Get
135+ Return Me.m_sDateFormat
136+ End Get
137+ Set(value As String)
138+ Me.m_sDateFormat = value
139+ End Set
140+ End Property
141+
142+#End Region
143+
144+#Region " メソッド"
145+
146+ ''' <summary>入力値を元に日付書式を適用する</summary>
147+ Private Function DateEditer() As String
148+ Dim c As String = Me.txtUc6TextBox.Text
149+ Dim r As String = String.Empty
150+ Dim n As Decimal
151+ Dim lastDay As Date
152+
153+ '' 半角に変換
154+ c = StrConv(c, VbStrConv.Narrow)
155+
156+ If Not IsNumeric(c) Then Return r
157+
158+ n = Decimal.Parse(c)
159+
160+ '' 0だと落ちるので除外
161+ If n = 0 Then Return r
162+
163+ r = Me.txtUc6TextBox.Text
164+
165+ '' 当月最終日
166+ Dim rdate As Date
167+ Select Case n
168+ Case Is <= 99
169+ lastDay = CDate(Now.AddMonths(1).ToString("yyyy/MM/01")).AddDays(-1)
170+ If c <= lastDay.Day Then
171+ rdate = lastDay.ToString("yyyy/MM/") & c
172+ r = rdate.ToString("yyyy/MM/dd")
173+ Else
174+ r = String.Empty
175+ End If
176+
177+ Case Is <= 1299
178+ c = c.PadLeft(4, "0")
179+
180+ Dim mm As String = c.Substring(0, 2)
181+ Dim dd As String = c.Substring(2, 2)
182+
183+ lastDay = CDate(Now.Year & "/" & mm & "/01").AddMonths(1).AddDays(-1)
184+
185+ If dd = "00" Then
186+ dd = "01"
187+ End If
188+
189+ '' 日付の妥当性チェック
190+ If CInt(dd) > 0 And CInt(dd) <= lastDay.Day Then
191+ rdate = lastDay.ToString("yyyy/MM/") & dd
192+ r = rdate.ToString("yyyy/MM/dd")
193+ Else
194+ r = ""
195+ End If
196+
197+ Case Is <= 991231
198+
199+ c = c.PadLeft(6, "0")
200+ Dim yy As String = "20" & c.Substring(0, 2)
201+ Dim mm As String = c.Substring(2, 2)
202+ Dim dd As String = c.Substring(4, 2)
203+
204+ If IsDate(yy & "/" & mm & "/01") Then
205+ lastDay = CDate(yy & "/" & mm & "/01").AddMonths(1).AddDays(-1)
206+
207+ ' 日付の妥当性チェック
208+ If CInt(dd) > 0 And CInt(dd) <= lastDay.Day Then
209+ rdate = lastDay.ToString("yyyy/MM/") & dd
210+ r = rdate.ToString("yyyy/MM/dd")
211+ Else
212+ r = String.Empty
213+ End If
214+ Else
215+ r = String.Empty
216+ End If
217+
218+ Case Is <= 99981231
219+
220+ c = c.PadLeft(8, "0")
221+ Dim yy As String = c.Substring(0, 4)
222+ Dim mm As String = c.Substring(4, 2)
223+ Dim dd As String = c.Substring(6, 2)
224+
225+ If IsDate(yy & "/" & mm & "/01") Then
226+ lastDay = CDate(yy & "/" & mm & "/01").AddMonths(1).AddDays(-1)
227+
228+ '' 日付の妥当性チェック
229+ If CInt(dd) > 0 And CInt(dd) <= lastDay.Day Then
230+ rdate = lastDay.ToString("yyyy/MM/") & dd
231+ r = rdate.ToString("yyyy/MM/dd")
232+ Else
233+ r = String.Empty
234+ End If
235+ Else
236+ r = String.Empty
237+ End If
238+ Case Else
239+
240+ r = String.Empty
241+
242+ End Select
243+
244+ '' 戻り値に日付書式を適用
245+ If Not Me.m_sDateFormat.Equals(String.Empty) Then
246+ If IsDate(r) = True Then
247+ r = CDate(r).ToString(Me.m_sDateFormat)
248+ End If
249+ End If
250+
251+ '' 戻り値を返す
252+ Return r
253+
254+ End Function
255+
256+#End Region
257+
258+#Region " イベント"
259+
260+ ''' <summary>ValueChangedイベント</summary>
261+ Public Event ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
262+
263+ ''' <summary>OnValueChangedメソッド</summary>
264+ Protected Overridable Sub OnValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
265+
266+ If Me.txtUc6TextBox.Modified = True Then
267+
268+ ' ValueChangedを発生させる
269+ RaiseEvent ValueChanged(sender, e)
270+
271+ End If
272+
273+ End Sub
274+
275+ ''' <summary>OnGotFocusメソッド</summary>
276+ Protected Overrides Sub OnGotFocus(e As System.EventArgs)
277+ MyBase.OnGotFocus(e)
278+ End Sub
279+
280+ ''' <summary>OnLostFocusメソッド</summary>
281+ Protected Overrides Sub OnLostFocus(e As System.EventArgs)
282+ MyBase.OnLostFocus(e)
283+ End Sub
284+
285+ ''' <summary>DateTimePicker1_ValueChangedイベント</summary>
286+ Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DateTimePicker.ValueChanged
287+
288+ Me.m_bCalcFlg = True
289+
290+ '' 日付書式に変換してTextプロパティにセット
291+ If Not Me.m_sDateFormat.Equals(String.Empty) Then
292+ Me.txtUc6TextBox.Text = Me.DateTimePicker.Value.ToString(Me.m_sDateFormat)
293+ Else
294+ Me.txtUc6TextBox.Text = Me.DateTimePicker.Value.ToString("yyyy/MM/dd")
295+ End If
296+
297+ Me.m_bCalcFlg = False
298+
299+ '' ValueChangedイベントを発生させる
300+ Me.OnValueChanged(sender, e)
301+
302+ End Sub
303+
304+ ''' <summary>DateTimePicker_GotFocusイベント</summary>
305+ Private Sub DateTimePicker_GotFocus(sender As Object, e As System.EventArgs) Handles DateTimePicker.GotFocus
306+
307+ '' フォーカス取得イベント
308+ Me.OnGotFocus(e)
309+
310+ End Sub
311+
312+ ''' <summary>txtUc6TextBox_GotFocusイベント</summary>
313+ Private Sub txtUc6TextBox_GotFocus(sender As Object, e As System.EventArgs) Handles txtUc6TextBox.GotFocus
314+
315+ Try
316+
317+ '' フォーカス取得イベント
318+ Me.OnGotFocus(e)
319+
320+ '' Textプロパティが""の場合は処理を抜ける
321+ If Me.Text.Trim = String.Empty Then
322+ Exit Sub
323+ End If
324+
325+ Dim dtDefDateFormat As String = String.Empty
326+ If InStr(Me.Text, "/") > 0 Then
327+
328+ '' Textプロパティの値を一旦yyyy/MM/ddの形式に変換する
329+ dtDefDateFormat = Format(CDate(Me.Text), "yyyy/MM/dd")
330+
331+ '' フォーカス取得時には/編集を解除して表示する
332+ Dim decwk As Decimal
333+ decwk = CDec(dtDefDateFormat.Replace("/", String.Empty))
334+
335+ '' 整数部の表示形式を編集
336+ Dim wksharp As String = "0"
337+
338+ Me.m_bCalcFlg = True
339+ Me.Text = decwk.ToString(wksharp)
340+ Me.m_bCalcFlg = False
341+
342+ End If
343+
344+ Catch ex As Exception
345+
346+ Console.Write("GotFocus-Error")
347+
348+ End Try
349+
350+ End Sub
351+
352+ ''' <summary>LostFocusイベント</summary>
353+ Private Sub Controls_LostFocus(sender As Object, e As System.EventArgs) Handles txtUc6TextBox.LostFocus, DateTimePicker.LostFocus
354+
355+ '' フォーカス喪失イベント
356+ Me.OnLostFocus(e)
357+
358+ End Sub
359+
360+ ''' <summary>KeyPressイベント</summary>
361+ Private Sub txtUc6TextBox_KeyPress(sender As Object, e As System.Windows.Forms.KeyPressEventArgs) Handles txtUc6TextBox.KeyPress
362+
363+ If Me.m_bCalcFlg = True Then Exit Sub
364+
365+ If [Char].IsDigit(e.KeyChar) Then
366+ '' Digits are OK
367+ ElseIf e.KeyChar = vbBack Then
368+ ElseIf (Control.ModifierKeys And Keys.Control) = Keys.Control Then
369+ Else
370+ e.Handled = True
371+ End If
372+
373+ End Sub
374+
375+ ''' <summary>OnValidatingイベント</summary>
376+ Protected Overrides Sub OnValidating(e As System.ComponentModel.CancelEventArgs)
377+
378+ Try
379+ If IsDate(Me.txtUc6TextBox.Text) Then
380+ MyBase.OnValidating(e)
381+ Exit Sub
382+ End If
383+
384+ If Me.m_bDataGridViewEditing = False Then
385+
386+ Me.m_bCalcFlg = True
387+ Me.txtUc6TextBox.Text = Me.DateEditer
388+ Me.m_bCalcFlg = False
389+
390+ If IsDate(Me.txtUc6TextBox.Text) Then
391+
392+ If CDate(Me.txtUc6TextBox.Text) > Me.DateTimePicker.MaxDate Then
393+ Me.m_bCalcFlg = True
394+ Me.txtUc6TextBox.Text = ""
395+ Me.m_bCalcFlg = False
396+ ElseIf CDate(Me.txtUc6TextBox.Text) < Me.DateTimePicker.MinDate Then
397+ Me.m_bCalcFlg = True
398+ Me.txtUc6TextBox.Text = ""
399+ Me.m_bCalcFlg = False
400+ Else
401+ Me.DateTimePicker.Value = Me.txtUc6TextBox.Text
402+ End If
403+
404+ End If
405+
406+ End If
407+
408+ MyBase.OnValidating(e)
409+
410+ Catch ex As Exception
411+
412+ Console.Write("Validating-Error")
413+
414+ End Try
415+
416+ End Sub
417+
418+ ''' <summary>TextChangedイベント</summary>
419+ Private Sub TscTextBox1_TextChanged(sender As Object, e As System.EventArgs) Handles txtUc6TextBox.TextChanged
420+
421+ '' 表示処理実行中フラグが立っている、またテキスト桁数が0の場合は処理を終了する
422+ If Me.m_bCalcFlg = True Then
423+ Exit Sub
424+ End If
425+
426+ If Me.txtUc6TextBox.Text.Trim = "" Then
427+ Me.DateTimePicker.ResetText()
428+ '' テキストが書き換わっているので消す
429+ Me.m_bCalcFlg = True
430+ Me.txtUc6TextBox.Text = ""
431+ Me.m_bCalcFlg = False
432+ Exit Sub
433+ End If
434+
435+ Dim wkstrSp As String = Me.txtUc6TextBox.Text
436+ Dim wkstr As String = ""
437+ '' 入力桁数の処理を行う
438+ If wkstrSp.Length > Me.m_iDketa Then
439+ wkstr += wkstrSp.Substring(0, Me.m_iDketa)
440+ Else
441+ wkstr += wkstrSp
442+ End If
443+ '' 編集した内容を表示する
444+ Me.m_bCalcFlg = True
445+ Me.txtUc6TextBox.Text = wkstr
446+ Me.txtUc6TextBox.SelectionLength = 0
447+ Me.m_bCalcFlg = False
448+
449+ '' ValueChangedイベントを発生させる
450+ Me.OnValueChanged(sender, e)
451+
452+ End Sub
453+
454+#End Region
455+
456+End Class
--- trunk/MLApp.TRN0000/Form2.Designer.vb (revision 0)
+++ trunk/MLApp.TRN0000/Form2.Designer.vb (revision 61)
@@ -0,0 +1,29 @@
1+<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
2+Partial Class Form2
3+ Inherits System.Windows.Forms.Form
4+
5+ 'フォームがコンポーネントの一覧をクリーンアップするために dispose をオーバーライドします。
6+ <System.Diagnostics.DebuggerNonUserCode()> _
7+ Protected Overrides Sub Dispose(ByVal disposing As Boolean)
8+ Try
9+ If disposing AndAlso components IsNot Nothing Then
10+ components.Dispose()
11+ End If
12+ Finally
13+ MyBase.Dispose(disposing)
14+ End Try
15+ End Sub
16+
17+ 'Windows フォーム デザイナーで必要です。
18+ Private components As System.ComponentModel.IContainer
19+
20+ 'メモ: 以下のプロシージャは Windows フォーム デザイナーで必要です。
21+ 'Windows フォーム デザイナーを使用して変更できます。
22+ 'コード エディターを使って変更しないでください。
23+ <System.Diagnostics.DebuggerStepThrough()> _
24+ Private Sub InitializeComponent()
25+ components = New System.ComponentModel.Container
26+ Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
27+ Me.Text = "Form2"
28+ End Sub
29+End Class
--- trunk/MLApp.TRN0000/Form2.vb (revision 0)
+++ trunk/MLApp.TRN0000/Form2.vb (revision 61)
@@ -0,0 +1,3 @@
1+Public Class Form2
2+
3+End Class
\ No newline at end of file
--- trunk/MLApp.Base/ucSearchBox.vb (revision 60)
+++ trunk/MLApp.Base/ucSearchBox.vb (revision 61)
@@ -272,6 +272,9 @@
272272 '' SearchClosedイベントを発生させる
273273 RaiseEvent SearchClosed(sender, e)
274274
275+ '' AfterUpdateイベントを発生させる
276+ RaiseEvent AfterUpdate(sender, e)
277+
275278 '' エラープロバイダ初期化
276279 Me.epMasterCode.Clear()
277280
Show on old repository browser