ToggleStyle Method |
[Top] [Chapter] [Previous] [Next] |
Applies to Declaration procedure ToggleStyle(Element: Integer); Description This method changes a certain character attribute flag from unset to set and vice versa. You can use it in the event OnKeyPress to implement a hotkey to enable/disable a certain mode, such as 'bold text'. VB6:
C#: private void WPDLLInt1_KeyPress(object sender, System.Windows.Forms.KeyPressEventArgs e) { IWPMemo Memo; if (((WPDynamic.wpKeyPressEventArgs)e).Editor==2 ) Memo = WPDLLInt1.Memo2; else Memo = WPDLLInt1.Memo; if (e.KeyChar==(Char)2) // Ctrl+B to toggle "Bold" { if (Memo.TextCursor.IsSelected) Memo.CurrSelAttr.ToggleStyle((int)WPWRT.BOLD); else Memo.CurrSelAttr.ToggleStyle((int)WPWRT.BOLD); } }
Category |