工具提示未显示嵌套控件

时间:2010-08-12 13:11:04

标签: c# .net winforms tooltip devexpress

我有以下代码,除了一个实例外,它们都很有用。

private void tbxLastName_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
    GetRemainingChars(sender);
}

public void GetRemainingChars(object sender)
{
    var control = sender as TextEdit;
    var maxChars = control.Properties.MaxLength;
    tipCharacterCounter.Show(control.Text.Length + "/" + maxChars, this, control.Location.X, control.Location.Y - control.Height);
}

我只是从任何textbox重复此过程。不幸的是,我有一个更复杂的控件,我不能让它工作。 Event部分如下所示 - >

private void memDirectionsToAddress_Popup(object sender, EventArgs e)
{
    MemoExPopupForm popupForm = (sender as DevExpress.Utils.Win.IPopupControl).PopupWindow as MemoExPopupForm;
    MemoEdit meDirections = popupForm.Controls[2] as MemoEdit;
    meDirections.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(meDirections_EditValueChanging);
}

void meDirections_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e)
{
    GetRemainingChars(sender);
}

我不明白的是,如果我更换tipCharacterCounter部分,比如更新标签,它可以正常工作。这就像工具提示是隐藏的或者其他东西,但我尝试过喂Show()个不同点无济于事。

想法?

1 个答案:

答案 0 :(得分:1)

您使用的是哪个版本的EXPerience?我使用EXperience 10.1.5尝试了以下代码,它在这里工作正常:

private void memoExEdit1_Popup(object sender, EventArgs e) {
    MemoExPopupForm popupForm = (sender as DevExpress.Utils.Win.IPopupControl).PopupWindow as MemoExPopupForm;
    MemoEdit meDirections = popupForm.Controls[2] as MemoEdit;
    meDirections.EditValueChanging += new DevExpress.XtraEditors.Controls.ChangingEventHandler(meDirections_EditValueChanging);
}

void meDirections_EditValueChanging(object sender, DevExpress.XtraEditors.Controls.ChangingEventArgs e) {
    GetRemainingChars(sender);
}

public void GetRemainingChars(object sender) {
    TextEdit control = sender as TextEdit;
    int maxChars = control.Properties.MaxLength;
    tipCharacterCounter.ShowHint(control.Text.Length + "/" + maxChars, control, ToolTipLocation.RightBottom);
}