Changeset 6
- Timestamp:
- Apr 4, 2019, 10:21:48 AM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
Common/Prompt.cs
r1 r6 152 152 }; 153 153 Label textLabel = new Label() { Left = 50, Top = 20, AutoSize = true, Text = text }; 154 Button confirmation = new Button() 155 { 156 Text = "Ok", 157 Left = 350, 158 Width = 100, 159 Top = 70 + dataSize, 160 DialogResult = DialogResult.OK, 161 Anchor = AnchorStyles.Bottom | AnchorStyles.Right 162 }; 163 confirmation.Click += (sender, e) => { prompt.Close(); }; 154 164 ListBox listBox = new ListBox() { Left = 50, Top = 44, Width = 400, Height = dataSize, 155 165 Anchor = AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top | AnchorStyles.Left 156 166 }; 167 listBox.SelectedIndexChanged += (sender, e) => 168 { 169 confirmation.Enabled = listBox.SelectedItems.Count > 0; 170 }; 157 171 listBox.Items.AddRange(states); 158 int itemIndex = listBox.Items.IndexOf(initialValue); 172 confirmation.Enabled = listBox.SelectedItems.Count > 0; 173 listBox.DoubleClick += (sender, e) => { confirmation.PerformClick(); }; 174 int itemIndex = -1; 175 if (initialValue != null) itemIndex = listBox.Items.IndexOf(initialValue); 159 176 if (itemIndex >= 0) 160 177 { … … 165 182 listBox.SelectedIndex = 0; 166 183 } 167 Button confirmation = new Button() { Text = "Ok", Left = 350, Width = 100, Top = 70 + dataSize,168 DialogResult = DialogResult.OK, Anchor = AnchorStyles.Bottom | AnchorStyles.Right };169 confirmation.Click += (sender, e) => { prompt.Close(); };170 listBox.DoubleClick += (sender, e) => { confirmation.PerformClick(); };171 184 172 185 prompt.Controls.Add(listBox);
Note:
See TracChangeset
for help on using the changeset viewer.