在用友金蝶等財務軟件中,經常需要輸入貨幣類型的數據, 那麼這種輸入框要如何制作呢?
擴展DataGridView 的功能 出自在天空飛翔博客 http://www.cnblogs.com/michaelhuwei/archive/2010/07/07/1772965.html
如果要使用DEV控件XtraGrid實現同樣的效果
需要實現 GridView兩個事件,CustomDrawCell和CustomDrawFooterCell
效果如下
實現代碼如下
繪制單元格貨幣格式線條
P_WIDTH = fe = formatStr = (e.Column.FieldName == (e.Column.ColumnEdit != = (e.Column.ColumnEdit.DisplayFormat = formatStr.Substring(formatStr.IndexOf() + = (e.Column.DisplayFormat = formatStr.Substring(formatStr.IndexOf() + ( i = ; i < (e.Bounds.Width / ) - fe; i++ (i % == + i * P_WIDTH, + i *+ i * P_WIDTH, + i *+ ((e.Bounds.Width / ) - fe) * P_WIDTH, , e.Bounds.Left + ((e.Bounds.Width / ) - fe) * (fe > ( j = ; j < fe - ; j+++ ((e.Bounds.Width / ) - fe++j) * P_WIDTH, , e.Bounds.Left + ((e.Bounds.Width / ) - fe++j) * sf = == v = s_int = (( s_dec = formatStr.ToString().Substring(formatStr.ToString().IndexOf()+ s_value = s_int + ( i = ; i < s_value.Length; i++ ch = s_value[s_value.Length - i - x = e.Bounds.Left + ((e.Bounds.Width / ) - i - ) * y = rect = =
gridView1_CustomDrawCell(
繪制匯總貨幣格式線條
P_WIDTH = fe = formatStr = (e.Column.FieldName == (e.Column.ColumnEdit != = (e.Column.ColumnEdit.DisplayFormat = formatStr.Substring(formatStr.IndexOf() + = (e.Column.DisplayFormat = formatStr.Substring(formatStr.IndexOf() + ( i = ; i < (e.Bounds.Width / ) - fe; i++ (i % == + i * P_WIDTH, + i *+ i * P_WIDTH, + i *+ ((e.Bounds.Width / ) - fe) * P_WIDTH, , e.Bounds.Left + ((e.Bounds.Width / ) - fe) * (fe > ( j = ; j < fe - ; j+++ ((e.Bounds.Width / ) - fe + + j) * P_WIDTH, , e.Bounds.Left + ((e.Bounds.Width / ) - fe + + j) * sf = == v = s_int = (( s_dec = formatStr.ToString().Substring(formatStr.ToString().IndexOf() + s_value = s_int + ( i = ; i < s_value.Length; i++ ch = s_value[s_value.Length - i - x = e.Bounds.Left + ((e.Bounds.Width / ) - i - ) * y = rect = =
gridView1_CustomDrawFooterCell(