示例#1
0
        /// <summary>
        /// Clears all displayed hints
        /// </summary>
        public void Clear()
        {
            items.Clear();
            if (tb.Controls.Count != 0)
            {
                var toDelete = new List <Control>();
                foreach (Control item in tb.Controls)
                {
                    if (item is UnfocusablePanel)
                    {
                        toDelete.Add(item);
                    }
                }

                foreach (var item in toDelete)
                {
                    tb.Controls.Remove(item);
                }

                for (int i = 0; i < tb.LineInfos.Count; i++)
                {
                    var li = tb.LineInfos[i];
                    li.bottomPadding = 0;
                    tb.LineInfos[i]  = li;
                }

                tb.NeedRecalc();
                tb.Invalidate();
                tb.Select();
                tb.ActiveControl = null;
            }
        }
示例#2
0
文件: Hints.cs 项目: WendyH/HMSEditor
        void OnTextBoxVisibleRangeChanged(object sender, EventArgs e)
        {
            if (items.Count == 0)
            {
                return;
            }

            tb.NeedRecalc(true);
            foreach (var item in items)
            {
                LayoutHint(item);
                item.HostPanel.Invalidate();
            }
        }
示例#3
0
        public void Set(int lineIndex, string name)
        {
            bool exist = false; string namel = name.ToLower();

            foreach (var b in this)
            {
                if (b.Name.ToLower() == namel)
                {
                    b.LineIndex = lineIndex; exist = true; break;
                }
            }
            if (!exist)
            {
                Add(new Bookmark(tb, name, lineIndex));
            }
            tb.NeedRecalc(true);             // By WendyH
            tb.Invalidate();
        }
示例#4
0
        /// <summary>
        /// Add and shows the hint
        /// </summary>
        /// <param name="hint"></param>
        public void Add(Hint hint)
        {
            items.Add(hint);

            if (hint.Inline /* || hint.Range.Start.iLine >= tb.LinesCount - 1*/)
            {
                var li = tb.LineInfos[hint.Range.Start.iLine];
                hint.TopPadding   = li.bottomPadding;
                li.bottomPadding += hint.HostPanel.Height;
                tb.LineInfos[hint.Range.Start.iLine] = li;
                tb.NeedRecalc(true);
            }

            LayoutHint(hint);

            tb.OnVisibleRangeChanged();

            hint.HostPanel.Parent = tb;

            tb.Select();
            tb.ActiveControl = null;
            tb.Invalidate();
        }