/// <inheritdoc /> protected override void AddAttributesToRender(HtmlTextWriter writer) { if (Cols > 0) { writer.AddAttribute("cols", Cols.ToString()); } base.AddAttributesToRender(writer); }
private void NewMapDialog_Load(object sender, EventArgs e) { //Init textboxes textBoxRows.Text = Rows.ToString(); textBoxColumns.Text = Cols.ToString(); textBoxTileWidth.Text = TileWidth.ToString(); textBoxTileHeight.Text = TileHeight.ToString(); UpdateLblMapSize(); }
/// <inheritdoc /> protected override void AddAttributesToRender(HtmlTextWriter writer) { if (!IsCondensed) { if (string.IsNullOrEmpty(ActionText)) { throw new MissingRequiredAttribute("ActionText", ActionText); } else { writer.AddAttribute("actiontext", ActionText); } if (ShowBorder) { writer.AddAttribute("showborder", FbmlConstants.TRUE); } if (EmailInvite) { writer.AddAttribute("email_invite", FbmlConstants.TRUE); } if (Rows > 0) { writer.AddAttribute("rows", Rows.ToString()); } if (Cols > 0) { writer.AddAttribute("cols", Cols.ToString()); } if (Bypass != Bypass.Skip) { writer.AddAttribute("bypass", Bypass.ToString().ToLowerInvariant()); } } else { writer.AddAttribute("condensed", FbmlConstants.TRUE); if (UnselectedRows > 0) { writer.AddAttribute("unselected_rows", UnselectedRows.ToString()); } if (SelectedRows > 0) { writer.AddAttribute("selected_rows", SelectedRows.ToString()); } } if (Max > 0) { writer.AddAttribute("max", Max.ToString()); } if (!string.IsNullOrEmpty(ExcludeIds)) { writer.AddAttribute("exclude_ids", ExcludeIds); } base.AddAttributesToRender(writer); }
/// <summary> /// Function to call when serializing this object to XML /// </summary> /// <param name="writer">The xml writer</param> public virtual void WriteXml(System.Xml.XmlWriter writer) { writer.WriteAttributeString("Rows", Rows.ToString()); writer.WriteAttributeString("Cols", Cols.ToString()); writer.WriteAttributeString("NumberOfChannels", NumberOfChannels.ToString()); writer.WriteAttributeString("CompressionRatio", SerializationCompressionRatio.ToString()); writer.WriteStartElement("Bytes"); Byte[] bytes = Bytes; writer.WriteBase64(bytes, 0, bytes.Length); writer.WriteEndElement(); }
/// <summary>Converts an object into its XML representation.</summary> /// <param name="writer">The <see cref="T:System.Xml.XmlWriter" /> stream to which the object is /// serialized.</param> public void WriteXml(XmlWriter writer) { writer.WriteAttributeString("cols", Cols.ToString()); writer.WriteAttributeString("rows", Rows.ToString()); for (int i = 0; i < Rows; i++) { writer.WriteStartElement("r"); for (int j = 0; j < Cols; j++) { writer.WriteStartElement("e"); writer.WriteValue(_matrix[i][j]); writer.WriteEndElement(); } writer.WriteEndElement(); } }
/// <summary> /// 输出html,在浏览器中显示控件 /// </summary> /// <param name="output"> 要写出到的 HTML 编写器 </param> protected override void Render(HtmlTextWriter output) { //当为TextArea时,maxlength属性可能失效,所以采用js进行长度限制 if (this.TextMode == TextBoxMode.MultiLine) { output.WriteLine("<script type=\"text/javascript\">"); output.WriteLine("function isMaxLen(o){"); output.WriteLine("var nMaxLen=o.getAttribute? parseInt(o.getAttribute(\"maxlength\")):\"\";"); output.WriteLine(" if(o.getAttribute && o.value.length>nMaxLen){"); output.WriteLine(" o.value=o.value.substring(0,nMaxLen)"); output.WriteLine("}}</script>"); this.AddAttributes("rows", Rows.ToString()); this.AddAttributes("cols", Cols.ToString()); this.Attributes.Add("onfocus", "this.className='FormFocus';"); this.Attributes.Add("onblur", "this.className='FormBase';"); this.Attributes.Add("class", "FormBase"); } else if (this.TextMode == TextBoxMode.Password) { this.AddAttributes("value", this.Text); } else { if (this.Size > 0) { this.AddAttributes("size", this.Size.ToString()); } } if (this.HintInfo != "") { this.AddAttributes("onmouseover", "showhintinfo(this," + this.HintLeftOffSet + "," + this.HintTopOffSet + ",'" + this.HintTitle + "','" + this.HintInfo + "','" + this.HintHeight + "','" + this.HintShowType + "')"); this.AddAttributes("onmouseout", "hidehintinfo()"); } base.Render(output); RenderChildren(output); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { // Skip path attributes if (attr.NamespaceUri == XmlNamespace.Svg) { if (attr.LocalName == "stroke-width" || attr.LocalName == "stroke" || attr.LocalName == "stroke-opacity" || attr.LocalName == "fill" || attr.LocalName == "fill-opacity") { continue; } } yield return(attr); } } yield return(new SvgAttribute("x", "0", XmlNamespace.AurigmaVectorObjects, () => X.ToString(CultureInfo.InvariantCulture), v => X = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("y", "0", XmlNamespace.AurigmaVectorObjects, () => Y.ToString(CultureInfo.InvariantCulture), v => Y = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("cols", "0", XmlNamespace.AurigmaVectorObjects, () => Cols.ToString(CultureInfo.InvariantCulture), v => Cols = SvgAttribute.ParseIntAttribute(v) )); yield return(new SvgAttribute("rows", "0", XmlNamespace.AurigmaVectorObjects, () => Rows.ToString(CultureInfo.InvariantCulture), v => Rows = SvgAttribute.ParseIntAttribute(v) )); yield return(new SvgAttribute("step-x", "0", XmlNamespace.AurigmaVectorObjects, () => StepX.ToString(CultureInfo.InvariantCulture), v => StepX = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("step-y", "0", XmlNamespace.AurigmaVectorObjects, () => StepY.ToString(CultureInfo.InvariantCulture), v => StepY = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("stroke-fixed-width", "", XmlNamespace.AurigmaVectorObjects, () => FixedStrokeWidth.ToString(CultureInfo.InvariantCulture).ToLowerInvariant(), v => FixedStrokeWidth = v != "false" )); yield return(new SvgAttribute("vertical-line-color", "", XmlNamespace.AurigmaVectorObjects, () => _verticalLineColor, v => _verticalLineColor = v )); yield return(new SvgAttribute("horizontal-line-color", "", XmlNamespace.AurigmaVectorObjects, () => _horizontalLineColor, v => _horizontalLineColor = v )); }
/// <summary> /// 将此控件呈现给指定的输出参数。 /// </summary> /// <param name="output"> 要写出到的 HTML 编写器 </param> protected override void Render(HtmlTextWriter output) { //output.Write(Text); if (this.TextMode == "MultiLine") { output.WriteLine("<script type=\"text/javascript\">"); output.WriteLine("function isMaxLen(o){"); output.WriteLine("var nMaxLen=o.getAttribute? parseInt(o.getAttribute(\"maxlength\")):\"\";"); output.WriteLine(" if(o.getAttribute && o.value.length>nMaxLen){"); output.WriteLine(" o.value=o.value.substring(0,nMaxLen)"); output.WriteLine("}}</script>"); this.AddAttributes("rows", Rows.ToString()); this.AddAttributes("cols", Cols.ToString()); } else { if (this.Width.Value.ToString() != "") { if (Width.Type.ToString() != "") { this.AddAttributes("SIZE", (Width.Value / 10).ToString() + (Width.Type.ToString() == "Pixel" ? "px" : "%")); } else { this.AddAttributes("SIZE", (Width.Value / 10).ToString() + "px"); } } if (this.Size.ToString() != "") { this.AddAttributes("SIZE", this.Size.ToString()); } } //当指定了输入框的最小或最大值时,则加入校验范围项 if (this.MaximumValue != null || this.MinimumValue != null) { rangevalidator.ControlToValidate = tb.ID; rangevalidator.Type = ValidationDataType.Double; rangevalidator.ForeColor = System.Drawing.Color.Black; if (this.MaximumValue != null && this.MinimumValue != null) { rangevalidator.MaximumValue = this.MaximumValue; rangevalidator.MinimumValue = this.MinimumValue; rangevalidator.ErrorMessage = " 当前输入数据应在" + this.MinimumValue + "和" + this.MaximumValue + "之间!"; } else { if (this.MaximumValue != null) { rangevalidator.MaximumValue = this.MaximumValue; rangevalidator.ErrorMessage = " 当前输入数据允许最大值为" + this.MaximumValue; } if (this.MinimumValue != null) { rangevalidator.MinimumValue = this.MinimumValue; rangevalidator.ErrorMessage = " 当前输入数据允许最小值为" + this.MinimumValue; } } rangevalidator.Display = ValidatorDisplay.Static; this.Controls.Add(rangevalidator); } RenderChildren(output); }