Procházet zdrojové kódy

GridView MultliSet

박영준 před 5 roky
rodič
revize
88bb574375

binární
.vs/Jdas_Mbic/v15/.suo


binární
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide


binární
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-shm


binární
.vs/Jdas_Mbic/v15/Server/sqlite3/storage.ide-wal


+ 44 - 52
Jdas_Mbic/Main.Designer.cs

@@ -116,12 +116,11 @@
116
             this.label30 = new System.Windows.Forms.Label();
116
             this.label30 = new System.Windows.Forms.Label();
117
             this.label29 = new System.Windows.Forms.Label();
117
             this.label29 = new System.Windows.Forms.Label();
118
             this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
118
             this.numericUpDown11 = new System.Windows.Forms.NumericUpDown();
119
-            this.numericUpDown10 = new System.Windows.Forms.NumericUpDown();
120
-            this.numericUpDown9 = new System.Windows.Forms.NumericUpDown();
121
-            this.button_AllZeroWrite = new System.Windows.Forms.Button();
122
-            this.button6 = new System.Windows.Forms.Button();
119
+            this.numericUpDown_MultiOffset = new System.Windows.Forms.NumericUpDown();
120
+            this.numericUpDown_MultiSet = new System.Windows.Forms.NumericUpDown();
121
+            this.button_CurrentOutput = new System.Windows.Forms.Button();
123
             this.button_MultiSet = new System.Windows.Forms.Button();
122
             this.button_MultiSet = new System.Windows.Forms.Button();
124
-            this.button8 = new System.Windows.Forms.Button();
123
+            this.button_MultiOffset = new System.Windows.Forms.Button();
125
             this.groupBox3 = new System.Windows.Forms.GroupBox();
124
             this.groupBox3 = new System.Windows.Forms.GroupBox();
126
             this.comboBox1 = new System.Windows.Forms.ComboBox();
125
             this.comboBox1 = new System.Windows.Forms.ComboBox();
127
             this.label_Function = new System.Windows.Forms.Label();
126
             this.label_Function = new System.Windows.Forms.Label();
@@ -181,8 +180,8 @@
181
             this.tabPage_Setting.SuspendLayout();
180
             this.tabPage_Setting.SuspendLayout();
182
             this.groupBox6.SuspendLayout();
181
             this.groupBox6.SuspendLayout();
183
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
182
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).BeginInit();
184
-            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).BeginInit();
185
-            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).BeginInit();
183
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_MultiOffset)).BeginInit();
184
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_MultiSet)).BeginInit();
186
             this.groupBox3.SuspendLayout();
185
             this.groupBox3.SuspendLayout();
187
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_TableSetting)).BeginInit();
186
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_TableSetting)).BeginInit();
188
             this.SuspendLayout();
187
             this.SuspendLayout();
@@ -1213,12 +1212,11 @@
1213
             this.groupBox6.Controls.Add(this.label30);
1212
             this.groupBox6.Controls.Add(this.label30);
1214
             this.groupBox6.Controls.Add(this.label29);
1213
             this.groupBox6.Controls.Add(this.label29);
1215
             this.groupBox6.Controls.Add(this.numericUpDown11);
1214
             this.groupBox6.Controls.Add(this.numericUpDown11);
1216
-            this.groupBox6.Controls.Add(this.numericUpDown10);
1217
-            this.groupBox6.Controls.Add(this.numericUpDown9);
1218
-            this.groupBox6.Controls.Add(this.button_AllZeroWrite);
1219
-            this.groupBox6.Controls.Add(this.button6);
1215
+            this.groupBox6.Controls.Add(this.numericUpDown_MultiOffset);
1216
+            this.groupBox6.Controls.Add(this.numericUpDown_MultiSet);
1217
+            this.groupBox6.Controls.Add(this.button_CurrentOutput);
1220
             this.groupBox6.Controls.Add(this.button_MultiSet);
1218
             this.groupBox6.Controls.Add(this.button_MultiSet);
1221
-            this.groupBox6.Controls.Add(this.button8);
1219
+            this.groupBox6.Controls.Add(this.button_MultiOffset);
1222
             this.groupBox6.Location = new System.Drawing.Point(338, 136);
1220
             this.groupBox6.Location = new System.Drawing.Point(338, 136);
1223
             this.groupBox6.Name = "groupBox6";
1221
             this.groupBox6.Name = "groupBox6";
1224
             this.groupBox6.Size = new System.Drawing.Size(493, 219);
