的SelectedItemIndex这里的情景:对齐工具提示智能感知
我工作的一个代码编辑器(的WinForms),我用一个RichTextBox
和组件作为智能感知。
当按下 “”在RichTextBox
中,智能感知将出现并且其内部的每个对象都有不同的工具提示。
是这样的:
http://oi44.tinypic.com/2lbzu1.jpg
工具提示位置是按照SelectedIndex
我想出了这个代码:当智能感知项目达到12以上(需注意,
public void SetToolTip(Intellisense intellisenseitem)
{
if (selectedItemIndex == 0)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex, 3000);
}
if (selectedItemIndex == 1)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 15, 3000);
}
if (selectedItemIndex == 2)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 30, 3000);
}
if (selectedItemIndex == 3)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 45, 3000);
}
if (selectedItemIndex == 4)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 60, 3000);
}
if (selectedItemIndex == 5)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 75, 3000);
}
if (selectedItemIndex == 6)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 90, 3000);
}
if (selectedItemIndex == 7)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 105, 3000);
}
if (selectedItemIndex == 8)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 120, 3000);
}
if (selectedItemIndex == 9)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 135, 3000);
}
if (selectedItemIndex == 10)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 150, 3000);
}
if (selectedItemIndex == 11)
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 165, 3000);
}
if (selectedItemIndex >= 12) //still needed to fix
{
toolTip.ToolTipTitle = title;
toolTip.Show(text, this, Width + 3, SelectedItemIndex + 165, 3000);
}
}
问题智能感知有一个过滤器,过滤文本(startswith
),其一直类型Richtextbox
像智能感知在Visual Studio) ,它会自动有一个滚动(因为它达到其最大尺寸)01现在,问题是,当使用滚动 工具提示将不会跟随其Selecteditemindex现在。
控制智能感知就像一个列表框。(因为我前面提到的,我使用的组件)
现在我的问题是如何让工具提示始终遵循的智能感知的SelectedItemIndex
。
任何建议,先生,我该怎么办了滚动的解决方案吗? – Elegiac
+1先生,如果你能帮助我如何解决这个问题的滚动生病接受这个答案 – Elegiac
看到我的编辑您的解决方案。 – Jegan