本文整理汇总了C#中IHTMLElement.removeAttribute方法的典型用法代码示例。如果您正苦于以下问题:C# IHTMLElement.removeAttribute方法的具体用法?C# IHTMLElement.removeAttribute怎么用?C# IHTMLElement.removeAttribute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IHTMLElement
的用法示例。
在下文中一共展示了IHTMLElement.removeAttribute方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: htmlEditor_SnapRectEvent
private void htmlEditor_SnapRectEvent(IHTMLElement pIElement, ref RECT prcNEW, _ELEMENT_CORNER elementCorner)
{
IHTMLImgElement imgElement = pIElement as IHTMLImgElement;
if (imgElement != null)
{
// see if we are scaling a new image
if (snapRectImageElement == null || snapRectImageElement.sourceIndex != snapRectImageElement.sourceIndex)
{
// save the image element so that mouseUp handler can regenerate the resized image.
snapRectImageElement = pIElement;
//save the initial image size so that we can scale the image based on the original size.
//Note: this is important to minimize rounding errors that may occurs while the image is snapping
//the old logic scaled based on the imgElement height and width attributes, so each snap iteration would
//case the image to distort more and more.
snapRectInitialImageSize = new Size(imgElement.width, imgElement.height);
}
// only preserve constraints if we are sizing a true corner
if (IsTrueCorner(elementCorner))
{
snapRectPreserveConstraints = true;
// get the new width and height
int width = prcNEW.right - prcNEW.left;
int height = prcNEW.bottom - prcNEW.top;
// scale the picture (using its current proportions!) based on the size of the snap rectangle.
Size constrainedSize = ImageUtils.GetScaledImageSize(width, height, snapRectInitialImageSize);
width = constrainedSize.Width;
height = constrainedSize.Height;
// adjust the location and size of the image
switch (elementCorner)
{
case _ELEMENT_CORNER.ELEMENT_CORNER_BOTTOMLEFT:
prcNEW.left = prcNEW.right - width;
prcNEW.bottom = prcNEW.top + height;
break;
case _ELEMENT_CORNER.ELEMENT_CORNER_BOTTOMRIGHT:
prcNEW.right = prcNEW.left + width;
prcNEW.bottom = prcNEW.top + height;
break;
case _ELEMENT_CORNER.ELEMENT_CORNER_TOPLEFT:
prcNEW.left = prcNEW.right - width;
prcNEW.top = prcNEW.bottom - height;
break;
case _ELEMENT_CORNER.ELEMENT_CORNER_TOPRIGHT:
prcNEW.right = prcNEW.left + width;
prcNEW.top = prcNEW.bottom - height;
break;
default:
Trace.Fail("Unexpected element corner: " + elementCorner.ToString());
break;
}
}
//Hack: unset the width and height attributes so that the MSHTMLEditor doesn't set the height/width
//using the style attribute when it handles the snapRect. Once its set using style, it can never be unset...
pIElement.removeAttribute("width", 0);
pIElement.removeAttribute("height", 0);
}
//suppress resizing of the the extended entry splitter
if (pIElement.id == PostBodyEditingElementBehavior.EXTENDED_ENTRY_ID)
{
IHTMLElement2 e2 = (IHTMLElement2)pIElement;
IHTMLRect rect = e2.getBoundingClientRect();
prcNEW.top = rect.top;
prcNEW.bottom = rect.bottom;
prcNEW.left = rect.left;
prcNEW.right = rect.right;
}
}