1222
             this.groupBox6.Size = new System.Drawing.Size(493, 219);
@@ -1259,37 +1257,29 @@
1259
             this.numericUpDown11.Size = new System.Drawing.Size(120, 21);
1257
             this.numericUpDown11.Size = new System.Drawing.Size(120, 21);
1260
             this.numericUpDown11.TabIndex = 6;
1258
             this.numericUpDown11.TabIndex = 6;
1261
             // 
1259
             // 
1262
-            // numericUpDown10
1260
+            // numericUpDown_MultiOffset
1263
             // 
1261
             // 
1264
-            this.numericUpDown10.Location = new System.Drawing.Point(150, 102);
1265
-            this.numericUpDown10.Name = "numericUpDown10";
1266
-            this.numericUpDown10.Size = new System.Drawing.Size(120, 21);
1267
-            this.numericUpDown10.TabIndex = 6;
1262
+            this.numericUpDown_MultiOffset.Location = new System.Drawing.Point(150, 102);
1263
+            this.numericUpDown_MultiOffset.Name = "numericUpDown_MultiOffset";
1264
+            this.numericUpDown_MultiOffset.Size = new System.Drawing.Size(120, 21);
1265
+            this.numericUpDown_MultiOffset.TabIndex = 6;
1268
             // 
1266
             // 
1269
-            // numericUpDown9
1267
+            // numericUpDown_MultiSet
1270
             // 
1268
             // 
1271
-            this.numericUpDown9.Location = new System.Drawing.Point(150, 38);
1272
-            this.numericUpDown9.Name = "numericUpDown9";
1273
-            this.numericUpDown9.Size = new System.Drawing.Size(120, 21);
1274
-            this.numericUpDown9.TabIndex = 6;
1269
+            this.numericUpDown_MultiSet.Location = new System.Drawing.Point(150, 38);
1270
+            this.numericUpDown_MultiSet.Name = "numericUpDown_MultiSet";
1271
+            this.numericUpDown_MultiSet.Size = new System.Drawing.Size(120, 21);
1272
+            this.numericUpDown_MultiSet.TabIndex = 6;
1275
             // 
1273
             // 
1276
-            // button_AllZeroWrite
1274
+            // button_CurrentOutput
1277
             // 
1275
             // 
1278
-            this.button_AllZeroWrite.Location = new System.Drawing.Point(372, 35);
1279
-            this.button_AllZeroWrite.Name = "button_AllZeroWrite";
1280
-            this.button_AllZeroWrite.Size = new System.Drawing.Size(115, 156);
1281
-            this.button_AllZeroWrite.TabIndex = 5;
1282
-            this.button_AllZeroWrite.Text = "All Zero Write";
1283
-            this.button_AllZeroWrite.UseVisualStyleBackColor = true;
1284
-            // 
1285
-            // button6
1286
-            // 
1287
-            this.button6.Location = new System.Drawing.Point(291, 168);
1288
-            this.button6.Name = "button6";
1289
-            this.button6.Size = new System.Drawing.Size(75, 23);
1290
-            this.button6.TabIndex = 1;
1291
-            this.button6.Text = "APPLY";
1292
-            this.button6.UseVisualStyleBackColor = true;
1276
+            this.button_CurrentOutput.Location = new System.Drawing.Point(291, 168);
1277
+            this.button_CurrentOutput.Name = "button_CurrentOutput";
1278
+            this.button_CurrentOutput.Size = new System.Drawing.Size(75, 23);
1279
+            this.button_CurrentOutput.TabIndex = 1;
1280
+            this.button_CurrentOutput.Text = "APPLY";
1281
+            this.button_CurrentOutput.UseVisualStyleBackColor = true;
1282
+            this.button_CurrentOutput.Click += new System.EventHandler(this.button_CurrentOutput_Click);
1293
             // 
1283
             // 
1294
             // button_MultiSet
1284
             // button_MultiSet
1295
             // 
1285
             // 
@@ -1301,14 +1291,15 @@
1301
             this.button_MultiSet.UseVisualStyleBackColor = true;
1291
             this.button_MultiSet.UseVisualStyleBackColor = true;
1302
             this.button_MultiSet.Click += new System.EventHandler(this.button_MultiSet_Click);
1292
             this.button_MultiSet.Click += new System.EventHandler(this.button_MultiSet_Click);
1303
             // 
1293
             // 
1304
-            // button8
1294
+            // button_MultiOffset
1305
             // 
