Exemple #1
0
        private int GetSelectionStyle(uint mask, uint effect)
        {
            RichTextBoxEx.CHARFORMAT2_STRUCT cHARFORMAT2_STRUCT = default(RichTextBoxEx.CHARFORMAT2_STRUCT);
            cHARFORMAT2_STRUCT.cbSize     = (uint)Marshal.SizeOf(cHARFORMAT2_STRUCT);
            cHARFORMAT2_STRUCT.szFaceName = new char[32];
            IntPtr wParam = new IntPtr(1);
            IntPtr intPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(cHARFORMAT2_STRUCT));

            Marshal.StructureToPtr(cHARFORMAT2_STRUCT, intPtr, false);
            RichTextBoxEx.SendMessage(base.Handle, 1082, wParam, intPtr);
            cHARFORMAT2_STRUCT = (RichTextBoxEx.CHARFORMAT2_STRUCT)Marshal.PtrToStructure(intPtr, typeof(RichTextBoxEx.CHARFORMAT2_STRUCT));
            int result;

            if ((cHARFORMAT2_STRUCT.dwMask & mask) == mask)
            {
                if ((cHARFORMAT2_STRUCT.dwEffects & effect) == effect)
                {
                    result = 1;
                }
                else
                {
                    result = 0;
                }
            }
            else
            {
                result = -1;
            }
            Marshal.FreeCoTaskMem(intPtr);
            return(result);
        }
Exemple #2
0
        private void SetSelectionStyle(uint mask, uint effect)
        {
            RichTextBoxEx.CHARFORMAT2_STRUCT cHARFORMAT2_STRUCT = default(RichTextBoxEx.CHARFORMAT2_STRUCT);
            cHARFORMAT2_STRUCT.cbSize    = (uint)Marshal.SizeOf(cHARFORMAT2_STRUCT);
            cHARFORMAT2_STRUCT.dwMask    = mask;
            cHARFORMAT2_STRUCT.dwEffects = effect;
            IntPtr wParam = new IntPtr(1);
            IntPtr intPtr = Marshal.AllocCoTaskMem(Marshal.SizeOf(cHARFORMAT2_STRUCT));

            Marshal.StructureToPtr(cHARFORMAT2_STRUCT, intPtr, false);
            RichTextBoxEx.SendMessage(base.Handle, 1092, wParam, intPtr);
            Marshal.FreeCoTaskMem(intPtr);
        }
Exemple #3
0
 protected override void WndProc(ref Message m)
 {
     base.WndProc(ref m);
     RichTextBoxEx.HideCaret(base.Handle);
 }