private void btnAccept_Click(object sender, EventArgs e) { if (string.IsNullOrWhiteSpace(txtName.Text) || (cbSort.SelectedItem == null && cbType.SelectedIndex != 1) || cbType.SelectedItem == null) { MessageBox.Show("You must fill all fields to create a new charSet"); return; } if (cbType.SelectedIndex == 0 && !(nudWidth.Value == 1 && nudHeight.Value == 1) && !(nudWidth.Value == 1 && nudHeight.Value == 2) && !(nudWidth.Value == 2 && nudHeight.Value == 2)) { MessageBox.Show("Invalid sprite size, only 1x1, 1x2 and 2x2 sizes are acceptable"); return; } CharSetName = txtName.Text; CharWidth = (int)nudWidth.Value; CharHeight = (int)nudHeight.Value; CharSetType = (CharSetType)cbType.SelectedIndex; CharSetSort = (CharSetSort)cbSort.SelectedIndex; DialogResult = DialogResult.OK; Close(); }
public CharSetEditor(string CharSetName, int CharWidth, int CharHeight, CharSetSort CharSetSort, CharSetType CharSetType) { ConfigureForm(); this.CharWidth = CharWidth; this.CharHeight = CharHeight; this.CharSetSort = CharSetSort; this.CharSetName = CharSetName; this.CharSetType = CharSetType; this.CharSetId = Guid.NewGuid(); SetText(); GenerateEditors(); }
private void SetText() { this.Text = $"{CharSetType.ToString()} {CharSetName}, {CharWidth}x{CharHeight} chars, sorted {CharSetSort.ToString()}"; }