示例#1
0
        private void ListBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            if (this.listBox.SelectedItem != null)
            {
                BaseDefinition def = (this.listBox.SelectedItem as BaseDefinition);

                string doc    = string.IsNullOrEmpty(def.docstring) ? "No documentation" : def.docstring;
                string module = string.IsNullOrEmpty(def.module_name) ? "" : "module: " + def.module_name + "\r\n";
                string type   = string.IsNullOrEmpty(def.type) ? "" : def.type + " ";
                string parm   = def.parameters != null ? "(" + string.Join(", ", def.parameters) + ")" : "";
                string title  = type + def.name + parm;
                if (ToolTip == null)
                {
                    //ToolTip.Hide(this);
                    //ToolTip.Dispose();
                    this.ToolTip = new ToolTip();
                }
                //ToolTip = new ToolTip();
                if (!ToolTip.Equals(ToolTip.Tag))
                {
                    ToolTip.ShowAlways   = true;
                    ToolTip.ToolTipTitle = title;
                    Point p = this.Scintilla.PointToClient(new Point(this.Right + 2, this.Top + 2));
                    ToolTip.Tag = this.listBox.SelectedItem;
                    ToolTip.Show(module + doc, this.Scintilla, p);
                }
            }
            else if (this.ToolTip != null)
            {
                this.ToolTip.Dispose();
                this.ToolTip = null;
            }
        }