SearchLookUpEdit 得到 Find 和Clear 按钮
由于项目中使用了多语言,SearchLookUpEdit 的Find 和 Clear 也要实现多语言。
为此 废了好大功夫。
首先感谢此网址中给予解决方案的网友http://www.devexpress.com/Support/Center/Question/Details/Q354987。
之前:
步骤1: 拖一个SearchLookUpEdit,编辑View
步骤2: 注册 PopUp事件
代码:
void searchLookUpEdit1_Popup(object sender, EventArgs e) | ||||||||||||||
{ | ||||||||||||||
DevExpress.Utils.Win.IPopupControl control = sender as DevExpress.Utils.Win.IPopupControl; | ||||||||||||||
DevExpress.XtraEditors.Popup.PopupBaseForm Form = control.PopupWindow as DevExpress.XtraEditors.Popup.PopupBaseForm; | ||||||||||||||
LayoutControlItem btFindLCI = GetFindControlLayoutItem(Form, "btFind"); | ||||||||||||||
btFindLCI.Control.Text = "XXOO"; | ||||||||||||||
} |
用到的方法:
LayoutControlItem GetFindControlLayoutItem(PopupBaseForm Form, string strName) | ||||||||||
{ | ||||||||||
if (Form != null) | ||||||||||
{ | ||||||||||
foreach (Control FormC in Form.Controls) | ||||||||||
{ | ||||||||||
if (FormC is SearchEditLookUpPopup) | ||||||||||
{ | ||||||||||
SearchEditLookUpPopup SearchPopup = FormC as SearchEditLookUpPopup; | ||||||||||
foreach (Control SearchPopupC in SearchPopup.Controls) | ||||||||||
{ | ||||||||||
if (SearchPopupC is LayoutControl) | ||||||||||
{ | ||||||||||
LayoutControl FormLayout = SearchPopupC as LayoutControl; | ||||||||||
Control Button = FormLayout.GetControlByName(strName); | ||||||||||
if (Button != null) | ||||||||||
{ | ||||||||||
return FormLayout.GetItemByControl(Button); | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
} | ||||||||||
return null; | ||||||||||
} |
其实这是一种思路。