public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { if (File.Exists(_filepath)) { bool b; WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); } XmlUtil.SetAttribute(node, "type", "button"); XmlUtil.SetAttribute(node, "value", this.Text.Replace("\r", "").Replace('\n', ' ')); // XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); // StringBuilder sb = new StringBuilder(); // sb.Append("white-space: normal;"); // sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); // if (_dataNode != null) { XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); // pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='disabled']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (b) { XmlUtil.SetAttribute(node, "disabled", "disabled"); } } catch { } } } } XmlUtil.SetAttribute(node, "style", sb.ToString()); }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { bool b; XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); _resourceFiles = new List <WebResourceFile>(); if (File.Exists(_filepath)) { WebResourceFile wf = new WebResourceFile(_filepath, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { _filepath = wf.ResourceFile; } XmlUtil.SetAttribute(node, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_filepath))); } if (!string.IsNullOrEmpty(Description)) { XmlUtil.SetAttribute(node, "alt", Description); } if (!string.IsNullOrEmpty(MouseOverText)) { XmlUtil.SetAttribute(node, "title", MouseOverText); } // StringBuilder sb = new StringBuilder(); // if (ImageSizeMode == EnumHtmlImageSizeMode.Stretch) { if (WidthType != SizeType.AutoSize) { sb.Append("width:"); if (WidthType == SizeType.Absolute) { sb.Append(Width.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(WidthInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } // if (HeightType != SizeType.AutoSize) { sb.Append("height:"); if (HeightType == SizeType.Absolute) { sb.Append(Height.ToString(CultureInfo.InvariantCulture)); sb.Append("px; "); } else { sb.Append(HeightInPercent.ToString(CultureInfo.InvariantCulture)); sb.Append("%; "); } } } // WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); // if (_dataNode != null) { XmlNode pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='Visible']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); // pNode = _dataNode.SelectSingleNode(string.Format(CultureInfo.InvariantCulture, "{0}[@name='disabled']", XmlTags.XML_PROPERTY)); if (pNode != null) { string s = pNode.InnerText; if (!string.IsNullOrEmpty(s)) { try { b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (b) { XmlUtil.SetAttribute(node, "disabled", "disabled"); } } catch { } } } } XmlUtil.SetAttribute(node, "style", sb.ToString()); // WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap); }