| | |
| | | { |
| | | public Action<string, LogInfoType> LogInfo; |
| | | |
| | | private Panel currentContentPanel; |
| | | private int row2OriginalHeight; |
| | | private int row3OriginalHeight; |
| | | public HistoricalDataEditPage() |
| | | { |
| | | Name = "HistoricalDataEditPage"; |
| | | Text = "历史数据查询"; |
| | | |
| | | InitializeComponent(); |
| | | |
| | | // 保存原始行高度 |
| | | row2OriginalHeight = (int)tableLayoutPanel3.RowStyles[1].Height; |
| | | row3OriginalHeight = (int)tableLayoutPanel3.RowStyles[2].Height; |
| | | |
| | | InitializeDataGridView(); |
| | | InitializeComboBox(); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 数据显示表格初始化 |
| | | /// </summary> |
| | | private void InitializeDataGridView() |
| | | { |
| | | // 设置DataGridView列宽 |
| | |
| | | dataGridViewHD.RowHeadersVisible = true; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 选择依据下拉框初始化 |
| | | /// </summary> |
| | | private void InitializeComboBox() |
| | | { |
| | | comboBoxSearchBasis.Items.Add("日期"); |
| | |
| | | comboBoxSearchBasis.SelectedIndex = 0; |
| | | } |
| | | |
| | | private void tableLayoutPanel2_Paint(object sender, PaintEventArgs e) |
| | | /// <summary> |
| | | /// 下拉框控制选项视图变换 |
| | | /// </summary> |
| | | /// <param name="sender"></param> |
| | | /// <param name="e"></param> |
| | | private void comboBoxSearchBasis_SelectedIndexChanged(object sender, EventArgs e) |
| | | { |
| | | ComboBox cb = sender as ComboBox; |
| | | |
| | | if (cb.SelectedIndex == 0) |
| | | { |
| | | ShowRow2(); |
| | | } |
| | | else if (cb.SelectedIndex == 1) |
| | | { |
| | | ShowRow3(); |
| | | } |
| | | } |
| | | |
| | | private void ShowRow2() |
| | | { |
| | | // 显示Row2(恢复高度) |
| | | tableLayoutPanel3.RowStyles[1].SizeType = SizeType.Absolute; |
| | | tableLayoutPanel3.RowStyles[1].Height = row2OriginalHeight; |
| | | |
| | | // 隐藏Row3(高度设为0) |
| | | tableLayoutPanel3.RowStyles[2].SizeType = SizeType.Absolute; |
| | | tableLayoutPanel3.RowStyles[2].Height = 0; |
| | | |
| | | // 显示Row2中的控件 |
| | | foreach (Control ctrl in tableLayoutPanel3.Controls) |
| | | { |
| | | int row = tableLayoutPanel3.GetRow(ctrl); |
| | | if (row == 1) |
| | | ctrl.Visible = true; |
| | | else if (row == 2) |
| | | ctrl.Visible = false; |
| | | } |
| | | } |
| | | |
| | | private void ShowRow3() |
| | | { |
| | | // 隐藏Row2(高度设为0) |
| | | tableLayoutPanel3.RowStyles[1].SizeType = SizeType.Absolute; |
| | | tableLayoutPanel3.RowStyles[1].Height = 0; |
| | | |
| | | // 显示Row3(恢复高度) |
| | | tableLayoutPanel3.RowStyles[2].SizeType = SizeType.Absolute; |
| | | tableLayoutPanel3.RowStyles[2].Height = row3OriginalHeight; |
| | | |
| | | // 显示Row3中的控件 |
| | | foreach (Control ctrl in tableLayoutPanel3.Controls) |
| | | { |
| | | int row = tableLayoutPanel3.GetRow(ctrl); |
| | | if (row == 1) |
| | | ctrl.Visible = false; |
| | | else if (row == 2) |
| | | ctrl.Visible = true; |
| | | } |
| | | } |
| | | |
| | | private void dateTimePickerStart_ValueChanged(object sender, EventArgs e) |
| | | { |
| | | dateTimePickerEnd.MinDate = dateTimePickerStart.Value; |
| | | } |
| | | } |
| | | } |