예제 #1
0
파일: Structs.cs 프로젝트: formist/LinkMe
        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();
            }
        }