int IDocHostShowUI.ShowHelp(IntPtr hwnd, string pszHelpFile, uint uCommand, uint dwData, tagPOINT ptMouse, object pDispatchObjectHit) { return Hresults.E_NOTIMPL; }
private static Bitmap GetElementPreviewImage(IHTMLDocument3 doc3, IHTMLElement element, int snapshotWidth, int snapshotHeight) { try { // @RIBBON TODO: Need to make this work for RTL as well. IDisplayServices displayServices = ((IDisplayServices)doc3); element.scrollIntoView(true); tagPOINT offset = new tagPOINT(); offset.x = 0; offset.y = 0; displayServices.TransformPoint(ref offset, _COORD_SYSTEM.COORD_SYSTEM_CONTENT, _COORD_SYSTEM.COORD_SYSTEM_GLOBAL, element); using (Bitmap snapshotAfter = HtmlScreenCaptureCore.TakeSnapshot((IViewObject)doc3, snapshotWidth, snapshotHeight)) { //snapshotAfter.Save(@"c:\temp\snapshot" + element.id + ".bmp"); Rectangle elementRect; elementRect = new Rectangle(Math.Max(2, offset.x), 2, Math.Min(element.offsetWidth, element.offsetParent.offsetWidth), element.offsetHeight); if (element.offsetWidth <= 0 || element.offsetHeight <= 0) return null; Bitmap cropped = ImageHelper2.CropBitmap(snapshotAfter, elementRect); //cropped.Save(@"c:\temp\snapshot" + element.id + ".cropped.bmp"); return cropped; } } catch (Exception ex) { Trace.Fail("Failed to get element preview image for id " + element.id + ": " + ex); return null; } }