private int GetSelectionStyle(uint mask, uint effect) { int i; Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT charformat2_STRUCT; charformat2_STRUCT = new Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT(); charformat2_STRUCT.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(charformat2_STRUCT); charformat2_STRUCT.szFaceName = new char[32]; System.IntPtr intPtr1 = new System.IntPtr(1); System.IntPtr intPtr2 = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(charformat2_STRUCT)); System.Runtime.InteropServices.Marshal.StructureToPtr(charformat2_STRUCT, intPtr2, false); Oranikle.Studio.Controls.RichTextBoxEx.SendMessage(Handle, 1082, intPtr1, intPtr2); charformat2_STRUCT = (Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT)System.Runtime.InteropServices.Marshal.PtrToStructure(intPtr2, typeof(Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT)); if ((charformat2_STRUCT.dwMask & mask) == mask) { if ((charformat2_STRUCT.dwEffects & effect) == effect) { i = 1; } else { i = 0; } } else { i = -1; } System.Runtime.InteropServices.Marshal.FreeCoTaskMem(intPtr2); return(i); }
private void SetSelectionStyle(uint mask, uint effect) { Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT charformat2_STRUCT; charformat2_STRUCT = new Oranikle.Studio.Controls.RichTextBoxEx.CHARFORMAT2_STRUCT(); charformat2_STRUCT.cbSize = (uint)System.Runtime.InteropServices.Marshal.SizeOf(charformat2_STRUCT); charformat2_STRUCT.dwMask = mask; charformat2_STRUCT.dwEffects = effect; System.IntPtr intPtr1 = new System.IntPtr(1); System.IntPtr intPtr2 = System.Runtime.InteropServices.Marshal.AllocCoTaskMem(System.Runtime.InteropServices.Marshal.SizeOf(charformat2_STRUCT)); System.Runtime.InteropServices.Marshal.StructureToPtr(charformat2_STRUCT, intPtr2, false); Oranikle.Studio.Controls.RichTextBoxEx.SendMessage(Handle, 1092, intPtr1, intPtr2); System.Runtime.InteropServices.Marshal.FreeCoTaskMem(intPtr2); }