1295
             // 
1306
-            this.button8.Location = new System.Drawing.Point(291, 102);
1307
-            this.button8.Name = "button8";
1308
-            this.button8.Size = new System.Drawing.Size(75, 23);
1309
-            this.button8.TabIndex = 3;
1310
-            this.button8.Text = "APPLY";
1311
-            this.button8.UseVisualStyleBackColor = true;
1296
+            this.button_MultiOffset.Location = new System.Drawing.Point(291, 102);
1297
+            this.button_MultiOffset.Name = "button_MultiOffset";
1298
+            this.button_MultiOffset.Size = new System.Drawing.Size(75, 23);
1299
+            this.button_MultiOffset.TabIndex = 3;
1300
+            this.button_MultiOffset.Text = "APPLY";
1301
+            this.button_MultiOffset.UseVisualStyleBackColor = true;
1302
+            this.button_MultiOffset.Click += new System.EventHandler(this.button_MultiOffset_Click);
1312
             // 
1303
             // 
1313
             // groupBox3
1304
             // groupBox3
1314
             // 
1305
             // 
@@ -1386,6 +1377,7 @@
1386
             this.button_Expansion.TabIndex = 0;
1377
             this.button_Expansion.TabIndex = 0;
1387
             this.button_Expansion.Text = "Expansion";
1378
             this.button_Expansion.Text = "Expansion";
1388
             this.button_Expansion.UseVisualStyleBackColor = true;
1379
             this.button_Expansion.UseVisualStyleBackColor = true;
1380
+            this.button_Expansion.Click += new System.EventHandler(this.button_Expansion_Click);
1389
             // 
1381
             // 
1390
             // button_FileLoad
1382
             // button_FileLoad
1391
             // 
1383
             // 
@@ -1413,6 +1405,7 @@
1413
             this.button_Initalize.TabIndex = 0;
1405
             this.button_Initalize.TabIndex = 0;
1414
             this.button_Initalize.Text = "Initalize";
1406
             this.button_Initalize.Text = "Initalize";
1415
             this.button_Initalize.UseVisualStyleBackColor = true;
1407
             this.button_Initalize.UseVisualStyleBackColor = true;
1408
+            this.button_Initalize.Click += new System.EventHandler(this.button_Initalize_Click);
1416
             // 
1409
             // 
1417
             // dataGridView_TableSetting
1410
             // dataGridView_TableSetting
1418
             // 
1411
             // 
@@ -1508,8 +1501,8 @@
1508
             this.groupBox6.ResumeLayout(false);
1501
             this.groupBox6.ResumeLayout(false);
1509
             this.groupBox6.PerformLayout();
1502
             this.groupBox6.PerformLayout();
1510
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
1503
             ((System.ComponentModel.ISupportInitialize)(this.numericUpDown11)).EndInit();
1511
-            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown10)).EndInit();
1512
-            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown9)).EndInit();
1504
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_MultiOffset)).EndInit();
1505
+            ((System.ComponentModel.ISupportInitialize)(this.numericUpDown_MultiSet)).EndInit();
1513
             this.groupBox3.ResumeLayout(false);
1506
             this.groupBox3.ResumeLayout(false);
1514
             this.groupBox3.PerformLayout();
1507
             this.groupBox3.PerformLayout();
1515
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_TableSetting)).EndInit();
1508
             ((System.ComponentModel.ISupportInitialize)(this.dataGridView_TableSetting)).EndInit();
@@ -1607,12 +1600,11 @@
1607
         private System.Windows.Forms.Label label30;
1600
         private System.Windows.Forms.Label label30;
1608
         private System.Windows.Forms.Label label29;
1601
         private System.Windows.Forms.Label label29;
1609
         private System.Windows.Forms.NumericUpDown numericUpDown11;
1602
         private System.Windows.Forms.NumericUpDown numericUpDown11;
1610
-        private System.Windows.Forms.NumericUpDown numericUpDown10;
1611
-        private System.Windows.Forms.NumericUpDown numericUpDown9;
1612
-        private System.Windows.Forms.Button button_AllZeroWrite;
1613
-        private System.Windows.Forms.Button button6;
1603
+        private System.Windows.Forms.NumericUpDown numericUpDown_MultiOffset;
1604
+        private System.Windows.Forms.NumericUpDown numericUpDown_MultiSet;
1605
+        private System.Windows.Forms.Button button_CurrentOutput;
1614
         private System.Windows.Forms.Button button_MultiSet;
