- 눈에 안 띄는 글자들 처리(listview group, trend chart legend)

- listview column width 꽉차도록 처리
This commit is contained in:
2017-06-23 03:00:13 +09:00
parent c5344b873f
commit 244eab56a6
7 changed files with 64 additions and 22 deletions

View File

@@ -59,7 +59,7 @@
//
this.label3.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.label3.AutoSize = true;
this.label3.Location = new System.Drawing.Point(10, 424);
this.label3.Location = new System.Drawing.Point(10, 339);
this.label3.Name = "label3";
this.label3.Size = new System.Drawing.Size(86, 12);
this.label3.TabIndex = 6;
@@ -67,8 +67,7 @@
//
// lvSpring
//
this.lvSpring.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
this.lvSpring.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvSpring.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchSpring});
@@ -76,7 +75,7 @@
this.lvSpring.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvSpring.Location = new System.Drawing.Point(12, 61);
this.lvSpring.Name = "lvSpring";
this.lvSpring.Size = new System.Drawing.Size(326, 343);
this.lvSpring.Size = new System.Drawing.Size(326, 263);
this.lvSpring.TabIndex = 7;
this.lvSpring.UseCompatibleStateImageBehavior = false;
this.lvSpring.View = System.Windows.Forms.View.Details;
@@ -90,15 +89,16 @@
//
// lvTable
//
this.lvTable.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)
this.lvTable.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.lvTable.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchTable});
this.lvTable.FullRowSelect = true;
this.lvTable.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.None;
this.lvTable.Location = new System.Drawing.Point(12, 439);
this.lvTable.Location = new System.Drawing.Point(12, 354);
this.lvTable.Name = "lvTable";
this.lvTable.Size = new System.Drawing.Size(326, 276);
this.lvTable.Size = new System.Drawing.Size(326, 361);
this.lvTable.TabIndex = 8;
this.lvTable.UseCompatibleStateImageBehavior = false;
this.lvTable.View = System.Windows.Forms.View.Details;

View File

@@ -58,12 +58,12 @@ namespace friction
private void lvSpring_SizeChanged(object sender, EventArgs e)
{
lvSpring.Columns[0].Width = lvSpring.Width - SystemInformation.VerticalScrollBarWidth - lvSpring.Margin.Right*2;
Theme.ResizeFullColumn(lvSpring);
}
private void lvTable_SizeChanged(object sender, EventArgs e)
{
lvTable.Columns[0].Width = lvTable.Width - SystemInformation.VerticalScrollBarWidth - lvTable.Margin.Right*2;
Theme.ResizeFullColumn(lvTable);
}
private void SelectSpring(int iIdx)

View File

@@ -43,7 +43,7 @@ namespace friction
chart.ChartAreas[0].AxisX.MinorTickMark.Enabled = false;
chart.ChartAreas[0].AxisY.MajorTickMark.Enabled = true;
chart.ChartAreas[0].AxisY.MajorTickMark.LineWidth = 1;
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(100, 0, 0, 0);
chart.ChartAreas[0].AxisY.MajorTickMark.LineColor = Color.FromArgb(50, 0, 0, 0);
chart.ChartAreas[0].AxisY.MinorTickMark.Enabled = false;
foreach (var series in chart.Series)

View File

