示例#1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void _ItemTextNameEdit_KeyPress(object sender, KeyPressEventArgs e)
        {
            if (e.KeyChar == (char)13)
            {
                //终于把焦点问题给去掉了,擦
                this.Parent.Focus();

                //如果没有输入任何字符串
                if (this._ItemTextNameEdit.Text.Trim() == "")
                {
                    this._ItemTextNameEdit.Focus();
                    return;
                }

                //标志一下是SideBarPanelItem的text改变事件
                this._SideBarPanelItemTextChange = false;

                //改为新的Text
                this._ButtonItemEx.Text = this._ItemTextNameEdit.Text;

                //隐藏掉text
                this._ItemTextNameEdit.Hide();

                //最后加入修改处理
                ItemSubInfo isi = _ButtonItemEx.Tag as ItemSubInfo;

                //保存一下
                isi.Name = this._ItemTextNameEdit.Text;

                //处理过了
                e.Handled = true;
            }
        }
示例#2
0
        /// <summary>
        /// 开启编辑选项
        /// </summary>
        /// <param name="bie"></param>
        public void BeginItemTextEdit(ButtonItemEx bie)
        {
            Rectangle   rect             = bie.GetTextDrawRect();
            Rectangle   DisplayRectangle = bie.DisplayRectangle;
            ItemSubInfo isi = bie.Tag as ItemSubInfo;

            //保存一下当前修改的bie
            _ButtonItemEx = bie;

            //填充相关信息
            this._ItemTextNameEdit.Clear();

            //这里判断下panel的显示模式
            if (this.ExpandedPanel.LayoutType == eSideBarLayoutType.Default)
            {
                //这里在判断下是小图标还是大图标
                if (this.ExpandedPanel.ItemImageSize == eBarImageSize.Default)
                {
                    this._ItemTextNameEdit.Location = new Point(rect.Location.X, DisplayRectangle.Bottom - rect.Height);
                }
                else if (this.ExpandedPanel.ItemImageSize == eBarImageSize.Medium)
                {
                    this._ItemTextNameEdit.Location = new Point(rect.Location.X, DisplayRectangle.Bottom - rect.Height);
                }
            }
            else if (this.ExpandedPanel.LayoutType == eSideBarLayoutType.MultiColumn)
            {
                //这里在判断下是小图标还是大图标
                if (this.ExpandedPanel.ItemImageSize == eBarImageSize.Default)
                {
                    this._ItemTextNameEdit.Location = new Point(rect.Left + DisplayRectangle.Location.X, DisplayRectangle.Location.Y + rect.Height / 2 - 8);
                }
                else if (this.ExpandedPanel.ItemImageSize == eBarImageSize.Medium)
                {
                    this._ItemTextNameEdit.Location = new Point(rect.Left + DisplayRectangle.Location.X, DisplayRectangle.Bottom - rect.Height);
                }
            }

            //大小
            this._ItemTextNameEdit.Size = rect.Size;

            //显示配置中的名称
            this._ItemTextNameEdit.Text = isi.Name;

            //选中
            this._ItemTextNameEdit.SelectionStart  = 0;
            this._ItemTextNameEdit.SelectionLength = this._ItemTextNameEdit.TextLength;
            this._ItemTextNameEdit.SelectAll();
            this._ItemTextNameEdit.ScrollToCaret();

            //显现
            this._ItemTextNameEdit.Show();

            //设置焦点
            this._ItemTextNameEdit.Focus();

            //添加到最前面
            this.Controls.SetChildIndex(this._ItemTextNameEdit, 0);
        }
示例#3
0
        /// <summary>
        /// 重写MouseClick,主要是实现隐藏掉文本框
        /// </summary>
        /// <param name="e"></param>
        protected override void OnMouseClick(MouseEventArgs e)
        {
            //隐藏
            if (this._NameEdit.Visible)
            {
                //如果没有输入任何字符串
                if (this._NameEdit.Text.Trim() == "")
                {
                    this._NameEdit.Focus();
                    return;
                }

                //还有一种情况就是该分组已经存在了
                if (this._NameEdit.Modified && this.Panels.Contains(this._NameEdit.Text))
                {
                    this._NameEdit.Focus();
                    return;
                }

                //如果有输入的话,则隐藏
                this._NameEdit.Hide();

                //显示修改后的
                this._SideBarPanelItem.Text = this._NameEdit.Text;
            }

            //隐藏
            if (this._ItemTextNameEdit.Visible)
            {
                //如果没有输入任何字符串
                if (this._ItemTextNameEdit.Text.Trim() == "")
                {
                    this._ItemTextNameEdit.Focus();
                    return;
                }

                //这里确定下_ItemTextNameEdit是否已经修改
                if (_ItemTextNameEdit.Modified)
                {
                    //改为新的名称
                    this._ButtonItemEx.Text = this._ItemTextNameEdit.Text;

                    //最后加入修改处理
                    ItemSubInfo isi = _ButtonItemEx.Tag as ItemSubInfo;

                    //保存一下
                    isi.Name = this._ItemTextNameEdit.Text;
                }

                //隐藏掉text
                this._ItemTextNameEdit.Hide();
            }

            //终于把焦点问题给去掉了,擦
            this.Parent.Focus();

            base.OnMouseClick(e);
        }
示例#4
0
文件: ItemSub.cs 项目: hklang/JJStart
        /// <summary>
        /// 从栏目中删除一个文件
        /// </summary>
        /// <param name="file">文件对象</param>
        /// <param name="whotkey">热键管理</param>
        public void DeleteSubItem(ItemSubInfo file, WinHotKey whotkey)
        {
            //在删除的同时注销掉热键
            if (file.HotKey != null)
            {
                whotkey.UnSetHotKey(file.HotKey);
            }

            this.SubItems.Remove(file);
        }
示例#5
0
文件: ItemSub.cs 项目: hklang/JJStart
        /// <summary>
        /// 向栏目中添加一个文件
        /// </summary>
        /// <param name="file">文件对象</param>
        /// <param name="whotkey">热键管理</param>
        public void AddSubItem(ItemSubInfo file, WinHotKey whotkey)
        {
            //在添加的同时注册热键,主要作用于复制
            if (file.HotKey != null)
            {
                whotkey.SetHotKey(file.HotKey);
            }

            this.SubItems.Add(file);
        }
示例#6
0
        public SetHotKeyForm(ItemSubInfo f, WinHotKey w)
        {
            InitializeComponent();

            //相等
            this.fi      = f;
            this.wHotKey = w;

            //设置语言
            lang.SetLanguage(this);
        }