1606
         private System.Windows.Forms.Button button_MultiSet;
1615
-        private System.Windows.Forms.Button button8;
1607
+        private System.Windows.Forms.Button button_MultiOffset;
1616
         private System.Windows.Forms.GroupBox groupBox3;
1608
         private System.Windows.Forms.GroupBox groupBox3;
1617
         private System.Windows.Forms.ComboBox comboBox1;
1609
         private System.Windows.Forms.ComboBox comboBox1;
1618
         private System.Windows.Forms.Label label_Function;
1610
         private System.Windows.Forms.Label label_Function;

+ 87 - 12
Jdas_Mbic/Main.cs

@@ -88,7 +88,16 @@ namespace Jdas_Mbic
88
                     }
88
                     }
89
                     break;
89
                     break;
90
             }
90
             }
91
-            
91
+            foreach (DataGridViewRow row in this.dataGridView_TableSetting.Rows)
92
+            {
93
+                row.HeaderCell.Value = String.Format("{0}", row.Index + 1);
94
+            }
95
+            this.dataGridView_TableSetting.AutoResizeRowHeadersWidth(
96
+            DataGridViewRowHeadersWidthSizeMode.AutoSizeToAllHeaders);
97
+            this.dataGridView_TableSetting.TopLeftHeaderCell.Value = "No.";
98
+            dataGridView_TableSetting.Columns[0].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter;
99
+            dataGridView_TableSetting.ClearSelection();
100
+
92
         }
101
         }
93
         private void Temp_TableLayoutSetting()
102
         private void Temp_TableLayoutSetting()
94
         {
103
         {
@@ -173,9 +182,10 @@ namespace Jdas_Mbic
173
            
182
            
174
                 
183
                 
175
         }
184
         }
176
-
177
-        private void button_MultiSet_Click(object sender, EventArgs e)
185
+        private List<int> DataGridViewIndexOutput()
178
         {
186
         {
187
+            List<int> Tmplist = new List<int>();
188
+
179
             Int32 selectedCellCount =
189
             Int32 selectedCellCount =
180
             dataGridView_TableSetting.GetCellCount(DataGridViewElementStates.Selected);
190
             dataGridView_TableSetting.GetCellCount(DataGridViewElementStates.Selected);
181
             if (selectedCellCount > 0)
191
             if (selectedCellCount > 0)
@@ -189,22 +199,87 @@ namespace Jdas_Mbic
189
                     System.Text.StringBuilder sb =
199
                     System.Text.StringBuilder sb =
190
                         new System.Text.StringBuilder();
200
                         new System.Text.StringBuilder();
191
 
201
 
192
-                    for (int i = 0;
193
-                        i < selectedCellCount; i++)
202
+                    //for (int i = 0;i < selectedCellCount; i++)
203
+                    for (int i = 0; i < selectedCellCount; i += 2)
194
                     {
204
                     {
195
                         sb.Append("Row: ");
205
                         sb.Append("Row: ");
196
-                        sb.Append(dataGridView_TableSetting.SelectedCells[i].RowIndex
197
-                            .ToString());
198
-                        sb.Append(", Column: ");
199
-                        sb.Append(dataGridView_TableSetting.SelectedCells[i].ColumnIndex
200
-                            .ToString());
206
+                        sb.Append(dataGridView_TableSetting.SelectedCells[i].RowIndex.ToString());
207
+                        Tmplist.Add(dataGridView_TableSetting.SelectedCells[i].RowIndex);
208
+                        /*sb.Append(", Column: ");
209
+                        sb.Append(dataGridView_TableSetting.SelectedCells[i].ColumnIndex.ToString());*/
201
                         sb.Append(Environment.NewLine);
210
                         sb.Append(Environment.NewLine);
202
                     }
211
                     }
203
 
212
 
204
-                    sb.Append("Total: " + selectedCellCount.ToString());
205
-                    MessageBox.Show(sb.ToString(), "Selected Cells");
213
+                    // sb.Append("Total: " + selectedCellCount.ToString());
214
+                   // MessageBox.Show(sb.ToString(), "Selected Cells");
206
                 }
215
                 }
207
             }
216
             }
