From: newton-cn Date: Thu, 1 May 2025 07:23:09 +0000 (+0900) Subject: 매출정보 색상넣기 X-Git-Url: https://git.insang.kr/gitweb/?a=commitdiff_plain;h=ed0c111bfb4113ad75c7e5b5c3b393b6e08eeefb;p=wevape-lu1_pos.git 매출정보 색상넣기 --- diff --git a/.vs/newton-cn/v16/.suo b/.vs/newton-cn/v16/.suo index 0044392..28b6fff 100644 Binary files a/.vs/newton-cn/v16/.suo and b/.vs/newton-cn/v16/.suo differ diff --git a/newton-cn/Form6.cs b/newton-cn/Form6.cs index 65076ec..2994bd2 100644 --- a/newton-cn/Form6.cs +++ b/newton-cn/Form6.cs @@ -43,15 +43,38 @@ namespace newton_cn dataGridView1.DataSource = dbc.getDisposableAnalysis(todayFormatted); try { - dataGridView1.Columns["상품명"].Width = 200; - dataGridView1.Columns["비율"].Width = 55; + dataGridView1.Columns["상품명"].Width = 180; + dataGridView1.Columns["비율"].Width = 80; dataGridView1.Columns["개수"].Width = 55; - dataGridView1.Columns["매출"].Width = 80; + dataGridView1.Columns["매출"].Width = 105; } catch (Exception) { } + + // 색상 적용 + foreach (DataGridViewRow row in dataGridView1.Rows) + { + if (row.IsNewRow) continue; // 새 행 무시 + + string colorStr = row.Cells["row_color"].Value?.ToString(); + if (!string.IsNullOrEmpty(colorStr)) + { + try + { + row.DefaultCellStyle.BackColor = Color.FromName(colorStr); + row.DefaultCellStyle.Font = new Font(dataGridView1.Font.FontFamily, 10, FontStyle.Bold); + } + catch + { + // 유효하지 않은 색상일 경우 무시 + } + } + } + + // 색상 표기된 컬럼 숨기기 (원한다면) + dataGridView1.Columns["row_color"].Visible = false; } private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e) @@ -71,16 +94,47 @@ namespace newton_cn dataGridView1.DataSource = dbc.getDisposableAnalysis(result); try { - dataGridView1.Columns["상품명"].Width = 200; - dataGridView1.Columns["비율"].Width = 55; + dataGridView1.Columns["상품명"].Width = 180; + dataGridView1.Columns["비율"].Width = 80; dataGridView1.Columns["개수"].Width = 55; - dataGridView1.Columns["매출"].Width = 80; + dataGridView1.Columns["매출"].Width = 105; } catch (Exception) { } + // 색상 적용 + foreach (DataGridViewRow row in dataGridView1.Rows) + { + if (row.IsNewRow) continue; // 새 행 무시 + + try + { + string colorStr = row.Cells["row_color"].Value?.ToString(); + if (!string.IsNullOrEmpty(colorStr)) + { + try + { + row.DefaultCellStyle.BackColor = Color.FromName(colorStr); + row.DefaultCellStyle.Font = new Font(dataGridView1.Font.FontFamily, 10, FontStyle.Bold); + } + catch + { + // 유효하지 않은 색상일 경우 무시 + } + } + // 색상 표기된 컬럼 숨기기 (원한다면) + dataGridView1.Columns["row_color"].Visible = false; + } + catch + { + + } + } + + + } private void button4_Click(object sender, EventArgs e) diff --git a/newton-cn/bin/Debug/newton-cn.exe b/newton-cn/bin/Debug/newton-cn.exe index b6ab763..258a21d 100644 Binary files a/newton-cn/bin/Debug/newton-cn.exe and b/newton-cn/bin/Debug/newton-cn.exe differ diff --git a/newton-cn/bin/Debug/newton-cn.pdb b/newton-cn/bin/Debug/newton-cn.pdb index 88f9401..ff7dfa1 100644 Binary files a/newton-cn/bin/Debug/newton-cn.pdb and b/newton-cn/bin/Debug/newton-cn.pdb differ diff --git a/newton-cn/bin/Release/newton-cn.exe b/newton-cn/bin/Release/newton-cn.exe index 7cd0a92..500fe40 100644 Binary files a/newton-cn/bin/Release/newton-cn.exe and b/newton-cn/bin/Release/newton-cn.exe differ diff --git a/newton-cn/bin/Release/newton-cn.pdb b/newton-cn/bin/Release/newton-cn.pdb index 55a898c..503c938 100644 Binary files a/newton-cn/bin/Release/newton-cn.pdb and b/newton-cn/bin/Release/newton-cn.pdb differ diff --git a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache index c038318..2e4a33e 100644 Binary files a/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache and b/newton-cn/obj/Debug/DesignTimeResolveAssemblyReferences.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache index 654fe63..f5e894a 100644 Binary files a/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache and b/newton-cn/obj/Debug/newton-cn.csproj.AssemblyReference.cache differ diff --git a/newton-cn/obj/Debug/newton-cn.exe b/newton-cn/obj/Debug/newton-cn.exe index b6ab763..258a21d 100644 Binary files a/newton-cn/obj/Debug/newton-cn.exe and b/newton-cn/obj/Debug/newton-cn.exe differ diff --git a/newton-cn/obj/Debug/newton-cn.pdb b/newton-cn/obj/Debug/newton-cn.pdb index 88f9401..ff7dfa1 100644 Binary files a/newton-cn/obj/Debug/newton-cn.pdb and b/newton-cn/obj/Debug/newton-cn.pdb differ diff --git a/newton-cn/obj/Release/newton-cn.exe b/newton-cn/obj/Release/newton-cn.exe index 7cd0a92..500fe40 100644 Binary files a/newton-cn/obj/Release/newton-cn.exe and b/newton-cn/obj/Release/newton-cn.exe differ diff --git a/newton-cn/obj/Release/newton-cn.pdb b/newton-cn/obj/Release/newton-cn.pdb index 55a898c..503c938 100644 Binary files a/newton-cn/obj/Release/newton-cn.pdb and b/newton-cn/obj/Release/newton-cn.pdb differ