{"id":956,"date":"2018-06-23T21:28:24","date_gmt":"2018-06-23T12:28:24","guid":{"rendered":"http:\/\/cromi.com\/?p=956"},"modified":"2018-06-23T15:34:24","modified_gmt":"2018-06-23T06:34:24","slug":"datagridview-%ec%86%8d%ec%84%b1-%eb%a6%ac%ec%8a%a4%ed%8a%b8","status":"publish","type":"post","link":"http:\/\/cromi.com\/?p=956","title":{"rendered":"dataGridView \uc18d\uc131 \ub9ac\uc2a4\ud2b8"},"content":{"rendered":"<pre lang=\"csharp\">\r\n\r\n\/\/\uceec\ub7fc\ucd08\uae30\ud654\r\n            this.dataGridView1.Columns.Clear();\r\n \r\n\/\/\uceec\ub7fc \uba85 \ubcc0\uacbd\r\n            this.dataGridView1.Columns.Add(\"gubun\", \"\uad6c\ubd84\");\r\n            this.dataGridView1.Columns.Add(\"monthly\", month);\r\n\/\/\uceec\ub7fc \uc228\uae30\uae30         \r\n            this.dataGridView1.Columns.Add(\"devi_name\", \"\ube44\uace0\");\r\n            this.dataGridView1.Columns[\"devi_name\"].Visible = false;\r\n\/\/\uceec\ub7fc \uace0\uc815\r\n            this.dataGridView1.Columns[5].Frozen = true;\r\n            this.dataGridView1.Columns[5].DividerWidth = 2;\r\n\/\/\uceec\ub7fc \uc2f8\uc774\uc988\r\n            this.dataGridView1.Columns[0].Width = 170;\r\n            this.dataGridView1.Columns[1].Width = 90;\r\n\/\/\uceec\ub7fc \uc0c9\uc0c1\r\n            this.dataGridView1.Columns[13].DefaultCellStyle.BackColor = Color.Cornsilk;\r\n\/\/Sort  \uae08\uc9c0\r\n            int i;\r\n            for (i = 0; i <= 19; i++)\r\n            {\r\n                this.dataGridView1.Columns[i].SortMode = DataGridViewColumnSortMode.NotSortable;\r\n \r\n            }\r\n\/\/ DB Binding  \uceec\ub7fc \uc9c0\uc815\r\n            foreach (DataRow r in dt.Rows)\r\n            {\r\n                \r\n                int n = dataGridView1.Rows.Add();\r\n                dataGridView1.Rows[n].Cells[0].Value = r[\"devi_cd\"].ToString();\r\n                dataGridView1.Rows[n].Cells[1].Value = r[\"devi_name\"].ToString();\r\n                dataGridView1.Rows[n].Cells[2].Value = r[\"gubun\"].ToString();\r\n             }\r\n\/\/ DB Binding  DataTable\r\n                DataTable dt = db.GetDBTable(sql);\r\n                dataGridView1.DataSource = dt;\r\n                dataGridView1.Columns[3].Frozen = true;\r\n                dataGridView1.Columns[3].DividerWidth = 2;\r\n \r\n\/\/ Datagridview Row \uc0c9\uc0c1 \ubcc0\uacbd\r\n            private void dataGridView1_CellFormatting(object sender, DataGridViewCellFormattingEventArgs e)\r\n            {\r\n               \/\/TOTAL\r\n                if (dataGridView1.Rows[e.RowIndex].Cells[\"devi_name\"].Value.ToString() ==\r\n                        \"A\" &#038;&#038; dataGridView1.Rows[e.RowIndex+3].Cells[\"gubun\"].Value.ToString() == \"LIPAS\")\r\n                 {\r\n                     dataGridView1.Rows[e.RowIndex+3].DefaultCellStyle.BackColor = Color.FromArgb(255, 196, 255);\r\n                 }\r\n \r\n                if (dataGridView1.Rows[e.RowIndex].Cells[\"devi_name\"].Value.ToString() == \"A\" \r\n                         &#038;&#038; dataGridView1.Rows[e.RowIndex+4].Cells[\"gubun\"].Value.ToString() == \"VOLPAS\")\r\n                 {\r\n               \/\/ \uc804\uccb4 \ud3f0\ud2b8\r\n                     dataGridView1.Rows[e.RowIndex+4].DefaultCellStyle.BackColor = Color.FromArgb(255, 232, 255);\r\n                 }\r\n             }\r\n\r\n\r\n\r\n\r\n<\/pre>\n<!-- AddThis Advanced Settings generic via filter on the_content --><!-- AddThis Share Buttons generic via filter on the_content -->","protected":false},"excerpt":{"rendered":"<p>\/\/\uceec\ub7fc\ucd08\uae30\ud654 this.dataGridView1.Columns.Clear(); \/\/\uceec\ub7fc \uba85 \ubcc0\uacbd this.dataGridView1.Columns.Add(&#8220;gubun&#8221;, &#8220;\uad6c\ubd84&#8221;); this.dataGridView1.Columns.Add(&#8220;monthly&#8221;, month); \/\/\uceec\ub7fc \uc228\uae30\uae30 this.dataGridView1.Columns.Add(&#8220;devi_name&#8221;, &#8220;\ube44\uace0&#8221;); this.dataGridView1.Columns[&#8220;devi_name&#8221;].Visible = false; \/\/\uceec\ub7fc \uace0\uc815 this.dataGridView1.Columns[5].Frozen = true; this.dataGridView1.Columns[5].DividerWidth = 2; \/\/\uceec\ub7fc \uc2f8\uc774\uc988 this.dataGridView1.Columns[0].Width = 170; this.dataGridView1.Columns[1].Width = 90; \/\/\uceec\ub7fc \uc0c9\uc0c1 this.dataGridView1.Columns[13].DefaultCellStyle.BackColor = Color.Cornsilk; \/\/Sort \uae08\uc9c0 int i; for (i = 0; i<!-- AddThis Advanced Settings generic via filter on get_the_excerpt --><!-- AddThis Share Buttons generic via filter on get_the_excerpt --><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[16,54,240],"class_list":["post-956","post","type-post","status-publish","format-standard","hentry","category-vs2008","tag-c","tag-c-2008","tag-c2008"],"_links":{"self":[{"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/posts\/956","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/cromi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=956"}],"version-history":[{"count":5,"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/posts\/956\/revisions"}],"predecessor-version":[{"id":962,"href":"http:\/\/cromi.com\/index.php?rest_route=\/wp\/v2\/posts\/956\/revisions\/962"}],"wp:attachment":[{"href":"http:\/\/cromi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=956"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/cromi.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=956"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/cromi.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=956"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}