217
+            return Tmplist;
218
+        }
219
+        private void button_MultiSet_Click(object sender, EventArgs e)
220
+        {
221
+            List<int> TmpList = new List<int>();
222
+            TmpList = DataGridViewIndexOutput();
223
+            for(int i = 0; i < TmpList.Count; i++)
224
+            {
225
+                dataGridView_TableSetting[1, TmpList[i]].Value = numericUpDown_MultiSet.Value.ToString();
226
+            }
227
+        }
228
+
229
+        private void button_Expansion_Click(object sender, EventArgs e)
230
+        {
231
+            List<int> TmpList = new List<int>();
232
+            int Count = 0;
233
+            double MaxVal = 0, MinVal = 0,Result = 0;
234
+            double Tmpdata = 0;
235
+
236
+            TmpList = DataGridViewIndexOutput();
237
+            TmpList.Sort();
238
+
239
+            Count = (TmpList[TmpList.Count - 1] - TmpList[0]);
240
+            MaxVal = Convert.ToDouble(dataGridView_TableSetting[1,TmpList[TmpList.Count - 1]].Value);
241
+            MinVal = Convert.ToDouble(dataGridView_TableSetting[1, TmpList[0]].Value);
242
+
243
+            Result = (MaxVal - MinVal) / Count;
244
+
245
+            for (int i = 1; i < Count; i++)
246
+            {
247
+                Tmpdata = Convert.ToDouble(dataGridView_TableSetting[1, TmpList[0] + i].Value);
248
+                dataGridView_TableSetting[1, TmpList[0] + i].Value = string.Format("{0:0.0}",Math.Round(Tmpdata + Result, 1));
249
+            }
250
+
251
+           /* for (int i = 0; i < TmpList.Count; i++)
252
+            {
253
+                dataGridView_TableSetting[1, TmpList[i]].Value = numericUpDown_MultiSet.Value.ToString();
254
+            }*/
255
+        }
256
+
257
+        private void button_Initalize_Click(object sender, EventArgs e)
258
+        {
259
+            for (int i = 0; i < dataGridView_TableSetting.RowCount; i++)
260
+            {
261
+                dataGridView_TableSetting[1, i].Value = 0;
262
+            }
263
+
264
+        }
265
+
266
+        private void button_CurrentOutput_Click(object sender, EventArgs e)
267
+        {
268
+
269
+        }
270
+
271
+        private void button_MultiOffset_Click(object sender, EventArgs e)
272
+        {
273
+            List<int> TmpList = new List<int>();
274
+            TmpList = DataGridViewIndexOutput();
275
+            double CurrentVal = 0, SumVal = 0;
276
+
277
+            for (int i = 0; i < TmpList.Count; i++)
278
+            {
279
+                CurrentVal = Convert.ToDouble(dataGridView_TableSetting[1, TmpList[i]].Value);
280
+                SumVal = Convert.ToDouble(numericUpDown_MultiOffset.Value);
281
+                dataGridView_TableSetting[1, TmpList[i]].Value = Convert.ToString(CurrentVal + SumVal);
282
+            }
208
         }
283
         }
209
     }
284
     }
210
 }
285
 }

+ 0 - 6
Jdas_Mbic/Main.resx

@@ -117,12 +117,6 @@
117
   <resheader name="writer">
117
   <resheader name="writer">
118
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
118
     <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
   </resheader>
119
   </resheader>
120
-  <metadata name="Column_DB.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
121
-    <value>True</value>
122
-  </metadata>
123
-  <metadata name="Column_Offset.UserAddedColumn" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
124
-    <value>True</value>
125
-  </metadata>
126
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
120
   <assembly alias="System.Drawing" name="System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
127
   <data name="pictureBox18.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
121
   <data name="pictureBox18.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
128
     <value>
122
     <value>

binární
Jdas_Mbic/bin/Debug/Jdas_Mbic.exe


binární
Jdas_Mbic/bin/Debug/Jdas_Mbic.pdb


binární
Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferences.cache


binární
Jdas_Mbic/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache


+ 1 - 1
Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.CoreCompileInputs.cache

@@ -1 +1 @@
1
-fb755ef108369250d2b84a4262663b049d543842
1
+3f22cb9319fbd26c7f0acfa8b7f6fa23632611c4

binární
Jdas_Mbic/obj/Debug/Jdas_Mbic.csproj.GenerateResource.cache


binární
Jdas_Mbic/obj/Debug/Jdas_Mbic.csprojAssemblyReference.cache


binární
Jdas_Mbic/obj/Debug/Jdas_Mbic.exe


binární
Jdas_Mbic/obj/Debug/Jdas_Mbic.pdb