Ejemplo n.º 1
0
		private void SpellChecker_MisspelledWord(object sender, NetSpell.SpellChecker.SpellingEventArgs args)
		{
			TraceWriter.TraceVerbose("Misspelled Word:{0}", args.Word);
			
			int selectionStart = base.SelectionStart;
			int selectionLength = base.SelectionLength;

			base.Select(args.TextIndex, args.Word.Length);

			NativeMethods.CHARFORMAT2 cf = new NativeMethods.CHARFORMAT2();
			cf.cbSize = Marshal.SizeOf(cf);
			cf.dwMask = NativeMethods.CFM_UNDERLINETYPE;
			cf.bUnderlineType = (byte)this.MisspelledStyle; 
			cf.bUnderlineType |= (byte)this.MisspelledColor; 
			
			int result = NativeMethods.SendMessage(base.Handle, 
				NativeMethods.EM_SETCHARFORMAT, 
				NativeMethods.SCF_SELECTION | NativeMethods.SCF_WORD, 
				ref cf);

			base.Select(selectionStart, selectionLength);
		}
Ejemplo n.º 2
0
		private NativeMethods.CHARFORMAT2 GetCharFormat()
		{
			NativeMethods.CHARFORMAT2 cf = new NativeMethods.CHARFORMAT2();
			cf.cbSize = Marshal.SizeOf(cf);
			int result = NativeMethods.SendMessage(base.Handle, 
				NativeMethods.EM_GETCHARFORMAT, 
				NativeMethods.SCF_SELECTION, 
				ref cf);

			return cf; 
		}