本文整理汇总了C#中IHTMLEventObj类的典型用法代码示例。如果您正苦于以下问题:C# IHTMLEventObj类的具体用法?C# IHTMLEventObj怎么用?C# IHTMLEventObj使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IHTMLEventObj类属于命名空间,在下文中一共展示了IHTMLEventObj类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ResetParameters
public void ResetParameters(HTMLEventType EventType, HTMLEventDispIds DispID, IHTMLEventObj pEvtObj)
{
this.Cancel = false;
this.m_EventDispId = DispID;
m_pEvtObj = pEvtObj;
m_EventType = EventType;
}
示例2: PreHandleEvent
public int PreHandleEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
// EventType [mouseover, mouseout, mousemove, mouseup]
// When clicked something, check if it is module or not
if (pIEventObj.EventType == "mousedown")
{
IHTMLElement module;
if (isModule(pIEventObj.SrcElement, out module))
{
// Fire event
ElementDataEventArgs args = new ElementDataEventArgs();
args.element = module;
args.eventObj = pIEventObj;
this.moduleClicked(this, args);
// And deny the rest
return HRESULT.S_OK;
}
else
{
ElementDataEventArgs args = new ElementDataEventArgs();
args.element = pIEventObj.SrcElement;
args.eventObj = pIEventObj;
this.canvasClicked(this, args);
}
}
return HRESULT.S_FALSE;
}
示例3: _editorContext_PreHandleEvent
private int _editorContext_PreHandleEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
try
{
switch (inEvtDispId)
{
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEMOVE:
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEDOWN:
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEUP:
return HandleMouseEvent(inEvtDispId, pIEventObj);
default:
return HRESULT.S_FALSE;
}
}
catch (Exception ex)
{
// log error
Trace.Fail("Unexpected error during TableColumnSizeEditor PreHandleEvent: " + ex.ToString());
// reset state
_sizingOperation.EndSizing();
// event not handled
return HRESULT.S_FALSE;
}
}
示例4: _click
///Define the original source format
///Finder:Way:Value;Action:ActionType:Value
/// <summary>
///
/// </summary>
/// <param name="obj"></param>
public static void _click(IHTMLEventObj obj)
{
string identify = GetIdentify(obj.srcElement);
identify += "action : click" + System.Environment.NewLine;
sb.Append(identify);
obj.srcElement.click();
}
示例5: HandleMouseEvent
private int HandleMouseEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
// WinLive 160252: MSHTML throws a COMException with HRESULT 0x8000FFFF (E_UNEXPECTED) when calling
// IHTMLPaintSite.TransformGlobalToLocal if the table has no height.
IHTMLElement tableElement = (IHTMLElement)_table;
if (tableElement.offsetHeight <= 0 || tableElement.offsetWidth <= 0)
{
return HRESULT.S_FALSE;
}
// compute the element local coordinates of the point
POINT clientMouseLocation = new POINT();
clientMouseLocation.x = pIEventObj.clientX;
clientMouseLocation.y = pIEventObj.clientY;
POINT localMouseLocation = new POINT();
_paintSite.TransformGlobalToLocal(clientMouseLocation, ref localMouseLocation);
// determine if the point is within our bounds
int tableWidth = tableElement.offsetWidth + 4; // extra padding for mouse handling at right edge
Rectangle elementBounds = new Rectangle(-1, -1, tableWidth, tableElement.offsetHeight + 1);
bool mouseInElement = elementBounds.Contains(localMouseLocation.x, localMouseLocation.y);
if (mouseInElement || _sizingOperation.InProgress)
{
// create args
TableColumnMouseEventArgs mouseEventArgs = new TableColumnMouseEventArgs(
new Point(clientMouseLocation.x, clientMouseLocation.y),
new Point(localMouseLocation.x, localMouseLocation.y));
// fire the event
switch (inEvtDispId)
{
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEMOVE:
OnMouseMove(mouseEventArgs);
break;
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEDOWN:
OnMouseDown(mouseEventArgs);
break;
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEUP:
OnMouseUp(mouseEventArgs);
break;
default:
Trace.Fail("unexpected event id");
break;
}
// indicate whether we should mask the event from the editor
return mouseEventArgs.Handled ? HRESULT.S_OK : HRESULT.S_FALSE;
}
else
{
// if the mouse is not inside the element the end sizing
_sizingOperation.EndSizing();
}
// event not handled
return HRESULT.S_FALSE;
}
示例6: HTMLDocumentEventArgs
bool HTMLDocumentEvents2.onhelp(IHTMLEventObj pEvtObj)
{
if (doconhelp != null)
{
HTMLDocumentEventArgs arg = new HTMLDocumentEventArgs(pEvtObj);
doconhelp(this, arg);
return arg.AllowDefault;
}
else
return true; //Allow, default
}
示例7: HTMLSelectElementEventArgs
bool HTMLSelectElementEvents2.onhelp(IHTMLEventObj pEvtObj)
{
if (selectonhelp != null)
{
HTMLSelectElementEventArgs args = new HTMLSelectElementEventArgs(pEvtObj);
selectonhelp(this, args);
return args.AllowDefault;
}
else
return true; //Allow, default
}
示例8: HTMLScriptEventArgs
bool HTMLScriptEvents2.onhelp(IHTMLEventObj pEvtObj)
{
if (scriptonhelp != null)
{
HTMLScriptEventArgs arg = new HTMLScriptEventArgs(pEvtObj);
scriptonhelp(this, arg);
return arg.AllowDefault;
}
else
return true;
}
示例9: PreHandleEvent
/// <summary>
/// Pre-process mouse messages to detect drag-and-drop of selections
/// </summary>
/// <param name="inEvtDispId">event id</param>
/// <param name="pIEventObj">event object</param>
/// <returns>S_FALSE to continue default processing, S_OK to prevent further processing</returns>
internal int PreHandleEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
switch (inEvtDispId)
{
// pre-handle mouse events
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEDOWN:
return PreHandleMouseDown(inEvtDispId, pIEventObj);
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEUP:
return PreHandleMouseUp(inEvtDispId, pIEventObj);
case DISPID_HTMLELEMENTEVENTS2.ONMOUSEMOVE:
return PreHandleMouseMove(inEvtDispId, pIEventObj);
// allow all other events to pass through
default:
return HRESULT.S_FALSE;
}
}
示例10: HandlePreHandleEvent
protected override int HandlePreHandleEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
if (ShouldProcessEvents(inEvtDispId, pIEventObj))
{
if (_dragDropController.PreHandleEvent(inEvtDispId, pIEventObj) == HRESULT.S_OK)
return HRESULT.S_OK;
if (inEvtDispId == DISPID_HTMLELEMENTEVENTS2.ONMOUSEDOWN && (Control.MouseButtons & MouseButtons.Right) > 0)
{
// Select the disabled image so that the context menu shows up correctly.
EditorContext.Selection = DisabledImageSelection.SelectElement(EditorContext, HTMLElement);
return HRESULT.S_OK;
}
}
return HRESULT.S_FALSE;
}
示例11: ProcessEvent
/// <summary>
/// Processes the keystroke event.
/// </summary>
/// <param name="inEvtDispId">The dispatch id of the event.</param>
/// <param name="pIEventObj">The event object.</param>
/// <returns>A KeyEventArgs object with the current state of the RTL accelerator keys. This can be null if there was nothing to process.</returns>
public KeyEventArgs ProcessEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
Keys currentKey = (Keys)pIEventObj.keyCode;
KeyEventArgs e = null;
if (inEvtDispId == DISPID_HTMLELEMENTEVENTS2.ONKEYDOWN)
{
if (currentKey == Keys.ControlKey)
{
this.ctrlDown = true;
}
else if (currentKey == Keys.ShiftKey)
{
// The first shift key down is the one we'll track.
if (((IHTMLEventObj3)pIEventObj).shiftLeft && !this.rightShiftDown)
{
this.leftShiftDown = true;
}
else if (!this.leftShiftDown)
{
this.rightShiftDown = true;
}
}
else
{
// If any other keystrokes beside CTRL and SHIFT are pressed, stop tracking the keystrokes we've
// seen. For example, a user might hit CTRL+SHIFT+LEFT to start highlighting a word and we don't
// want that to trigger the RTL/LTR command.
this.Reset();
}
}
else if (inEvtDispId == DISPID_HTMLELEMENTEVENTS2.ONKEYUP)
{
// We always want to fire an event if CTRL goes up with SHIFT still pressed or vice-versa so that
// MSHTML doesn't attempt to handle the keystrokes.
if ((currentKey == Keys.ControlKey && pIEventObj.shiftKey) || (currentKey == Keys.ShiftKey && pIEventObj.ctrlKey))
{
e = this.GetKeyEventArgs();
}
this.Reset();
}
return e;
}
示例12: _click
public void _click(IHTMLEventObj obj)
{
try
{
string identify = GetIdentify(obj.srcElement);
identify += "; CLICK";
StepRecorder.RecordStep(UserBar.instance.SteptreeView, identify);
obj.srcElement.click();
}
catch (Exception ex)
{
throw ex;
}
}
示例13: PreHandleMouseDown
// <summary>
/// Pre-process mouse messages to detect drag-and-drop of selections
/// </summary>
/// <param name="inEvtDispId">event id</param>
/// <param name="pIEventObj">event object</param>
/// <returns>S_FALSE to continue default processing, S_OK to prevent further processing</returns>
private int PreHandleMouseDown(int inEvtDispId, IHTMLEventObj pIEventObj)
{
// if this is a left mouse down over an existing selection then start
// watching for a drag and drop
if (CouldBeDragBegin(pIEventObj))
{
// set state for drag/drop detection
watchForDragDrop = true;
dragDropWatchStartPoint = new Point(pIEventObj.clientX, pIEventObj.clientY);
// prevent MSHTML from even knowing about the MouseDown! (otherwise he
// will capture the mouse, start drag/drop detection, and generally get
// in a very confused state)
return HRESULT.S_OK;
}
else
{
// allow default processing
return HRESULT.S_FALSE;
}
}
示例14: _keypress
public static void _keypress(IHTMLEventObj obj)
{
Keys currentKey = (Keys)Enum.Parse(typeof(Keys),obj.keyCode.ToString());
IHTMLElement current = ((DispHTMLDocument)obj.srcElement.document).activeElement;
if (CloneInputElement != null)
{
if (current == CloneInputElement) //same input
{
sb.Append(current.getAttribute(Finder.valueAttribute, 0));
}
else
{
CloneInputElement = (IHTMLElement)((IHTMLDOMNode)current).cloneNode(true);
sb.Length = 0;
sb.Append(current.getAttribute(Finder.valueAttribute, 0));
}
}
else
{
CloneInputElement = (IHTMLElement)((IHTMLDOMNode)current).cloneNode(true);
sb.Length = 0;
sb.Append(current.getAttribute(Finder.valueAttribute, 0));
}
//switch (currentKey)
//{
// case Keys.Enter:
// break;
// default:
// break;
//}
//string identify = GetIdentify(obj.srcElement);
//identify += "action : keyinput ; value :"+obj.keyCode ;
}
示例15: EditorContext_PreHandleEvent
private int EditorContext_PreHandleEvent(int inEvtDispId, IHTMLEventObj pIEventObj)
{
if ( Selected )
{
if ( inEvtDispId == DISPID_HTMLELEMENTEVENTS2.ONMOUSEMOVE )
{
MouseInWidget = ClientPointInWidget(pIEventObj.clientX, pIEventObj.clientY) ;
}
else if ( inEvtDispId == DISPID_HTMLELEMENTEVENTS2.ONMOUSEDOWN )
{
if ( WidgetActive && MouseInWidget )
{
// show the properties form
ShowProperties() ;
// eat the click
return HRESULT.S_OK ;
}
}
}
return HRESULT.S_FALSE;
}