awilderbeast
asked on
c# how to put this code into a function...
hi all, i want to put the below code into a function but dont know how to
the cmd will change everytime as will the state.EditValue
is what im after possible?
Thanks
the cmd will change everytime as will the state.EditValue
is what im after possible?
Thanks
ToggleFontBoldCommand cmd = new ToggleFontBoldCommand(CurrentEditor);
ICommandUIState state = cmd.CreateDefaultCommandUIState();
cmd.UpdateUIState(state);
if (!state.Enabled && CurrentEditor.ReadOnly) state.Enabled = true;
state.EditValue = FontStyle.Bold;
cmd.ForceExecute(state);
ASKER
the toggle command will change each time i want to use it though
what im tryign to do is turn 8 lines of code into 1
so i do:-
(type i dont know) action = functioname(togglefontital iccommand, fonstyle.italic);
action.forceexecute();
something like the above if you understand what im trying to to?
what im tryign to do is turn 8 lines of code into 1
so i do:-
(type i dont know) action = functioname(togglefontital
action.forceexecute();
something like the above if you understand what im trying to to?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
brilliant, thankyou!
Open in new window
-Kusala