如何使用RadioGroup中工作,在RibbonControl DevExpress的WinForms的? [英] How to work with RadioGroup in RibbonControl in WInforms Devexpress?
问题描述
我需要单选按钮上的色带控制,所以我用RadioGroup中,创造活动的SelectedIndexChanged
,我在其中运行的一些任务
私人无效repositoryItemRadioGroup1_SelectedIndexChanged(对象发件人,EventArgs五)
{
RadioGroup中RG =(RadioGroup中)发送;
INT指数= rg.SelectedIndex;
如果(指数== 0)
{
//代码
}
如果(指数== 1)
{
//代码
}
如果(指数== 2)
{
//代码
}
,否则如果(!(指数== 2)||!(指数== 1))
{
//代码
}
}
到现在为止的代码工作fine.in beforeLeaveRow
事件我执行某些计算,但我需要执行基于计算单选按钮选择,所以我需要得到选中的单选按钮,然后执行的基础上,我选择什么样的计算。
例如
私人无效gridView1_BeforeLeaveRow(对象发件人,DevExpress.XtraGrid.Views.Base.RowAllowEventArgs E)
{
十进制= Convert.ToDecimal(TXE_SubTotal.Text );
十进制B = Convert.ToDecimal(TXE_Shipping.Text);
十进制C = Convert.ToDecimal(TXE_Tax.Text);
十进制D = Convert.ToDecimal(TXE_Discount.Text);
如果(RadioGroup.index == 0)
{
总=((A + B + C) - D)的ToString(N2);
}
,否则如果(RadioGroup.index == 1)
{
总=(A + B + C)的ToString(N 2);
}
}
我需要进行这样的计算。帮我完成我的任务。如何获得所选RadioIndex什么??
先谢谢了。
repositoryItemRadioGroup1.Items.AddRange(新RadioGroupItem []
{
新RadioGroupItem(1,项目1),
新RadioGroupItem(2, 项目2)
});
私人无效gridView1_BeforeLeaveRow(对象发件人,DevExpress.XtraGrid.Views.Base.RowAllowEventArgs E)
{
如果(barEditItemRadio.EditValue == NULL)
的回报; //或者做什么
INT的EditValue =(INT)barEditItemRadio.EditValue;
如果(的EditValue == 1)//项目1选择
{
总=((A + B + C) - D)的ToString(N2);
}
,否则如果(的EditValue == 2)// Item2is选择
{
总=(A + B + C)的ToString(N2);
}
}
Hi, I need RadioButton on Ribbon Control so I used RadioGroup and created event selectedIndexChanged
, In which I performed some tasks
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
}
}
Till now the code work fine.in beforeLeaveRow
event I am performing some calculations but I need to perform the calculations based on the Radio Button Selected so I need to get that Selected Radio Button and then perform calculations based on what I selected.
eg
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");
}
}
I need to perform calculations like this. Help me complete my task. How to get Selected RadioIndex or something ??
Thanks in advance.
repositoryItemRadioGroup1.Items.AddRange(new RadioGroupItem[]
{
new RadioGroupItem(1, "Item1"),
new RadioGroupItem(2, "Item2")
});
private void gridView1_BeforeLeaveRow(object sender, DevExpress.XtraGrid.Views.Base.RowAllowEventArgs e)
{
if(barEditItemRadio.EditValue==null)
return;//Or do whatever
int editValue = (int)barEditItemRadio.EditValue;
if(editValue ==1)//Item1 is selected
{
total = ((a + b + c) - d).ToString("n2");
}
else if(editValue ==2)//Item2is selected
{
total = (a + b + c).ToString("n2");
}
}
这篇关于如何使用RadioGroup中工作,在RibbonControl DevExpress的WinForms的?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!