Пример #1
0
        public static CHARFORMAT2W Create()
        {
            CHARFORMAT2W s = new CHARFORMAT2W();

            s.cbSize = Marshal.SizeOf(typeof(CHARFORMAT2W));
            return(s);
        }
Пример #2
0
        public void SelectedTextToLink(bool hyperlink)
        {
            Win32.CHARFORMAT2W format = Win32.CHARFORMAT2W.Create();

            format.dwMask    = Constants.Win32.CFM_LINK;
            format.dwEffects = (hyperlink ? Constants.Win32.CFE_LINK : 0);

            IntPtr result = UnsafeNativeMethods.SendMessage(new HandleRef(this, Handle),
                                                            Constants.Win32.Messages.EM_SETCHARFORMAT, (IntPtr)Constants.Win32.SCF_SELECTION, ref format);

            if (result == (IntPtr)0)
            {
                throw new Win32Exception();
            }
        }