public RenameBox(TabControl MainTabs) { this.MainTabs = MainTabs; int TabNum = MainTabs.SelectedIndex; Rectangle rect = MainTabs.GetTabRect(TabNum); Point point = MainTabs.Location; rect = MainTabs.RectangleToScreen(rect); rect = MainTabs.Parent.RectangleToClient(rect); RenameBox renameBox = this; MainTabs.GetControl(TabNum).Controls.Add(renameBox); MainTabs.Parent.Controls.Add(renameBox); renameBox.TextAlign = HorizontalAlignment.Center; renameBox.Font = MainTabs.GetControl(TabNum).Font; renameBox.SetBounds(rect.X, rect.Y, rect.Width, rect.Height); renameBox.Text = MainTabs.Controls[TabNum].Text; renameBox.BringToFront(); renameBox.KeyPress += OnKeyPress; renameBox.LostFocus += OnLostFocus; renameBox.Focus(); renameBox.Show(); }
public void ChangeSelectedProperty(int SubItemIndex) { var Indices = PlaylistView.SelectedIndices; if (Indices.Count == 0) { return; } var ItemIndex = GetFocusedItem(); //new RenameBox(PlaylistView, SubItemIndex); if (ItemIndex < PlaylistView.Items.Count) { var Item = PlaylistView.Items[ItemIndex]; if (Item.SubItems.Count == 0) { return; } if (SubItemIndex == 0) { Item.BeginEdit(); } else if (SubItemIndex < Item.SubItems.Count) { var renameBox = new RenameBox(PlaylistView, SubItemIndex); renameBox?.Focus(); } } }
/// <summary> /// On renaming action TextBox appears in exact place of original playlist name. /// </summary> private void RenameTab() { renameBox = new RenameBox(MainTabs); }