| | |
| | | using DPumpHydr.WinFrmUI.RLT.Child.Crown; |
| | | using DPumpHydr.WinFrmUI.RLT.Controls; |
| | | using DPumpHydr.WinFrmUI.RLT.Docking.Crown; |
| | | using System.Drawing; |
| | | using System.Windows.Forms; |
| | | |
| | | namespace DPumpHydr.WinFrmUI.Volute |
| | | { |
| | | public partial class LayersDockPanel : CrownToolWindow |
| | | { |
| | | #region Constructor Region |
| | | |
| | | public LayersDockPanel() |
| | | { |
| | | InitializeComponent(); |
| | | this.SerializationKey = "LayersDockPanel"; |
| | | // Build dummy list data |
| | | //for (int i = 0; i < 100; i++) |
| | | //{ |
| | | // CrownListItem item = new($"List item #{i}") |
| | | // { |
| | | // Icon = DPumpHydr.WinFrmUI.Volute.Properties.Resources.application_16x |
| | | // }; |
| | | // lstLayers.Items.Add(item); |
| | | //} |
| | | |
| | | //// Build dropdown list data |
| | | //for (int i = 0; i < 5; i++) |
| | | //{ |
| | | // cmbList.Items.Add(new CrownDropDownItem($"Dropdown item #{i}")); |
| | | //} |
| | | visible.Image = imagevisible; |
| | | Color AcquiesceColor = ColorTranslator.FromHtml("#a7ebcc"); |
| | | Color.Image = Drawicon(AcquiesceColor); |
| | | GridViewLayers.Rows.Add(); |
| | | GridViewLayers.Rows.Add(); |
| | | GridViewLayers.Rows.Add(); |
| | | GridViewLayers.Rows[0].Cells["layer"].Value = "图层图层图层图层"; |
| | | GridViewLayers.Rows[1].Cells["layer"].Value = "图层2"; |
| | | GridViewLayers.Rows[2].Cells["layer"].Value = "图层3"; |
| | | } |
| | | |
| | | #endregion |
| | | private Bitmap Drawicon(Color color) |
| | | { |
| | | Bitmap colorImage = new Bitmap(20, 20); |
| | | using (Graphics g = Graphics.FromImage(colorImage)) |
| | | { |
| | | Color myColor = color; |
| | | g.Clear(myColor); |
| | | } |
| | | return colorImage; |
| | | } |
| | | private Image imageHidden = GlobalResource.BuildImage("Generic-Hidden.png", 20, 20); |
| | | private Image imagevisible = GlobalResource.BuildImage("Generic-Visible.png", 20, 20); |
| | | private void GridViewLayers_CellContentClick(object sender, System.Windows.Forms.DataGridViewCellEventArgs e) |
| | | { |
| | | if (e.ColumnIndex == 0) |
| | | { |
| | | if (colorDialog1.ShowDialog() == DialogResult.OK) |
| | | { |
| | | GridViewLayers.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = Drawicon(colorDialog1.Color); |
| | | } |
| | | |
| | | } |
| | | if (e.ColumnIndex == 2) |
| | | { |
| | | if (GridViewLayers.Rows[e.RowIndex].Cells[e.ColumnIndex].Value == imageHidden) |
| | | { |
| | | GridViewLayers.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = imagevisible; |
| | | return; |
| | | } |
| | | else |
| | | { |
| | | GridViewLayers.Rows[e.RowIndex].Cells[e.ColumnIndex].Value = imageHidden; |
| | | return; |
| | | } |
| | | |
| | | } |
| | | } |
| | | } |
| | | } |