我从主窗体show出这个子窗体后,要求点击combobox的内容是现实Tooltip。现在的问题是我的子窗体一显示,就显示这个Tooltip,且无法隐藏?? 我子窗体的owner是父窗体?
我子窗体combobox的tooltip代码如下private ToolTip tooltip1 = new ToolTip();
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
e.Graphics.DrawString((this.comboBox1 .Items[e.Index]).ToString(), e.Font, System.Drawing.Brushes.Black, e.Bounds);
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
tooltip1.Show((this.comboBox1.Items[e.Index]).ToString(), this.comboBox1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + e.Bounds.Height);
e.DrawFocusRectangle();
}
} private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
tooltip1.Hide(this);
}请教大侠了!
我子窗体combobox的tooltip代码如下private ToolTip tooltip1 = new ToolTip();
private void comboBox1_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
e.Graphics.DrawString((this.comboBox1 .Items[e.Index]).ToString(), e.Font, System.Drawing.Brushes.Black, e.Bounds);
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected)
{
tooltip1.Show((this.comboBox1.Items[e.Index]).ToString(), this.comboBox1, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + e.Bounds.Height);
e.DrawFocusRectangle();
}
} private void comboBox1_DropDownClosed(object sender, EventArgs e)
{
tooltip1.Hide(this);
}请教大侠了!
private void cmbMeetingHistoy_DrawItem(object sender, DrawItemEventArgs e)
{
e.DrawBackground();
e.Graphics.DrawString(((Meeting)this.cmbMeetingHistoy.Items[e.Index]).MeetingName.ToString(), e.Font, System.Drawing.Brushes.Black, e.Bounds);
if ((e.State & DrawItemState.Selected) == DrawItemState.Selected && this.cmbMeetingHistoy.SelectedIndex != 0)
{
tooltip1.Show(((Meeting)this.cmbMeetingHistoy.Items[e.Index]).MeetingName.ToString(), this.cmbMeetingHistoy, e.Bounds.X + e.Bounds.Width, e.Bounds.Y + e.Bounds.Height);
e.DrawFocusRectangle();
}
} private void cmbMeetingHistoy_DropDownClosed(object sender, EventArgs e)
{
tooltip1.Hide(this.cmbMeetingHistoy);
btnOK.Focus();
}