private Rectangle GetHotAreaBounds(IDeviceContext g, HotSpot area) { //GetPositionFromCharIndex give us the point at the top // left corner of this word. (see documentation on EM_POSFROMCHAR) Point start = _control.GetPositionFromCharIndex(area.Offset); // the following is necessary to work around a .Net bug int startX = (Int16)start.X; int startY = (Int16)start.Y; Size textSize = TextRenderer.MeasureText(g, area.Text, _control.Font, _control.ClientSize, TextFormatFlags.TextBoxControl | TextFormatFlags.NoPadding | TextFormatFlags.WordBreak); return(new Rectangle(startX, startY, textSize.Width, textSize.Height)); }
public HotSpotInternal(HotSpot hotspot, Color underlineColor) { HotSpot = hotspot; UnderlineColor = underlineColor; }
public void AddHotSpot(HotSpot hotSpot) { _hotSpots.Add(hotSpot); }
private Rectangle GetHotAreaBounds(IDeviceContext g, HotSpot area) { //GetPositionFromCharIndex give us the point at the top // left corner of this word. (see documentation on EM_POSFROMCHAR) Point start = _control.GetPositionFromCharIndex(area.Offset); // the following is necessary to work around a .Net bug int startX = (Int16) start.X; int startY = (Int16) start.Y; Size textSize = TextRenderer.MeasureText(g, area.Text, _control.Font, _control.ClientSize, TextFormatFlags.TextBoxControl | TextFormatFlags.NoPadding | TextFormatFlags.WordBreak); return new Rectangle(startX, startY, textSize.Width, textSize.Height); }
private void MoveMouseSoOverHotSpot(HotSpot.HotSpot hotSpot) { MoveMouseToPositionAtCharIndex(hotSpot.Offset); Application.DoEvents(); }
private ContextMenuStrip GetSuggestionContextMenu(string language, HotSpot.HotSpot hotSpot) { ContextMenuStrip strip = new ContextMenuStrip(); strip.ShowImageMargin = false; strip.ShowCheckMargin = false; ToolStripMenuItem item; int suggestionCount = 0; foreach (string suggestion in GetSuggestions(language, hotSpot.Text)) { if (++suggestionCount > 10) { break; } item = new ToolStripMenuItem(suggestion); item.Tag = hotSpot; item.Click += OnChooseSuggestedSpelling; strip.Items.Add(item); } if (strip.Items.Count == 0) { item = new ToolStripMenuItem(StringCatalog.Get("(No Spelling Suggestions)")); item.Enabled = false; strip.Items.Add(item); } strip.Items.Add(new ToolStripSeparator()); item = new ToolStripMenuItem(StringCatalog.Get("Add to Dictionary")); item.Tag = hotSpot; item.Click += OnAddToDictionary; strip.Items.Add(item); return strip; }
private static void ReplaceText(HotSpot.HotSpot area, string text) { TextBoxBase control = area.Control; control.SelectionStart = area.Offset; control.SelectionLength = area.Text.Length; TextBox textBox = control as TextBox; if (textBox != null) { textBox.Paste(text); //allows it to be undone } else { control.SelectedText = text; } control.Invalidate(); }