在VBA中,我使用下面的代码来控制Ribbon xml,
Sub paragraphs_style(ByVal control As IRibbonControl)
Select Case control.ID
Case "article_type"
xxxxxx
End Select
end sub
但在c#中,如何表达呢?
你需要使用switch
statement:
switch (control.ID)
{
case "article_type":
// executable code
break;
case "something else":
//
break;
case "A":
case "B":
// here, flow falls through, equivalent to Case "A","B" in VBA
break;
default:
// equivalent to Case Else in VBA.
break;
}