コード例 #1
0
ファイル: RenameBox.cs プロジェクト: Dekryptor/KittenPlayer
        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();
        }
コード例 #2
0
        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();
                }
            }
        }
コード例 #3
0
        /// <summary>
        /// On renaming action TextBox appears in exact place of original playlist name.
        /// </summary>

        private void RenameTab()
        {
            renameBox = new RenameBox(MainTabs);
        }