private void grdView_InitNewRow(object sender, DevExpress.XtraGrid.Views.Grid.InitNewRowEventArgs e)
{
DevExpress.XtraGrid.Views.Grid.GridView view = sender as DevExpress.XtraGrid.Views.Grid.GridView
view.SetRowCellValue(e.RowHandle, view.Columns["EnterID"], this.dS_MEnterStoreView.MEnterStore[0].ID)
this.grdControl.EmbeddedNavigator.Buttons.EndEdit.DoClick()
this.grdView.UpdateCurrentRow()
}
2,如果进行行验证,就在换行时时行,用grdView_FocusedRowChanged事件。
private void grdView_FocusedRowChanged(object sender, DevExpress.XtraGrid.Views.Base.FocusedRowChangedEventArgs e)
{
WsClient.WS_MEnterStore.DS_MEnterStoreView.MEnterDetailRow row = (WsClient.WS_MEnterStore.DS_MEnterStoreView.MEnterDetailRow)this.grdView.GetDataRow(e.FocusedRowHandle)
if (row != null)
{
if ((this.OperState == Common.Enum.TOperState.UnConfirmNew)
|| (this.OperState == Common.Enum.TOperState.UnConfirmEdit))
{
this.InitComboBoxValue(row, row.IsGoodIDNull()?0:row.GoodID, false)
this.InitBatchComboBoxValue(row, row.IsGoodIDNull()?0:row.GoodID, false)
}
}
}
3,如果需要改变行的某一列的同时改变其它的列用grdView_CellValueChanged事件。
private void grdView_CellValueChanged(object sender, DevExpress.XtraGrid.Views.Base.CellValueChangedEventArgs e)
{
if (this.grdView.FocusedColumn == e.Column)
{
if (e.Column == this.colAmount)
{
}
}
}
4,如果需在离开行的时候需要验证,则用grdView_BeforeLeaveRow事件。
public partial class FormDevMenu:DevExpress.XtraEditors.XtraForm{
public FormDevMenu()
{
InitializeComponent()
}
private void FormDevMenu_Load(object sender,EventArgs e)
{
foreach(DevExpress.Skins.SkinContainer skin in DevExpress.Skins.SkinManager.Default.Skins)
{
var item = 皮肤ToolStripMenuItem.DropDownItems.Add(skin.SkinName)
item.Click += new EventHandler(item_Click)
}
}
void item_Click(object sender,EventArgs e)
{
new DevExpress.LookAndFeel.DefaultLookAndFeel().LookAndFeel.SetSkinStyle((sender as ToolStripMenuItem).Text)
}
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)