2010-08-12 33 views
1

我有以下一段代碼,除了一個實例外,它們都很棒。工具提示沒有顯示嵌套控件

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

您正在使用哪個版本的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); 
} 
+0

10.1.4我正在使用Windows ToolTip而不是DevEx。不知道爲什麼,但它與DevEx的正常工作。謝謝。 – 2010-08-12 21:57:59