@@ -28,8 +28,6 @@
/// </summary>
private void InitializeComponent()
{
System.Windows.Forms.ListViewGroup listViewGroup1 = new System.Windows.Forms.ListViewGroup("Active Columns", System.Windows.Forms.HorizontalAlignment.Left);
System.Windows.Forms.ListViewGroup listViewGroup2 = new System.Windows.Forms.ListViewGroup("Nonactive Columns", System.Windows.Forms.HorizontalAlignment.Left);
this.dgvData = new System.Windows.Forms.DataGridView();
this.lvColumn = new System.Windows.Forms.ListView();
this.lvchColumns = ((System.Windows.Forms.ColumnHeader)(new System.Windows.Forms.ColumnHeader()));
@@ -60,13 +58,6 @@
this.lvColumn.Columns.AddRange(new System.Windows.Forms.ColumnHeader[] {
this.lvchColumns});
this.lvColumn.FullRowSelect = true;
listViewGroup1.Header = "Active Columns";
listViewGroup1.Name = "lvgActiveColumn";
listViewGroup2.Header = "Nonactive Columns";
listViewGroup2.Name = "lbgNonactiveColumn";
this.lvColumn.Groups.AddRange(new System.Windows.Forms.ListViewGroup[] {
listViewGroup1,
listViewGroup2});
this.lvColumn.HeaderStyle = System.Windows.Forms.ColumnHeaderStyle.Nonclickable;
this.lvColumn.Location = new System.Drawing.Point(722, 3);
this.lvColumn.MultiSelect = false;
@@ -76,6 +67,7 @@
this.lvColumn.UseCompatibleStateImageBehavior = false;
this.lvColumn.View = System.Windows.Forms.View.Details;
this.lvColumn.ItemChecked += new System.Windows.Forms.ItemCheckedEventHandler(this.lvColumn_ItemChecked);
this.lvColumn.SizeChanged += new System.EventHandler(this.lvColumn_SizeChanged);
//
// lvchColumns
//

View File

@@ -59,8 +59,6 @@ namespace friction
CacheChecked.Add(key, bChecked);
}
lvColumn.Groups[0].Items.Clear();
lvColumn.Groups[1].Items.Clear();
lvColumn.Items.Clear();
List<List<string>> Columns = new List<List<string>>() { data.GetActiveColumns(), data.GetNonactiveColumns() };
@@ -76,8 +74,10 @@ namespace friction
item.Checked = true;
else
item.Checked = false;
item.ForeColor = (iGroup == 0) ? Theme.Forecolor : Theme.Gray;
lvColumn.Items.Add(item);
lvColumn.Groups[iGroup].Items.Add(item);
}
}
}
@@ -90,6 +90,11 @@ namespace friction
dgvData.Columns[strColName].Visible = bShow;
}
private void lvColumn_SizeChanged(object sender, EventArgs e)
{
Theme.ResizeFullColumn(lvColumn);
}
public void SelectRowByHumidity(string strSpring, string strTable, float fHumidity, float fRPN)
{
dgvData.ClearSelection();

View File

@@ -90,6 +90,10 @@ namespace friction
trendChart.LegendLocation = LegendLocation.Right;
trendChart.DataClick += TrendChart_DataClick;
trendChart.DefaultLegend.Foreground = new SolidColorBrush(
System.Windows.Media.Color.FromArgb(
Theme.Forecolor.A, Theme.Forecolor.R, Theme.Forecolor.G, Theme.Forecolor.B));
}
public void Reset()

View File

@@ -62,6 +62,47 @@ namespace friction
e.DrawDefault = true;
}
public static void ResizeFullColumn(ListView view)
{
bool bScrollbarPresented = false;
foreach (var scroll in view.Controls.OfType<VScrollBar>())
{
bScrollbarPresented = true;
break;
}
int iWidth = view.Width;
if (bScrollbarPresented == true)
iWidth -= SystemInformation.VerticalScrollBarWidth;
switch (view.BorderStyle)
{
case BorderStyle.Fixed3D:
iWidth -= 4;
break;
case BorderStyle.FixedSingle:
iWidth -= 2;
break;
}
for (int i = 0; i < view.Columns.Count; i++)
{
if (view.Columns[i].Width < iWidth)
{
iWidth -= view.Columns[i].Width;
}
else
{
view.Columns[i].Width = iWidth;
// Hide columns that can't fit
for (int jx = i + 1; jx < view.Columns.Count; ++jx)
view.Columns[jx].Width = 0;
return;
}
}
view.Columns[view.Columns.Count - 1].Width += iWidth;
}
public class MenustripColor : ProfessionalColorTable
{
public override Color MenuItemSelected { get { return BackColorTrans; } }