怎么添加devexpress.xtragrid.views.grid.rowclick

怎么添加devexpress.xtragrid.views.grid.rowclick,第1张

1,增加新行用InitNewRow事件,给新行某字段赋值。后结束编辑。

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)

}

}


欢迎分享,转载请注明来源:内存溢出

原文地址: http://outofmemory.cn/bake/7937695.html

(0)
打赏 微信扫一扫 微信扫一扫 支付宝扫一扫 支付宝扫一扫
上一篇 2023-04-11
下一篇 2023-04-11

发表评论

登录后才能评论

评论列表(0条)

保存