void ContentMenu_EventHandler(object sender, HtmlEventArgs e) { e.PreventDefault(); e.StopPropagation(); Point point = new Point(e.OffsetX, e.OffsetY); if (AgControlBase.GetSLBounds(this).Contains(point)) { OnShowContextMenu(point); } }
void ContentMenu_EventHandler(object sender, HtmlEventArgs e) { Rect bounds = AgControlBase.GetSLBounds(this); if (bounds.Contains(new Point(e.ClientX, e.ClientY))) { e.PreventDefault(); e.StopPropagation(); this.ContextMenu.SetLocation(new Point(e.OffsetX, e.OffsetY)); this.ContextMenu.IsDropDownOpen = true; } }
/// <summary> /// Edit/View toggle link /// </summary> private void ToggleEditMode(object sender, HtmlEventArgs e) { HtmlElement elem = sender as HtmlElement; if (elem != null) { _editMode = !_editMode; elem.SetProperty("innerHTML", _editMode ? "View" : "Edit"); //DisplayLinks(); UpdateDisplay(); e.StopPropagation(); } }
private void OnIEContextMenu(object sender, HtmlEventArgs e) { e.PreventDefault(); e.StopPropagation(); HtmlPage.Document.DetachEvent("oncontextmenu", new EventHandler<HtmlEventArgs>(this.OnIEContextMenu)); this.OnRightClick(new Point((double)e.OffsetX, (double)e.OffsetY)); }
private void HandleHtmlKeyDown(object sender, HtmlEventArgs args) { if (!this.IsReadOnly) { // Ctrl + B or Ctrl + G if (args.CtrlKey && (args.CharacterCode == 66 || args.CharacterCode == 71)) { args.PreventDefault(); args.StopPropagation(); DoBold(); } // Ctrl + I else if (args.CtrlKey && args.CharacterCode == 73) { args.PreventDefault(); args.StopPropagation(); DoItalic(); } // Ctrl + U else if (args.CtrlKey && args.CharacterCode == 85) { args.PreventDefault(); args.StopPropagation(); DoUnderline(); } // ENTER else if (args.KeyCode == 13) { DoBreak(); } // TAB else if (args.KeyCode == 9) { args.PreventDefault(); args.StopPropagation(); if (args.ShiftKey) { DoOutdent(); } else { DoIndent(); } } } }