嗨,我需要色帶控制單選按鈕,所以我用RadioGroup中和創建的事件selectedIndexChanged
,在我執行的一些任務如何在WInforms Devexpress的RibbonControl中使用RadioGroup?
private void repositoryItemRadioGroup1_SelectedIndexChanged(object sender, EventArgs e)
{
RadioGroup rg = (RadioGroup)sender;
int index = rg.SelectedIndex;
if (index == 0)
{
// code
}
if (index == 1)
{
// code
}
if (index == 2)
{
// code
}
else if (!(index == 2) || !(index == 1))
{
// code
}
}
截至目前的代碼工作fine.in beforeLeaveRow
事件我進行一些計算,但我需要基於選定的單選按鈕執行計算,因此我需要獲得選定的單選按鈕,然後根據我選擇的內容執行計算。
如
private void gridView1_BeforeLeaveRow(object sender, DevExpress.XtraGrid.Views.Base.RowAllowEventArgs e)
{
decimal a = Convert.ToDecimal(TXE_SubTotal.Text);
decimal b = Convert.ToDecimal(TXE_Shipping.Text);
decimal c = Convert.ToDecimal(TXE_Tax.Text);
decimal d = Convert.ToDecimal(TXE_Discount.Text);
if(RadioGroup.index==0)
{
total = ((a + b + c) - d).ToString("n2");
}
else if(RadioGroup.index==1)
{
total = (a + b + c).ToString("n2");
}
}
我需要執行這樣的計算。幫助我完成我的任務。如何獲得選定的RadioIndex或什麼?
在此先感謝。
告訴你如何填充'RadioGroup',答案取決於 –