private void cbNewRtp_KeyPress(object sender, KeyPressEventArgs e) { if (e.KeyChar == 13) { Rtp rtp; try { rtp = Rtp.FromString(cbNewRtp.Text, lbColor.BackColor); if (!new System.IO.DirectoryInfo(rtp.Path).Exists) { return; } cbNewRtp.Text = ""; EditingRtps.Add(rtp); RtpList.Items.Add(rtp); RtpList.Color.ActualValue.Add(rtp.Color); RtpList.SelectedIndex = RtpList.Items.Count - 1; RtpList.Focus(); } catch { return; } } else if (e.KeyChar == 26) { cbNewRtp.Text = ""; lbColor.BackColor = Color.Gray; } }
private void RTPEditor_Shown(object sender, EventArgs e) { EditingRtps = RtpManager.Rtp; LoadRtps(); if (EditingRtps.Count > 0) { RtpList.SelectedIndex = 0; RtpList.Focus(); } Refresh(); }