EveryDB2のデータベースを読み込んでWinFormでGUI表示するサンプル
Revision | 1dfad69bb82fe8edde5e3a20e7b262626dbff82c (tree) |
---|---|
Zeit | 2021-06-01 08:54:29 |
Autor | yoshy <yoshy@user...> |
Commiter | yoshy |
temp_20210601_0854
@@ -20,14 +20,24 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
20 | 20 | BeanHelper.Copy(this, race); |
21 | 21 | } |
22 | 22 | |
23 | - public string JyoName { get => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); } | |
23 | + public string JyoName => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); | |
24 | 24 | |
25 | - public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } | |
25 | + public string YearMonthDay => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); | |
26 | 26 | |
27 | 27 | public string RaceName => CodeHelper.GetInstance().GetRaceName(this, "不明"); |
28 | 28 | |
29 | 29 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Gradecd, "-"); |
30 | 30 | |
31 | 31 | public string CourseName => CodeHelper.GetInstance().GetTrackKubun(Trackcd, "不明") + Kyori; |
32 | + | |
33 | + public string SyussoTosuFormatted => !string.IsNullOrEmpty(Syussotosu) | |
34 | + ? int.Parse(Syussotosu).ToString() | |
35 | + : string.Empty; | |
36 | + | |
37 | + public string HassoTimeFormatted => !string.IsNullOrEmpty(Hassotime) && Hassotime.Length == 4 | |
38 | + ? Hassotime != "0000" | |
39 | + ? Hassotime.Substring(0,2) + ":" + Hassotime.Substring(2, 2) | |
40 | + : "-" | |
41 | + : Hassotime; | |
32 | 42 | } |
33 | 43 | } |
@@ -20,14 +20,16 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
20 | 20 | BeanHelper.Copy(this, race); |
21 | 21 | } |
22 | 22 | |
23 | - public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } | |
23 | + public string YearMonthDay => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); | |
24 | 24 | |
25 | - public string JyoName { get => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); } | |
25 | + public string JyoName => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); | |
26 | 26 | |
27 | 27 | public string RaceName => CodeHelper.GetInstance().GetRaceName(this, "不明"); |
28 | 28 | |
29 | 29 | public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Gradecd, "-"); |
30 | 30 | |
31 | 31 | public string CourseName => CodeHelper.GetInstance().GetTrackKubun(Trackcd, "不明") + Kyori; |
32 | + | |
33 | + public string TorokuTosuFormatted => !string.IsNullOrEmpty(Torokutosu) ? int.Parse(Torokutosu).ToString() : string.Empty; | |
32 | 34 | } |
33 | 35 | } |
@@ -19,15 +19,21 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
19 | 19 | BeanHelper.Copy(this, umaRace); |
20 | 20 | } |
21 | 21 | |
22 | - public string YearMonthDay { get => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); } | |
22 | + public string YearMonthDay => Year + "/" + Monthday.Substring(0, 2) + "/" + Monthday.Substring(2, 2); | |
23 | 23 | |
24 | - public string JyoName { get => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); } | |
24 | + public string JyoName => CodeHelper.GetInstance().GetName(CodeHelper.JYO_CODE, Jyocd, 3, "不明"); | |
25 | 25 | |
26 | - public string RaceName => Race != null ? CodeHelper.GetInstance().GetRaceName(Race, "不明") : string.Empty; | |
26 | + public string RaceName => Race != null | |
27 | + ? CodeHelper.GetInstance().GetRaceName(Race, "不明") | |
28 | + : string.Empty; | |
27 | 29 | |
28 | - public string GradeName => CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Race.Gradecd, "-"); | |
30 | + public string GradeName => Race != null | |
31 | + ? CodeHelper.GetInstance().GetName(CodeHelper.GRADE_CODE, Race.Gradecd, "-") | |
32 | + : string.Empty; | |
29 | 33 | |
30 | - public string CourseName => Race != null ? CodeHelper.GetInstance().GetTrackKubun(Race.Trackcd, "不明") + Race.Kyori : string.Empty; | |
34 | + public string CourseName => Race != null | |
35 | + ? CodeHelper.GetInstance().GetTrackKubun(Race.Trackcd, "不明") + Race.Kyori | |
36 | + : string.Empty; | |
31 | 37 | |
32 | 38 | public string Kimete => CodeHelper.GetInstance().GetName(CodeHelper.KYAKUSITU_KUBUN, Kyakusitukubun, "不明"); |
33 | 39 |
@@ -48,10 +54,9 @@ namespace UmaTest.App.Adaptor.Gateway.ViewModel.Dto | ||
48 | 54 | } |
49 | 55 | } |
50 | 56 | |
51 | - public string TimeFormatted | |
52 | - { | |
53 | - get => Time.Length >= 4 ? $"{Time.Substring(0,1)}:{Time.Substring(1, 2)}.{Time.Substring(3, 1)}" : Time; | |
54 | - } | |
57 | + public string TimeFormatted => Time.Length == 4 | |
58 | + ? $"{Time.Substring(0,1)}:{Time.Substring(1, 2)}.{Time.Substring(3, 1)}" | |
59 | + : Time; | |
55 | 60 | |
56 | 61 | public string FutanFormatted |
57 | 62 | { |
@@ -34,6 +34,7 @@ namespace UmaTest.App.Presentation.View | ||
34 | 34 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); |
35 | 35 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); |
36 | 36 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle5 = new System.Windows.Forms.DataGridViewCellStyle(); |
37 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle6 = new System.Windows.Forms.DataGridViewCellStyle(); | |
37 | 38 | this.menuStrip1 = new System.Windows.Forms.MenuStrip(); |
38 | 39 | this.toolStripMenuFile = new System.Windows.Forms.ToolStripMenuItem(); |
39 | 40 | this.toolStripMenuOpenHorseList = new System.Windows.Forms.ToolStripMenuItem(); |
@@ -165,6 +166,7 @@ namespace UmaTest.App.Presentation.View | ||
165 | 166 | // |
166 | 167 | this.dataGridView1.AllowUserToAddRows = false; |
167 | 168 | this.dataGridView1.AllowUserToDeleteRows = false; |
169 | + this.dataGridView1.AllowUserToResizeColumns = false; | |
168 | 170 | this.dataGridView1.AllowUserToResizeRows = false; |
169 | 171 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
170 | 172 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
@@ -181,9 +183,16 @@ namespace UmaTest.App.Presentation.View | ||
181 | 183 | this.dataGridView1.MultiSelect = false; |
182 | 184 | this.dataGridView1.Name = "dataGridView1"; |
183 | 185 | this.dataGridView1.ReadOnly = true; |
186 | + dataGridViewCellStyle2.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |
187 | + dataGridViewCellStyle2.BackColor = System.Drawing.SystemColors.Control; | |
188 | + dataGridViewCellStyle2.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
189 | + dataGridViewCellStyle2.ForeColor = System.Drawing.SystemColors.WindowText; | |
190 | + dataGridViewCellStyle2.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
191 | + dataGridViewCellStyle2.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
192 | + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle2; | |
184 | 193 | this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; |
185 | - dataGridViewCellStyle2.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
186 | - this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle2; | |
194 | + dataGridViewCellStyle3.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
195 | + this.dataGridView1.RowsDefaultCellStyle = dataGridViewCellStyle3; | |
187 | 196 | this.dataGridView1.RowTemplate.Height = 21; |
188 | 197 | this.dataGridView1.RowTemplate.ReadOnly = true; |
189 | 198 | this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
@@ -194,33 +203,34 @@ namespace UmaTest.App.Presentation.View | ||
194 | 203 | // |
195 | 204 | this.dataGridView2.AllowUserToAddRows = false; |
196 | 205 | this.dataGridView2.AllowUserToDeleteRows = false; |
206 | + this.dataGridView2.AllowUserToResizeColumns = false; | |
197 | 207 | this.dataGridView2.AllowUserToResizeRows = false; |
198 | 208 | this.dataGridView2.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
199 | - dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
200 | - dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; | |
201 | - dataGridViewCellStyle3.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
202 | - dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; | |
203 | - dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
204 | - dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
205 | - dataGridViewCellStyle3.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
206 | - this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle3; | |
207 | - this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
208 | - this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; | |
209 | - this.dataGridView2.Location = new System.Drawing.Point(0, 0); | |
210 | - this.dataGridView2.MultiSelect = false; | |
211 | - this.dataGridView2.Name = "dataGridView2"; | |
212 | - this.dataGridView2.ReadOnly = true; | |
213 | 209 | dataGridViewCellStyle4.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
214 | 210 | dataGridViewCellStyle4.BackColor = System.Drawing.SystemColors.Control; |
215 | 211 | dataGridViewCellStyle4.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); |
216 | 212 | dataGridViewCellStyle4.ForeColor = System.Drawing.SystemColors.WindowText; |
217 | 213 | dataGridViewCellStyle4.SelectionBackColor = System.Drawing.SystemColors.Highlight; |
218 | 214 | dataGridViewCellStyle4.SelectionForeColor = System.Drawing.SystemColors.HighlightText; |
219 | - dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.False; | |
220 | - this.dataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle4; | |
215 | + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; | |
216 | + this.dataGridView2.ColumnHeadersDefaultCellStyle = dataGridViewCellStyle4; | |
217 | + this.dataGridView2.ColumnHeadersHeightSizeMode = System.Windows.Forms.DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
218 | + this.dataGridView2.Dock = System.Windows.Forms.DockStyle.Fill; | |
219 | + this.dataGridView2.Location = new System.Drawing.Point(0, 0); | |
220 | + this.dataGridView2.MultiSelect = false; | |
221 | + this.dataGridView2.Name = "dataGridView2"; | |
222 | + this.dataGridView2.ReadOnly = true; | |
223 | + dataGridViewCellStyle5.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; | |
224 | + dataGridViewCellStyle5.BackColor = System.Drawing.SystemColors.Control; | |
225 | + dataGridViewCellStyle5.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
226 | + dataGridViewCellStyle5.ForeColor = System.Drawing.SystemColors.WindowText; | |
227 | + dataGridViewCellStyle5.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
228 | + dataGridViewCellStyle5.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
229 | + dataGridViewCellStyle5.WrapMode = System.Windows.Forms.DataGridViewTriState.False; | |
230 | + this.dataGridView2.RowHeadersDefaultCellStyle = dataGridViewCellStyle5; | |
221 | 231 | this.dataGridView2.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; |
222 | - dataGridViewCellStyle5.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
223 | - this.dataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle5; | |
232 | + dataGridViewCellStyle6.Font = new System.Drawing.Font("Meiryo UI", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
233 | + this.dataGridView2.RowsDefaultCellStyle = dataGridViewCellStyle6; | |
224 | 234 | this.dataGridView2.RowTemplate.Height = 21; |
225 | 235 | this.dataGridView2.RowTemplate.ReadOnly = true; |
226 | 236 | this.dataGridView2.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
@@ -457,7 +457,7 @@ namespace UmaTest.App.Presentation.View | ||
457 | 457 | case "UmaSummaryList": |
458 | 458 | { |
459 | 459 | bindingSource1.DataSource = vm.UmaSummaryList; |
460 | - AdjustDataGridView(dataGridView1, bindingSource1, vm.UmaSummaryList.Count, splitContainer2.Panel1); | |
460 | + DataGridViewHelper.AdjustDataGridView(dataGridView1, bindingSource1, vm.UmaSummaryList.Count, splitContainer2.Panel1); | |
461 | 461 | |
462 | 462 | if (dataGridView1.Rows.Count > 0) |
463 | 463 | { |
@@ -477,44 +477,10 @@ namespace UmaTest.App.Presentation.View | ||
477 | 477 | case "RaceList": |
478 | 478 | { |
479 | 479 | bindingSource2.DataSource = vm.RaceList; |
480 | - AdjustDataGridView(dataGridView2, bindingSource2, vm.RaceList.Count, splitContainer2.Panel2); | |
480 | + DataGridViewHelper.AdjustDataGridView(dataGridView2, bindingSource2, vm.RaceList.Count, splitContainer2.Panel2); | |
481 | 481 | } |
482 | 482 | break; |
483 | 483 | } |
484 | 484 | } |
485 | - | |
486 | - private void AdjustDataGridView(DataGridView dataGridView, BindingSource bindingSource, int dataSourceCount, Panel panel) | |
487 | - { | |
488 | - Size size = dataGridView.Size; | |
489 | - | |
490 | - dataGridView.SuspendLayout(); | |
491 | - | |
492 | - dataGridView.ScrollBars = ScrollBars.None; | |
493 | - panel.BackColor = SystemColors.ControlText; | |
494 | - | |
495 | - size.Height = size.Height - 1; | |
496 | - dataGridView.Size = size; | |
497 | - | |
498 | - dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
499 | - dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
500 | - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; | |
501 | - dataGridView.DataSource = bindingSource; | |
502 | - | |
503 | - dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
504 | - dataGridView.AutoSizeColumnsMode = dataSourceCount > 0 | |
505 | - ? DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader | |
506 | - : DataGridViewAutoSizeColumnsMode.AllCells; | |
507 | - dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
508 | - | |
509 | - size.Height = size.Height + 1; | |
510 | - dataGridView.Size = size; | |
511 | - | |
512 | - dataGridView.ScrollBars = ScrollBars.Both; | |
513 | - panel.BackColor = SystemColors.AppWorkspace; | |
514 | - | |
515 | - dataGridView.ClearSelection(); | |
516 | - | |
517 | - dataGridView.ResumeLayout(); | |
518 | - } | |
519 | 485 | } |
520 | 486 | } |
@@ -31,6 +31,7 @@ namespace UmaTest.App.Presentation.View | ||
31 | 31 | { |
32 | 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); |
33 | 33 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); |
34 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); | |
34 | 35 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
35 | 36 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
36 | 37 | this.btnSearch = new System.Windows.Forms.Button(); |
@@ -61,7 +62,7 @@ namespace UmaTest.App.Presentation.View | ||
61 | 62 | this.splitContainer1.Panel2.Controls.Add(this.btnSearch); |
62 | 63 | this.splitContainer1.Panel2.Controls.Add(this.btnCancel); |
63 | 64 | this.splitContainer1.Panel2.Controls.Add(this.btnSelect); |
64 | - this.splitContainer1.Size = new System.Drawing.Size(695, 584); | |
65 | + this.splitContainer1.Size = new System.Drawing.Size(790, 584); | |
65 | 66 | this.splitContainer1.SplitterDistance = 521; |
66 | 67 | this.splitContainer1.TabIndex = 0; |
67 | 68 | // |
@@ -69,6 +70,8 @@ namespace UmaTest.App.Presentation.View | ||
69 | 70 | // |
70 | 71 | this.dataGridView1.AllowUserToAddRows = false; |
71 | 72 | this.dataGridView1.AllowUserToDeleteRows = false; |
73 | + this.dataGridView1.AllowUserToResizeColumns = false; | |
74 | + this.dataGridView1.AllowUserToResizeRows = false; | |
72 | 75 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
73 | 76 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
74 | 77 | dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; |
@@ -92,17 +95,25 @@ namespace UmaTest.App.Presentation.View | ||
92 | 95 | this.dataGridView1.MultiSelect = false; |
93 | 96 | this.dataGridView1.Name = "dataGridView1"; |
94 | 97 | this.dataGridView1.ReadOnly = true; |
98 | + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |
99 | + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; | |
100 | + dataGridViewCellStyle3.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
101 | + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; | |
102 | + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
103 | + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
104 | + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; | |
105 | + this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; | |
95 | 106 | this.dataGridView1.RowTemplate.Height = 21; |
96 | 107 | this.dataGridView1.RowTemplate.ReadOnly = true; |
97 | 108 | this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
98 | - this.dataGridView1.Size = new System.Drawing.Size(695, 521); | |
109 | + this.dataGridView1.Size = new System.Drawing.Size(790, 521); | |
99 | 110 | this.dataGridView1.TabIndex = 0; |
100 | 111 | // |
101 | 112 | // btnSearch |
102 | 113 | // |
103 | 114 | this.btnSearch.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
104 | 115 | this.btnSearch.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
105 | - this.btnSearch.Location = new System.Drawing.Point(617, 3); | |
116 | + this.btnSearch.Location = new System.Drawing.Point(712, 3); | |
106 | 117 | this.btnSearch.Name = "btnSearch"; |
107 | 118 | this.btnSearch.Size = new System.Drawing.Size(75, 24); |
108 | 119 | this.btnSearch.TabIndex = 2; |
@@ -113,7 +124,7 @@ namespace UmaTest.App.Presentation.View | ||
113 | 124 | // |
114 | 125 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
115 | 126 | this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
116 | - this.btnCancel.Location = new System.Drawing.Point(537, 32); | |
127 | + this.btnCancel.Location = new System.Drawing.Point(632, 32); | |
117 | 128 | this.btnCancel.Name = "btnCancel"; |
118 | 129 | this.btnCancel.Size = new System.Drawing.Size(74, 25); |
119 | 130 | this.btnCancel.TabIndex = 1; |
@@ -124,7 +135,7 @@ namespace UmaTest.App.Presentation.View | ||
124 | 135 | // |
125 | 136 | this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
126 | 137 | this.btnSelect.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
127 | - this.btnSelect.Location = new System.Drawing.Point(617, 33); | |
138 | + this.btnSelect.Location = new System.Drawing.Point(712, 33); | |
128 | 139 | this.btnSelect.Name = "btnSelect"; |
129 | 140 | this.btnSelect.Size = new System.Drawing.Size(75, 24); |
130 | 141 | this.btnSelect.TabIndex = 0; |
@@ -137,7 +148,7 @@ namespace UmaTest.App.Presentation.View | ||
137 | 148 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
138 | 149 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
139 | 150 | this.CancelButton = this.btnCancel; |
140 | - this.ClientSize = new System.Drawing.Size(695, 584); | |
151 | + this.ClientSize = new System.Drawing.Size(790, 584); | |
141 | 152 | this.ControlBox = false; |
142 | 153 | this.Controls.Add(this.splitContainer1); |
143 | 154 | this.MaximizeBox = false; |
@@ -112,14 +112,25 @@ namespace UmaTest.App.Presentation.View | ||
112 | 112 | }, |
113 | 113 | new DataGridViewTextBoxColumn |
114 | 114 | { |
115 | - DataPropertyName = "Hassotime", | |
115 | + DataPropertyName = "SyussoTosuFormatted", | |
116 | + Name = "頭数", | |
117 | + }, | |
118 | + new DataGridViewTextBoxColumn | |
119 | + { | |
120 | + DataPropertyName = "HassoTimeFormatted", | |
116 | 121 | Name = "発走", |
117 | 122 | }, |
118 | 123 | }; |
119 | 124 | |
120 | 125 | grid1Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); |
121 | - | |
122 | 126 | dataGridView1.Columns.AddRange(grid1Cols); |
127 | + | |
128 | + dataGridView1.Columns["コース"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
129 | + | |
130 | + dataGridView1.Columns["場所"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
131 | + dataGridView1.Columns["R"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
132 | + dataGridView1.Columns["頭数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
133 | + dataGridView1.Columns["発走"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
123 | 134 | } |
124 | 135 | |
125 | 136 | private void OnViewModelChanged(object sender, EventArgs e) |
@@ -129,13 +140,9 @@ namespace UmaTest.App.Presentation.View | ||
129 | 140 | switch (args.PropertyName) |
130 | 141 | { |
131 | 142 | case "SearchResultRaceList": |
132 | - dataGridView1.SuspendLayout(); | |
133 | - //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
134 | - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
135 | 143 | bindingSource1.DataSource = vm.SearchResultRaceList; |
136 | - //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
137 | - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; | |
138 | - dataGridView1.ResumeLayout(); | |
144 | + DataGridViewHelper.AdjustDataGridView( | |
145 | + dataGridView1, bindingSource1, vm.SearchResultRaceList.Count, splitContainer1.Panel1); | |
139 | 146 | break; |
140 | 147 | default: |
141 | 148 | break; |
@@ -31,6 +31,7 @@ namespace UmaTest.App.Presentation.View | ||
31 | 31 | { |
32 | 32 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); |
33 | 33 | System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); |
34 | + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); | |
34 | 35 | this.splitContainer1 = new System.Windows.Forms.SplitContainer(); |
35 | 36 | this.dataGridView1 = new System.Windows.Forms.DataGridView(); |
36 | 37 | this.btnCancel = new System.Windows.Forms.Button(); |
@@ -59,14 +60,16 @@ namespace UmaTest.App.Presentation.View | ||
59 | 60 | // |
60 | 61 | this.splitContainer1.Panel2.Controls.Add(this.btnCancel); |
61 | 62 | this.splitContainer1.Panel2.Controls.Add(this.btnSelect); |
62 | - this.splitContainer1.Size = new System.Drawing.Size(416, 455); | |
63 | - this.splitContainer1.SplitterDistance = 425; | |
63 | + this.splitContainer1.Size = new System.Drawing.Size(629, 559); | |
64 | + this.splitContainer1.SplitterDistance = 529; | |
64 | 65 | this.splitContainer1.TabIndex = 0; |
65 | 66 | // |
66 | 67 | // dataGridView1 |
67 | 68 | // |
68 | 69 | this.dataGridView1.AllowUserToAddRows = false; |
69 | 70 | this.dataGridView1.AllowUserToDeleteRows = false; |
71 | + this.dataGridView1.AllowUserToResizeColumns = false; | |
72 | + this.dataGridView1.AllowUserToResizeRows = false; | |
70 | 73 | this.dataGridView1.AutoSizeColumnsMode = System.Windows.Forms.DataGridViewAutoSizeColumnsMode.ColumnHeader; |
71 | 74 | dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleCenter; |
72 | 75 | dataGridViewCellStyle1.BackColor = System.Drawing.SystemColors.Control; |
@@ -89,16 +92,26 @@ namespace UmaTest.App.Presentation.View | ||
89 | 92 | this.dataGridView1.Location = new System.Drawing.Point(0, 0); |
90 | 93 | this.dataGridView1.MultiSelect = false; |
91 | 94 | this.dataGridView1.Name = "dataGridView1"; |
95 | + this.dataGridView1.ReadOnly = true; | |
96 | + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.MiddleLeft; | |
97 | + dataGridViewCellStyle3.BackColor = System.Drawing.SystemColors.Control; | |
98 | + dataGridViewCellStyle3.Font = new System.Drawing.Font("MS UI Gothic", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(128))); | |
99 | + dataGridViewCellStyle3.ForeColor = System.Drawing.SystemColors.WindowText; | |
100 | + dataGridViewCellStyle3.SelectionBackColor = System.Drawing.SystemColors.Highlight; | |
101 | + dataGridViewCellStyle3.SelectionForeColor = System.Drawing.SystemColors.HighlightText; | |
102 | + this.dataGridView1.RowHeadersDefaultCellStyle = dataGridViewCellStyle3; | |
103 | + this.dataGridView1.RowHeadersWidthSizeMode = System.Windows.Forms.DataGridViewRowHeadersWidthSizeMode.DisableResizing; | |
92 | 104 | this.dataGridView1.RowTemplate.Height = 21; |
105 | + this.dataGridView1.RowTemplate.ReadOnly = true; | |
93 | 106 | this.dataGridView1.SelectionMode = System.Windows.Forms.DataGridViewSelectionMode.FullRowSelect; |
94 | - this.dataGridView1.Size = new System.Drawing.Size(416, 425); | |
107 | + this.dataGridView1.Size = new System.Drawing.Size(629, 529); | |
95 | 108 | this.dataGridView1.TabIndex = 0; |
96 | 109 | // |
97 | 110 | // btnCancel |
98 | 111 | // |
99 | 112 | this.btnCancel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
100 | 113 | this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel; |
101 | - this.btnCancel.Location = new System.Drawing.Point(258, -1); | |
114 | + this.btnCancel.Location = new System.Drawing.Point(471, -1); | |
102 | 115 | this.btnCancel.Name = "btnCancel"; |
103 | 116 | this.btnCancel.Size = new System.Drawing.Size(74, 25); |
104 | 117 | this.btnCancel.TabIndex = 1; |
@@ -108,7 +121,7 @@ namespace UmaTest.App.Presentation.View | ||
108 | 121 | // btnSelect |
109 | 122 | // |
110 | 123 | this.btnSelect.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); |
111 | - this.btnSelect.Location = new System.Drawing.Point(338, 0); | |
124 | + this.btnSelect.Location = new System.Drawing.Point(551, 0); | |
112 | 125 | this.btnSelect.Name = "btnSelect"; |
113 | 126 | this.btnSelect.Size = new System.Drawing.Size(75, 23); |
114 | 127 | this.btnSelect.TabIndex = 0; |
@@ -121,7 +134,7 @@ namespace UmaTest.App.Presentation.View | ||
121 | 134 | this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F); |
122 | 135 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; |
123 | 136 | this.CancelButton = this.btnCancel; |
124 | - this.ClientSize = new System.Drawing.Size(416, 455); | |
137 | + this.ClientSize = new System.Drawing.Size(629, 559); | |
125 | 138 | this.ControlBox = false; |
126 | 139 | this.Controls.Add(this.splitContainer1); |
127 | 140 | this.MaximizeBox = false; |
@@ -110,11 +110,21 @@ namespace UmaTest.App.Presentation.View | ||
110 | 110 | DataPropertyName = "CourseName", |
111 | 111 | Name = "コース", |
112 | 112 | }, |
113 | + new DataGridViewTextBoxColumn | |
114 | + { | |
115 | + DataPropertyName = "TorokuTosuFormatted", | |
116 | + Name = "頭数", | |
117 | + }, | |
113 | 118 | }; |
114 | 119 | |
115 | 120 | grid1Cols.Do(col => col.HeaderCell.Style.Alignment = DataGridViewContentAlignment.MiddleCenter); |
116 | - | |
117 | 121 | dataGridView1.Columns.AddRange(grid1Cols); |
122 | + | |
123 | + dataGridView1.Columns["コース"].HeaderCell.Style.WrapMode = DataGridViewTriState.False; | |
124 | + | |
125 | + dataGridView1.Columns["場所"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
126 | + dataGridView1.Columns["R"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; | |
127 | + dataGridView1.Columns["頭数"].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleRight; | |
118 | 128 | } |
119 | 129 | |
120 | 130 | private void OnViewModelChanged(object sender, EventArgs e) |
@@ -124,13 +134,9 @@ namespace UmaTest.App.Presentation.View | ||
124 | 134 | switch (args.PropertyName) |
125 | 135 | { |
126 | 136 | case "TokuRaceList": |
127 | - dataGridView1.SuspendLayout(); | |
128 | - //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
129 | - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
130 | 137 | bindingSource1.DataSource = vm.TokuRaceList; |
131 | - //dataGridView1.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
132 | - dataGridView1.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCells; | |
133 | - dataGridView1.ResumeLayout(); | |
138 | + DataGridViewHelper.AdjustDataGridView( | |
139 | + dataGridView1, bindingSource1, vm.TokuRaceList.Count, splitContainer1.Panel1); | |
134 | 140 | break; |
135 | 141 | default: |
136 | 142 | break; |
@@ -0,0 +1,48 @@ | ||
1 | + | |
2 | +using System; | |
3 | +using System.Collections.Generic; | |
4 | +using System.Drawing; | |
5 | +using System.Linq; | |
6 | +using System.Text; | |
7 | +using System.Threading.Tasks; | |
8 | +using System.Windows.Forms; | |
9 | + | |
10 | +namespace UmaTest.Infra.Presentation.View | |
11 | +{ | |
12 | + internal class DataGridViewHelper | |
13 | + { | |
14 | + public static void AdjustDataGridView(DataGridView dataGridView, BindingSource bindingSource, int dataSourceCount, Panel panel) | |
15 | + { | |
16 | + Size size = dataGridView.Size; | |
17 | + | |
18 | + dataGridView.SuspendLayout(); | |
19 | + | |
20 | + dataGridView.ScrollBars = ScrollBars.None; | |
21 | + panel.BackColor = SystemColors.ControlText; | |
22 | + | |
23 | + size.Height = size.Height - 1; | |
24 | + dataGridView.Size = size; | |
25 | + | |
26 | + dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.None; | |
27 | + dataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.None; | |
28 | + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.EnableResizing; | |
29 | + dataGridView.DataSource = bindingSource; | |
30 | + | |
31 | + dataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCells; | |
32 | + dataGridView.AutoSizeColumnsMode = dataSourceCount > 0 | |
33 | + ? DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader | |
34 | + : DataGridViewAutoSizeColumnsMode.AllCells; | |
35 | + dataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; | |
36 | + | |
37 | + size.Height = size.Height + 1; | |
38 | + dataGridView.Size = size; | |
39 | + | |
40 | + dataGridView.ScrollBars = ScrollBars.Both; | |
41 | + panel.BackColor = SystemColors.AppWorkspace; | |
42 | + | |
43 | + dataGridView.ClearSelection(); | |
44 | + | |
45 | + dataGridView.ResumeLayout(); | |
46 | + } | |
47 | + } | |
48 | +} |
@@ -273,6 +273,7 @@ | ||
273 | 273 | <Compile Include="Infra\Domain\UseCase\UseCaseResponse.cs" /> |
274 | 274 | <Compile Include="Infra\Adaptor\Controller\Handler\UseCaseRouter.cs" /> |
275 | 275 | <Compile Include="Infra\Presentation\View\DataContextHelper.cs" /> |
276 | + <Compile Include="Infra\Presentation\View\DataGridViewHelper.cs" /> | |
276 | 277 | <Compile Include="Infra\Presentation\View\IChildWindow.cs" /> |
277 | 278 | <Compile Include="Infra\Presentation\View\IChildDialog.cs" /> |
278 | 279 | <Compile Include="Infra\Presentation\View\IOwnerForm.cs" /> |