嵌套控件不显示工具提示

发布于 2024-09-13 16:58:37 字数 1253 浏览 1 评论 0原文

我有以下一段代码,除了一个实例外,它在所有实例中都运行良好。

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);
}

我只是从任何文本框重复此过程。不幸的是,我有一个更复杂的控件,我无法让它工作。 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() 不同的点但无济于事。

有想法吗?

I have the following piece of code that works great in all but one instance.

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);
}

I just repeat this process from any textbox. Unfortunately, I have one control that is more complicated and I cannot get this to work. The Event portion looks like this -->

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);
}

What I don't understand is if I replace the tipCharacterCounter portion with, say updating a label, it works fine. It's like the ToolTip is hidden or something but I have tried feeding Show() different points to no avail.

Ideas?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

别忘他 2024-09-20 16:58:37

您使用的是哪个版本的 DXPerience?我已经使用 DXperience 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);
}

Which version of DXPerience are you using? I've tried the following code using DXperience 10.1.5 and it works fine here:

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);
}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文