public virtual void CreateHtmlString(StringBuilder sb) { sb.Append("<td "); if (Align != EnumAlign.Default) { sb.Append("align=\""); sb.Append(Align); sb.Append("\" "); } if (VerticalAlign != EnumVAlign.Default) { sb.Append("valign=\""); sb.Append(VerticalAlign); sb.Append("\" "); } if (ColumnSpan > 1) { sb.Append("colspan=\""); sb.Append(ColumnSpan); sb.Append("\" "); } OnCreateHtmlAttributeString(sb); StringBuilder sl = new StringBuilder(); if (TextFont != null) { sl.Append(ObjectCreationCodeGen.GetFontStyleString(TextFont)); } if (TextColor != Color.Empty && TextColor != Color.Black) { sl.Append("color:"); sl.Append(ObjectCreationCodeGen.GetColorString(TextColor)); sl.Append("; "); } if (BackColor != Color.Empty) // && col.BackColor != this.HeadBackColor) { sl.Append("background-color:"); sl.Append(ObjectCreationCodeGen.GetColorString(BackColor)); sl.Append("; "); } OnCreateHtmlContentStyle(sl); if (sl.Length > 0) { sb.Append("style=\""); sb.Append(sl.ToString()); sb.Append("\""); } sb.Append(">"); OnCreateHtmlContentString(sb); sb.Append("</td>"); }
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>(); string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "arrow.gif"); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b)); } btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "menusep.png"); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Images, out b)); } XmlUtil.SetAttribute(node, "border", 0); if (this.BackColor != Color.Empty && this.BackColor != Color.White) { XmlUtil.SetAttribute(node, "bgColor", ObjectCreationCodeGen.GetColorString(this.BackColor)); } StringBuilder style = new StringBuilder(); WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, style); WebPageCompilerUtility.CreateElementPosition(this, style, positionType); WebPageCompilerUtility.CreateWebElementCursor(cursor, style, false); if (this.ForeColor != Color.Empty && this.ForeColor != Color.Black) { style.Append(" color:"); style.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); style.Append(";"); } style.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); XmlUtil.SetAttribute(node, "style", style.ToString()); // XmlNode tr = node.OwnerDocument.CreateElement("tr"); node.AppendChild(tr); for (int i = 0; i < MenuItems.Count; i++) { createTD(tr, MenuItems[i]); } // }
private void createPageNavigator(HtmlNode node, int pos) { HtmlNode nd; if (this.AutoColumnsAndRows && pos == 1) { nd = node.OwnerDocument.CreateElement("br"); node.AppendChild(nd); } nd = node.OwnerDocument.CreateElement("input"); node.AppendChild(nd); nd.SetAttributeValue("type", "button"); nd.SetAttributeValue("value", "|<"); nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoFirstPage();", this.CodeName)); nd = node.OwnerDocument.CreateElement("input"); node.AppendChild(nd); nd.SetAttributeValue("type", "button"); nd.SetAttributeValue("value", "<"); nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoPrevPage();", this.CodeName)); // nd = node.OwnerDocument.CreateElement("span"); node.AppendChild(nd); nd.SetAttributeValue("id", string.Format(CultureInfo.InvariantCulture, "{0}_sp{1}", this.CodeName, pos)); nd.SetAttributeValue("name", string.Format(CultureInfo.InvariantCulture, "{0}_sp", this.CodeName)); StringBuilder sb = new StringBuilder(); if (PageNavigatorFont != null) { sb.Append(ObjectCreationCodeGen.GetFontStyleString(PageNavigatorFont)); } sb.Append("color:blue;"); nd.SetAttributeValue("style", sb.ToString()); nd = node.OwnerDocument.CreateElement("input"); node.AppendChild(nd); nd.SetAttributeValue("type", "button"); nd.SetAttributeValue("value", ">"); nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoNextPage();", this.CodeName)); nd = node.OwnerDocument.CreateElement("input"); node.AppendChild(nd); nd.SetAttributeValue("type", "button"); nd.SetAttributeValue("value", ">|"); nd.SetAttributeValue("onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.gotoLastPage();", this.CodeName)); if (this.AutoColumnsAndRows && pos == 0) { nd = node.OwnerDocument.CreateElement("br"); node.AppendChild(nd); } }
public void CreateHtmlContent(XmlNode tr) { XmlNode td = tr.OwnerDocument.CreateElement("td"); tr.AppendChild(td); if (Align != EnumAlign.Default) { XmlUtil.SetAttribute(td, "align", Align); } if (VerticalAlign != EnumVAlign.Default) { XmlUtil.SetAttribute(td, "valign", VerticalAlign); } if (ColumnSpan > 1) { XmlUtil.SetAttribute(td, "colspan", ColumnSpan); } StringBuilder slc = new StringBuilder(); if (TextFont != null) { slc.Append(ObjectCreationCodeGen.GetFontStyleString(TextFont)); } if (TextColor != Color.Empty && TextColor != Color.Black) { slc.Append(" color:"); slc.Append(ObjectCreationCodeGen.GetColorString(TextColor)); slc.Append("; "); } if (BackColor != Color.Empty) // && BackColor != this.HeadBackColor) { slc.Append("background-color:"); slc.Append(ObjectCreationCodeGen.GetColorString(BackColor)); slc.Append("; "); } OnCreateHtmlContentStyle(slc); if (slc.Length > 0) { XmlUtil.SetAttribute(td, "style", slc.ToString()); } OnCreateHtmlContect(td); }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); for (int i = 0; i < Items.Count; i++) { string v; string s = VPLUtil.ObjectToString(Items[i]); if (!string.IsNullOrEmpty(s)) { int n = s.IndexOf('|'); if (n >= 0) { v = s.Substring(n + 1).Trim(); s = s.Substring(0, n).Trim(); } else { v = s; } } else { v = string.Empty; } XmlElement oNode = node.OwnerDocument.CreateElement("option"); node.AppendChild(oNode); XmlUtil.SetAttribute(oNode, "value", v); oNode.InnerText = s; oNode.IsEmpty = false; } // StringBuilder sb = new StringBuilder(); // 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()); StringBuilder dbs = new StringBuilder(); if (this.DataBindings != null && this.DataBindings.Count > 0) { string tbl2 = null; string sIdx = string.Empty; string slItem = string.Empty; string slValue = string.Empty; for (int i = 0; i < DataBindings.Count; i++) { if (DataBindings[i].DataSource != null) { if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0 || string.Compare(DataBindings[i].PropertyName, "selectedIndex", StringComparison.OrdinalIgnoreCase) == 0) { sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex", DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember); } else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0) { tbl2 = DataBindings[i].BindingMemberInfo.BindingPath; slItem = DataBindings[i].BindingMemberInfo.BindingField; } else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0) { tbl2 = DataBindings[i].BindingMemberInfo.BindingPath; slValue = DataBindings[i].BindingMemberInfo.BindingField; } } } if (!string.IsNullOrEmpty(sIdx)) { dbs.Append(sIdx); } if (!string.IsNullOrEmpty(tbl2)) { if (dbs.Length > 0) { dbs.Append(";"); } dbs.Append(tbl2); dbs.Append(":"); dbs.Append(slItem); dbs.Append(":"); dbs.Append(slValue); } if (dbs.Length > 0) { XmlUtil.SetAttribute(node, "jsdb", dbs.ToString()); } if (this.AddBlankOnDataBinding) { XmlUtil.SetAttribute(node, "useblank", "true"); } } // if (this.Items.Count == 0) { node.InnerText = ""; } XmlElement xe = (XmlElement)node; xe.IsEmpty = false; }
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 (!string.IsNullOrEmpty(_imageFilepath)) { if (File.Exists(_imageFilepath)) { WebResourceFile wf = new WebResourceFile(_imageFilepath, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { _imageFilepath = wf.ResourceFile; } XmlNode imgNode = node.OwnerDocument.CreateElement("img"); node.AppendChild(imgNode); XmlUtil.SetAttribute(imgNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(_imageFilepath))); } } XmlElement ndTxt = node.OwnerDocument.CreateElement("span"); node.AppendChild(ndTxt); ndTxt.InnerText = this.Text; ndTxt.IsEmpty = false; // XmlUtil.SetAttribute(node, "direction", _direction.ToString().ToLowerInvariant()); XmlUtil.SetAttribute(node, "scrollamount", _scrollAmount); if (_bounce) { XmlUtil.SetAttribute(node, "behavior", "alternate"); } else { XmlUtil.SetAttribute(node, "behavior", "scroll"); } // StringBuilder sb = new StringBuilder(); // if (!string.IsNullOrEmpty(_bkImageFilepath)) { if (File.Exists(_bkImageFilepath)) { _resourceFiles.Add(new WebResourceFile(_bkImageFilepath, WebResourceFile.WEBFOLDER_Images, out b)); sb.Append("background-image:url("); sb.Append(WebResourceFile.WEBFOLDER_Images); sb.Append("/"); sb.Append(Path.GetFileName(_bkImageFilepath)); sb.Append("); "); } } // sb.Append("border-width:"); sb.Append(_borderWidth.ToString(CultureInfo.InvariantCulture)); sb.Append("; "); // sb.Append("border-style:"); sb.Append(_borderStyle.ToString().ToLowerInvariant()); sb.Append("; "); // sb.Append("border-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(_brColor)); sb.Append("; "); // 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); // 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)); // } XmlUtil.SetAttribute(node, "style", sb.ToString()); }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); StringBuilder sb; XmlNode pNode; string id = XmlUtil.GetAttribute(node, "id"); if (string.IsNullOrEmpty(id)) { id = CodeName; } XmlUtil.SetAttribute(node, "id", string.Format(CultureInfo.InvariantCulture, "{0}sp", id)); XmlUtil.RemoveAttribute(node, "name"); sb = new StringBuilder(); WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateElementPosition(this, sb, positionType); if (_dataNode != null) { 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)); } XmlUtil.SetAttribute(node, "style", sb.ToString()); // XmlNode chkNode = node.OwnerDocument.CreateElement("input"); node.AppendChild(chkNode); XmlUtil.SetAttribute(chkNode, "id", id); XmlUtil.SetAttribute(chkNode, "type", "radio"); XmlUtil.SetAttribute(chkNode, "value", this.Value); if (this.Parent != null) { if (groupId >= 0) { XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}_{1}", this.Parent.Name, groupId)); } else { XmlUtil.SetAttribute(chkNode, "name", string.Format(CultureInfo.InvariantCulture, "r{0}", this.Parent.Name)); } } if (this.Checked) { XmlUtil.SetAttribute(chkNode, "checked", this.Checked); } sb = new StringBuilder(); if (_dataNode != null) { 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(chkNode, "disabled", "disabled"); } } catch { } } } } WebPageCompilerUtility.CreateWebElementZOrder(this.zOrder, sb); WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, false); string st = sb.ToString(); if (st.Length > 0) { XmlUtil.SetAttribute(chkNode, "style", st); } { XmlElement tn = node.OwnerDocument.CreateElement("span"); if (string.IsNullOrEmpty(this.Text)) { tn.IsEmpty = false; } else { tn.InnerText = this.Text; } // XmlUtil.SetAttribute(tn, "id", string.Format(CultureInfo.InvariantCulture, "{0}tx", id)); // sb = new StringBuilder(); // if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // WebPageCompilerUtility.CreateWebElementCursor(cursor, sb, true); // XmlUtil.SetAttribute(tn, "style", sb.ToString()); node.InsertAfter(tn, chkNode); } }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); // StringBuilder sb = new StringBuilder(); // if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // if (borderStyle != EnumBorderStyle.none && (borderWidth > 0 || (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber))) { sb.Append("border:"); if (borderWidthStyle != EnumBorderWidthStyle.inherit && borderWidthStyle != EnumBorderWidthStyle.useNumber) { sb.Append(borderWidthStyle); sb.Append(" "); } else { sb.Append(borderWidth); sb.Append("px "); } sb.Append(borderStyle); if (borderColor != Color.Empty) { sb.Append(" "); sb.Append(ObjectCreationCodeGen.GetColorString(borderColor)); } sb.Append(";"); } // bool b; if (!string.IsNullOrEmpty(_bkImgFile)) { if (File.Exists(_bkImgFile)) { WebResourceFile wf = new WebResourceFile(_bkImgFile, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { _bkImgFile = wf.ResourceFile; } sb.Append("background-image:url("); sb.Append(WebResourceFile.WEBFOLDER_Images); sb.Append("/"); sb.Append(Path.GetFileName(_bkImgFile)); sb.Append(");"); } } if (!BackgroundImageTile) { sb.Append("background-repeat: no-repeat;"); } // 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) { //sb.Append("disabled:true; "); XmlUtil.SetAttribute(node, "disabled", "disabled"); } } catch { } } } } XmlUtil.SetAttribute(node, "style", sb.ToString()); if (this.Controls.Count == 0) { node.InnerText = ""; } XmlElement xe = (XmlElement)node; xe.IsEmpty = false; }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); if (ReadOnly) { XmlUtil.SetAttribute(node, "readonly", true); } WebPageCompilerUtility.SetWebControlAttributes(this, node); _resourceFiles = new List <WebResourceFile>(); _htmlParts = new Dictionary <string, string>(); Dictionary <int, Dictionary <int, List <Control> > > ctrls = new Dictionary <int, Dictionary <int, List <Control> > >(); for (int r = 0; r < RowCount; r++) { Dictionary <int, List <Control> > cr = new Dictionary <int, List <Control> >(); ctrls.Add(r, cr); for (int c = 0; c < ColumnCount; c++) { List <Control> cs = new List <Control>(); cr.Add(c, cs); } } foreach (Control ct in this.Controls) { int i = this.GetRow(ct); int j = this.GetColumn(ct); if (i >= 0 && i < RowCount) { if (j >= 0 && j < ColumnCount) { Dictionary <int, List <Control> > cr; ctrls.TryGetValue(i, out cr); List <Control> cs; cr.TryGetValue(j, out cs); cs.Add(ct); } } } for (int r = 0; r < RowCount; r++) { Dictionary <int, List <Control> > cr; ctrls.TryGetValue(r, out cr); XmlNode rNode = node.OwnerDocument.CreateElement("tr"); node.AppendChild(rNode); if (_eventHandlers != null) { foreach (KeyValuePair <string, string> kv in _eventHandlers) { if (string.CompareOrdinal(kv.Key, "onRowClick") == 0) { XmlUtil.SetAttribute(rNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onRowMouseDown") == 0) { XmlUtil.SetAttribute(rNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onRowMouseUp") == 0) { XmlUtil.SetAttribute(rNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onRowMouseMove") == 0) { XmlUtil.SetAttribute(rNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onRowMouseOver") == 0) { XmlUtil.SetAttribute(rNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onRowMouseOut") == 0) { XmlUtil.SetAttribute(rNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } } } for (int c = 0; c < ColumnCount; c++) { XmlNode cNode = node.OwnerDocument.CreateElement("td"); rNode.AppendChild(cNode); if (_eventHandlers != null) { foreach (KeyValuePair <string, string> kv in _eventHandlers) { if (string.CompareOrdinal(kv.Key, "onCellClick") == 0) { XmlUtil.SetAttribute(cNode, "onclick", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onCellMouseDown") == 0) { XmlUtil.SetAttribute(cNode, "onmousedown", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onCellMouseUp") == 0) { XmlUtil.SetAttribute(cNode, "onmouseup", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onCellMouseMove") == 0) { XmlUtil.SetAttribute(cNode, "onmousemove", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onCellMouseOver") == 0) { XmlUtil.SetAttribute(cNode, "onmouseover", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } else if (string.CompareOrdinal(kv.Key, "onCellMouseOut") == 0) { XmlUtil.SetAttribute(cNode, "onmouseout", string.Format(CultureInfo.InvariantCulture, "{0}(this,null);", kv.Value)); } } } List <Control> cs; cr.TryGetValue(c, out cs); foreach (Control ct in cs) { createControlWebContents(ct, cNode, groupId); } } } // XmlUtil.SetAttribute(node, "border", _cellBorderWidth); // StringBuilder sb = new StringBuilder(); // if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { 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()); IDataSetSource ids = DataSource as IDataSetSource; if (ids != null && !string.IsNullOrEmpty(ids.TableName)) { XmlUtil.SetAttribute(node, "jsdb", ids.TableName); } }
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) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlNode okNode = node.OwnerDocument.CreateElement("img"); if (this.HideButtons) { XmlUtil.SetAttribute(okNode, "style", "display:none;cursor:pointer;"); } else { XmlUtil.SetAttribute(okNode, "style", "display:inline;cursor:pointer;"); } XmlUtil.SetAttribute(okNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onOK();", CodeName)); node.AppendChild(okNode); bool b; string imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "ok.png"); WebResourceFile wf = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { imgFile = wf.ResourceFile; } XmlUtil.SetAttribute(okNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile))); // XmlNode spaceNode = node.OwnerDocument.CreateElement("span"); spaceNode.InnerText = " "; node.AppendChild(spaceNode); // XmlNode cancelNode = node.OwnerDocument.CreateElement("img"); if (this.HideButtons) { XmlUtil.SetAttribute(cancelNode, "style", "display:none;cursor:pointer;"); } else { XmlUtil.SetAttribute(cancelNode, "style", "display:inline;cursor:pointer;"); } XmlUtil.SetAttribute(cancelNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.onCancel();", CodeName)); imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "cancel.png"); wf = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { imgFile = wf.ResourceFile; } XmlUtil.SetAttribute(cancelNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile))); node.AppendChild(cancelNode); // spaceNode = node.OwnerDocument.CreateElement("span"); spaceNode.InnerText = " "; node.AppendChild(spaceNode); // XmlNode chkAllNode = node.OwnerDocument.CreateElement("img"); if (this.HideButtons) { XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;"); } else { XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;"); } XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectAll();", CodeName)); imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "checkbox.png"); wf = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { imgFile = wf.ResourceFile; } XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile))); node.AppendChild(chkAllNode); // spaceNode = node.OwnerDocument.CreateElement("span"); spaceNode.InnerText = " "; node.AppendChild(spaceNode); // chkAllNode = node.OwnerDocument.CreateElement("img"); if (this.HideButtons) { XmlUtil.SetAttribute(chkAllNode, "style", "display:none;cursor:pointer;"); } else { XmlUtil.SetAttribute(chkAllNode, "style", "display:inline;cursor:pointer;"); } XmlUtil.SetAttribute(chkAllNode, "onclick", string.Format(CultureInfo.InvariantCulture, "document.getElementById('{0}').jsData.selectNone();", CodeName)); imgFile = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "box.png"); wf = new WebResourceFile(imgFile, WebResourceFile.WEBFOLDER_Images, out b); _resourceFiles.Add(wf); if (b) { imgFile = wf.ResourceFile; } XmlUtil.SetAttribute(chkAllNode, "src", string.Format(CultureInfo.InvariantCulture, "{0}/{1}", WebResourceFile.WEBFOLDER_Images, Path.GetFileName(imgFile))); node.AppendChild(chkAllNode); // XmlNode brNode = node.OwnerDocument.CreateElement("br"); node.AppendChild(brNode); XmlNode lstNode = node.OwnerDocument.CreateElement("select"); node.AppendChild(lstNode); XmlUtil.SetAttribute(lstNode, "id", string.Format(CultureInfo.InvariantCulture, "{0}_sel", CodeName)); for (int i = 0; i < _listBox.Items.Count; i++) { string v; string s = VPLUtil.ObjectToString(_listBox.Items[i]); if (!string.IsNullOrEmpty(s)) { int n = s.IndexOf('|'); if (n >= 0) { v = s.Substring(n + 1).Trim(); s = s.Substring(0, n).Trim(); } else { v = s; } } else { v = string.Empty; } XmlElement oNode = node.OwnerDocument.CreateElement("option"); lstNode.AppendChild(oNode); XmlUtil.SetAttribute(oNode, "value", v); oNode.InnerText = s; oNode.IsEmpty = false; } Graphics g = this.CreateGraphics(); SizeF sf = g.MeasureString("H", this.Font); float h = (float)this.Height / sf.Height; XmlUtil.SetAttribute(lstNode, "size", Convert.ToInt32(h + 1)); XmlUtil.SetAttribute(lstNode, "multiple", "multiple"); // StringBuilder sblst = new StringBuilder(); StringBuilder sb = new StringBuilder(); // sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // sblst.Append(sb.ToString()); sblst.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); XmlUtil.SetAttribute(lstNode, "style", sblst.ToString()); // 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()); // StringBuilder dbs = new StringBuilder(); if (this.DataBindings != null && this.DataBindings.Count > 0) { string tbl2 = null; string sIdx = string.Empty; string slItem = string.Empty; string slValue = string.Empty; for (int i = 0; i < DataBindings.Count; i++) { if (DataBindings[i].DataSource != null) { if (string.Compare(DataBindings[i].PropertyName, "SelectedIndex", StringComparison.OrdinalIgnoreCase) == 0) { sIdx = string.Format(CultureInfo.InvariantCulture, "{0}:{1}:SelectedIndex", DataBindings[i].BindingMemberInfo.BindingPath, DataBindings[i].BindingMemberInfo.BindingMember); } else if (string.Compare(DataBindings[i].PropertyName, "SelectedItem", StringComparison.OrdinalIgnoreCase) == 0) { tbl2 = DataBindings[i].BindingMemberInfo.BindingPath; slItem = DataBindings[i].BindingMemberInfo.BindingField; } else if (string.Compare(DataBindings[i].PropertyName, "SelectedValue", StringComparison.OrdinalIgnoreCase) == 0) { tbl2 = DataBindings[i].BindingMemberInfo.BindingPath; slValue = DataBindings[i].BindingMemberInfo.BindingField; } } } if (!string.IsNullOrEmpty(sIdx)) { dbs.Append(sIdx); } if (!string.IsNullOrEmpty(tbl2)) { if (dbs.Length > 0) { dbs.Append(";"); } dbs.Append(tbl2); dbs.Append(":"); dbs.Append(slItem); dbs.Append(":"); dbs.Append(slValue); } if (dbs.Length > 0) { XmlUtil.SetAttribute(lstNode, "jsdb", dbs.ToString()); } } if (_listBox.Items.Count == 0) { lstNode.InnerText = ""; } XmlElement xe = (XmlElement)lstNode; xe.IsEmpty = false; }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positiontype, int groupId) { // _resourceFiles = new List <WebResourceFile>(); _htmlParts = new Dictionary <string, string>(); bool b; string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "limnortabs.css"); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b)); } // XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); WebPageCompilerUtility.GetElementStyleSize(this, out _widthStyle, out _heighStyle); // StringBuilder sb = new StringBuilder(); // if (this.Parent is HtmlFlowLayout) { sb.Append("min-height:"); sb.Append(this.Height.ToString(CultureInfo.InvariantCulture)); sb.Append("px;overflow:hidden;"); } else { } // 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 { } } } // 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()); // string fnt = ObjectCreationCodeGen.GetFontStyleString(this.Font); Graphics g = this.CreateGraphics(); g.PageUnit = GraphicsUnit.Pixel; float tabloc = (float)10; // for (int i = 0; i < TabPages.Count; i++) { TabPage p = this.TabPages[i]; XmlNode pageNode = node.OwnerDocument.CreateElement("section"); node.AppendChild(pageNode); XmlUtil.SetAttribute(pageNode, "id", p.Name); XmlNode h2 = node.OwnerDocument.CreateElement("h2"); pageNode.AppendChild(h2); XmlNode a = node.OwnerDocument.CreateElement("a"); h2.AppendChild(a); a.InnerText = p.Text; XmlUtil.SetAttribute(a, "href", string.Format(CultureInfo.InvariantCulture, "#{0}", p.Name)); SizeF txtSize = g.MeasureString(p.Text, this.Font); float txtwidth = txtSize.Width + (float)6.0; StringBuilder h2style = new StringBuilder(fnt); h2style.Append(string.Format(CultureInfo.InvariantCulture, "width:{0}px;", Math.Round(txtwidth, 2))); if (i > 0) { h2style.Append(string.Format(CultureInfo.InvariantCulture, "left:{0}px;", Math.Round(tabloc, 2))); } tabloc = tabloc + txtwidth + (float)3; XmlUtil.SetAttribute(h2, "style", h2style.ToString()); foreach (Control ct in p.Controls) { createControlWebContents(ct, pageNode); } StringBuilder sbPageStyle = new StringBuilder(); if (p.BackColor != Color.Empty && p.BackColor != Color.Transparent) { sbPageStyle.Append("background-color:"); sbPageStyle.Append(ObjectCreationCodeGen.GetColorString(p.BackColor)); sbPageStyle.Append(";"); } if (!string.IsNullOrEmpty(_widthStyle)) { sbPageStyle.Append("width:"); sbPageStyle.Append(_widthStyle); } if (!string.IsNullOrEmpty(_heighStyle)) { sbPageStyle.Append("height:"); sbPageStyle.Append(_heighStyle); } if (sbPageStyle.Length > 0) { XmlUtil.SetAttribute(pageNode, "style", sbPageStyle.ToString()); } } }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlElement tNode = node.OwnerDocument.CreateElement("legend"); node.AppendChild(tNode); tNode.InnerText = this.Text; tNode.IsEmpty = false; // StringBuilder sb = new StringBuilder(); // if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { 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) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); _resourceFiles = new List <WebResourceFile>(); _htmlParts = new Dictionary <string, string>(); foreach (Control ct in this.Controls) { createControlWebContents(ct, node, groupId); } // StringBuilder sb = new StringBuilder(); if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } // sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); // if (this.BorderStyle != BorderStyle.None) { sb.Append("border:1px solid black;"); } // 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) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); XmlNode brNode = node.OwnerDocument.CreateElement("br"); ((XmlElement)node).IsEmpty = false; node.AppendChild(brNode); if (_resourceFiles == null) { _resourceFiles = new List <WebResourceFile>(); } // string[] jsFiles = new string[16]; jsFiles[0] = "empty_0.png"; jsFiles[1] = "empty_dn.png"; jsFiles[2] = "empty_up.png"; jsFiles[3] = "empty_up_dn.png"; jsFiles[4] = "h1.png"; jsFiles[5] = "l_up_dn.png"; jsFiles[6] = "minus_0.png"; jsFiles[7] = "minus_dn.png"; jsFiles[8] = "minus_up.png"; jsFiles[9] = "minus_up_dn.png"; jsFiles[10] = "plus_0.png"; jsFiles[11] = "plus_dn.png"; jsFiles[12] = "plus_up.png"; jsFiles[13] = "plus_up_dn.png"; jsFiles[14] = "vl.png"; jsFiles[15] = "w20.png"; string btimg; string dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "webTreeView"); for (int i = 0; i < jsFiles.Length; i++) { btimg = Path.Combine(dir, jsFiles[i]); if (File.Exists(btimg)) { bool b; _resourceFiles.Add(new WebResourceFile(btimg, "treeview", out b)); } } dir = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "libjs"); btimg = Path.Combine(dir, "html_file.png"); if (File.Exists(btimg)) { bool b; _resourceFiles.Add(new WebResourceFile(btimg, "libjs", out b)); } // StringBuilder sb = new StringBuilder(); // sb.Append("border-style:"); sb.Append(_borderStyle); 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) { OnSetType(node); XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); if (IncludeDatetimePickerButton) { bool b; string btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), "datepicker.css"); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Css, out b)); } string[] jsFiles = new string[8]; jsFiles[0] = "backstripes.gif"; jsFiles[1] = "bg_header.jpg"; jsFiles[2] = "bullet1.gif"; jsFiles[3] = "bullet2.gif"; jsFiles[4] = "cal.gif"; jsFiles[5] = "cal-grey.gif"; jsFiles[6] = "datepicker.js"; jsFiles[7] = "gradient-e5e5e5-ffffff.gif"; for (int i = 0; i < jsFiles.Length; i++) { btimg = Path.Combine(Path.GetDirectoryName(Application.ExecutablePath), jsFiles[i]); if (File.Exists(btimg)) { _resourceFiles.Add(new WebResourceFile(btimg, WebResourceFile.WEBFOLDER_Javascript, out b)); } } bool inDataRepeater = false; Control p = this.Parent; while (p != null) { if (p is HtmlDataRepeater) { inDataRepeater = true; break; } p = p.Parent; } if (inDataRepeater) { string fs = "10px"; if (!string.IsNullOrEmpty(this.DatetimePickerFontSize)) { fs = DatetimePickerFontSize.Trim(); if (fs.Length == 0) { fs = "10px"; } } string includeTime = DatetimePickerIncludeTime ? "true" : "false"; XmlUtil.SetAttribute(node, "useDP", true); XmlUtil.SetAttribute(node, "useDPTime", includeTime); XmlUtil.SetAttribute(node, "useDPSize", fs); } } if (this.ReadOnly) { XmlUtil.SetAttribute(node, "readonly", "true"); } if (this.MaxLength > 0 && this.MaxLength < int.MaxValue) { XmlUtil.SetAttribute(node, "maxlength", this.MaxLength.ToString(CultureInfo.InvariantCulture)); } // StringBuilder sb = new StringBuilder(); // 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()); // WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap); }
public void CreateHtmlContent(XmlNode node, EnumWebElementPositionType positionType, int groupId) { XmlUtil.SetAttribute(node, "tabindex", this.TabIndex); WebPageCompilerUtility.SetWebControlAttributes(this, node); if (this.RightToLeft == RightToLeft.Yes) { XmlUtil.SetAttribute(node, "dir", "RTL"); } WebPageCompilerUtility.SetTextContentsToNode(node, this.Text); // StringBuilder sb = new StringBuilder(); // if (this.Parent != null) { if (this.BackColor != this.Parent.BackColor) { sb.Append("background-color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.BackColor)); sb.Append("; "); } } // if (this.Parent != null) { if (this.ForeColor != this.Parent.ForeColor) { sb.Append("color:"); sb.Append(ObjectCreationCodeGen.GetColorString(this.ForeColor)); sb.Append("; "); } } // if (_float != EnumInlineFloat.none && positionType == EnumWebElementPositionType.Absolute) { sb.Append("float:"); sb.Append(_float.ToString()); sb.Append("; "); 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 { bool b = Convert.ToBoolean(s, CultureInfo.InvariantCulture); if (!b) { sb.Append("display:none; "); } } catch { } } } sb.Append(ObjectCreationCodeGen.GetFontStyleString(this.Font)); // } XmlUtil.SetAttribute(node, "style", sb.ToString()); // WebPageCompilerUtility.WriteDataBindings(node, this.DataBindings, DataBindNameMap); // }
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); }