/// <summary> /// Toggle the design time lock state of the selected items /// </summary> public void ToggleLock() { //Switch the lock on each item foreach (Interop.IHTMLElement elem in _items) { Interop.IHTMLStyle style = elem.GetStyle(); if (IsElementLocked(elem)) { //We need to remove attributes off the element and the style because of a bug in Trident elem.RemoveAttribute(DesignTimeLockAttribute, 0); style.RemoveAttribute(DesignTimeLockAttribute, 0); } else { //We need to add attributes to the element and the style because of a bug in Trident elem.SetAttribute(DesignTimeLockAttribute, "true", 0); style.SetAttribute(DesignTimeLockAttribute, "true", 0); } } }
/// <summary> /// Set style attribute for this element. /// </summary> /// <param name="element"></param> /// <param name="styleName"></param> /// <param name="styleText"></param> public void SetStyleAttribute(Interop.IHTMLElement element, string styleName, string styleText) { Interop.IHTMLStyle style = (Interop.IHTMLStyle)element.GetStyle(); style.SetAttribute(styleName.Replace("-", String.Empty), styleText, 0); }