// IWebElement protected override void InternalRender(HtmlTextWriter writer) { if (_horizontalAlignment != HorizontalAlignment.Left) { if (_horizontalAlignment == HorizontalAlignment.Center) { writer.AddAttribute("align", "center", false); } else { writer.AddAttribute(HtmlTextWriterAttribute.Align, "right", false); } writer.RenderBeginTag(HtmlTextWriterTag.Div); } string hint = GetHint(); if (hint != String.Empty) { writer.AddAttribute(HtmlTextWriterAttribute.Title, hint, true); } writer.AddAttribute(HtmlTextWriterAttribute.Src, "ViewImage.aspx?ImageID=" + _imageID); RenderStretchAttributes(writer, _stretchStyle, _imageWidth, _imageHeight); writer.AddAttribute(HtmlTextWriterAttribute.Valign, _verticalAlignment.ToString().ToLower()); writer.RenderBeginTag(HtmlTextWriterTag.Img); writer.RenderEndTag(); if (_horizontalAlignment != HorizontalAlignment.Left) { writer.RenderEndTag(); } }
public override string ToString() { var sb = new StringBuilder(); sb.Append(Bold.ToString()); sb.Append("-"); sb.Append(Italic.ToString()); sb.Append("-"); sb.Append(Underline.ToString()); sb.Append("-"); sb.Append(Strikethrough.ToString()); sb.Append("-"); sb.Append(VerticalAlignment.ToString()); sb.Append("-"); sb.Append(Shadow.ToString()); sb.Append("-"); sb.Append(FontSize.ToString()); sb.Append("-"); sb.Append(FontColor); sb.Append("-"); sb.Append(FontName); sb.Append("-"); sb.Append(FontFamilyNumbering.ToString()); return(sb.ToString()); }
protected override XmlElement VCreateInheritedElement(XmlElement baseElement) { var fontElement = baseElement.OwnerDocument.CreateElement("Font"); fontElement.SetAttribute("resource", FontResource); baseElement.AppendChild(fontElement); var textElement = baseElement.OwnerDocument.CreateElement("Text"); textElement.SetAttribute("text", Text); baseElement.AppendChild(textElement); var literalTextElement = baseElement.OwnerDocument.CreateElement("LiteralText"); literalTextElement.SetAttribute("status", LiteralText.ToString(CultureInfo.InvariantCulture)); baseElement.AppendChild(literalTextElement); var hAlignmentElement = baseElement.OwnerDocument.CreateElement("HorizontalAlignment"); hAlignmentElement.SetAttribute("value", HorizontalAlignment.ToString()); baseElement.AppendChild(hAlignmentElement); var vAlignmentElement = baseElement.OwnerDocument.CreateElement("VerticalAlignment"); vAlignmentElement.SetAttribute("value", VerticalAlignment.ToString()); baseElement.AppendChild(vAlignmentElement); return(baseElement); }
private void ValidateContentWithConstrainedHeight( Compositor compositor, Scroller scroller, FrameworkElement content, VerticalAlignment verticalAlignment, float expectedHorizontalOffset, float expectedMinPosition, float expectedZoomFactor) { const double c_topMargin = 40.0; const double c_bottomMargin = 10.0; float horizontalOffset = 0.0f; float verticalOffset = 0.0f; float zoomFactor = 1.0f; double arrangeRenderSizesDelta = 0.0; double expectedVerticalOffset = 0.0; RunOnUIThread.Execute(() => { Log.Comment("Covering alignment " + verticalAlignment.ToString()); content.VerticalAlignment = verticalAlignment; }); IdleSynchronizer.Wait(); RunOnUIThread.Execute(() => { Verify.AreEqual(content.VerticalAlignment, verticalAlignment); Verify.AreEqual(content.DesiredSize.Height, c_defaultUIScrollerHeight); // 200 Verify.AreEqual(content.RenderSize.Height, c_defaultUIScrollerHeight - c_topMargin - c_bottomMargin); // 200 - 40 - 10 = 150 arrangeRenderSizesDelta = GetArrangeRenderSizesDelta( BiDirectionalAlignmentFromVerticalAlignment(verticalAlignment), extentSize: c_defaultUIScrollerHeight, renderSize: c_defaultUIScrollerHeight - c_topMargin - c_bottomMargin, nearMargin: c_topMargin, farMargin: c_bottomMargin); Verify.AreEqual(arrangeRenderSizesDelta, 40.0); expectedVerticalOffset = -expectedMinPosition + (expectedZoomFactor - 1.0f) * arrangeRenderSizesDelta; }); SpyTranslationAndScale(scroller, compositor, out horizontalOffset, out verticalOffset, out zoomFactor); Log.Comment("horizontalOffset={0}, verticalOffset={1}, zoomFactor={2}", horizontalOffset, verticalOffset, zoomFactor); Log.Comment("expectedHorizontalOffset={0}, expectedVerticalOffset={1}, expectedZoomFactor={2}", expectedHorizontalOffset, expectedVerticalOffset, expectedZoomFactor); Verify.AreEqual(horizontalOffset, expectedHorizontalOffset); Verify.AreEqual(verticalOffset, expectedVerticalOffset); Verify.AreEqual(zoomFactor, expectedZoomFactor); }
private static VerticalAlignmentValues ToVerticalAlignmentValues(VerticalAlignment ver) { switch (ver) { case VerticalAlignment.Bottom: return(VerticalAlignmentValues.Bottom); case VerticalAlignment.Center: return(VerticalAlignmentValues.Center); case VerticalAlignment.Top: return(VerticalAlignmentValues.Top); default: throw new NotSupportedException(ver.ToString()); } }
public void WriteXml(XmlWriter writer) { TypeConverter ffc = TypeDescriptor.GetConverter(typeof(FontFamily)); TypeConverter fsc = TypeDescriptor.GetConverter(typeof(FontStyle)); TypeConverter fwc = TypeDescriptor.GetConverter(typeof(FontWeight)); TypeConverter rc = TypeDescriptor.GetConverter(typeof(Rect)); writer.WriteElementString("FontFamily", ffc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontFamily)); writer.WriteElementString("FontStyle", fsc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontStyle)); writer.WriteElementString("FontWeight", fwc.ConvertToString(null, System.Globalization.CultureInfo.InvariantCulture, FontWeight)); writer.WriteElementString("FontSize", FontSize.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("HorizontalAlignment", HorizontalAlignment.ToString()); writer.WriteElementString("VerticalAlignment", VerticalAlignment.ToString()); writer.WriteStartElement("Padding"); writer.WriteElementString("Left", PaddingLeft.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Top", PaddingTop.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Right", PaddingRight.ToString(CultureInfo.InvariantCulture)); writer.WriteElementString("Bottom", PaddingBottom.ToString(CultureInfo.InvariantCulture)); writer.WriteEndElement(); if (Decorations.HasFlag(Helios.TextDecorations.Underline)) { writer.WriteStartElement("Underline"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.Strikethrough)) { writer.WriteStartElement("Strikethrough"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.Baseline)) { writer.WriteStartElement("Baseline"); writer.WriteEndElement(); } if (Decorations.HasFlag(Helios.TextDecorations.OverLine)) { writer.WriteStartElement("OverLine"); writer.WriteEndElement(); } }
private string GetOpening() { var q = new StringBuilder(); q.Append("legend"); if (VerticalAlignment != UmlDiagramLegendVerticalAlignment.Auto) { q.Append(" "); q.Append(VerticalAlignment.ToString().ToLower()); } if (HorizontalAlignment != UmlDiagramLegendHorizontalAlignment.Auto) { q.Append(" "); q.Append(HorizontalAlignment.ToString().ToLower()); } return(q.ToString()); }
public override void InternalRenderCell(HtmlTextWriter writer, Alphora.Dataphor.DAE.Runtime.Data.IRow currentRow, bool isActiveRow, int rowIndex) { string tempValue; if ((ColumnName == String.Empty) || !currentRow.HasValue(ColumnName)) { tempValue = String.Empty; } else { tempValue = ((DAE.Runtime.Data.Scalar)currentRow.GetValue(ColumnName)).AsDisplayString; } writer.AddAttribute(HtmlTextWriterAttribute.Class, GetClass(currentRow, isActiveRow)); if (!_wordWrap) { writer.AddAttribute(HtmlTextWriterAttribute.Nowrap, null); } writer.AddAttribute(HtmlTextWriterAttribute.Align, TextAlignment.ToString()); writer.AddAttribute(HtmlTextWriterAttribute.Valign, VerticalAlignment.ToString()); if (_verticalText) { writer.AddAttribute(HtmlTextWriterAttribute.Style, "mso-rotate:-90"); } if (_maxRows >= 1) { writer.AddAttribute(HtmlTextWriterAttribute.Rows, _maxRows.ToString()); } writer.RenderBeginTag(HtmlTextWriterTag.Td); if (tempValue == String.Empty) { writer.Write(" "); } else { writer.Write(HttpUtility.HtmlEncode(Session.TruncateTitle(tempValue, Width)).Replace("\n", "<br>")); } writer.RenderEndTag(); }
public override IEnumerable <SvgAttribute> GetAttributes() { var baseAttributes = base.GetAttributes(); if (baseAttributes != null) { foreach (var attr in baseAttributes) { yield return(attr); } } yield return(new SvgAttribute("wrapping-rectanlges", null, XmlNamespace.AurigmaVectorObjects, () => WrappingRectanglesJson, v => WrappingRectanglesJson = v )); yield return(new SvgAttribute("wrapping-margin", null, XmlNamespace.AurigmaVectorObjects, () => WrappingMargin.ToString(CultureInfo.InvariantCulture), v => WrappingMargin = SvgAttribute.ParseFloatAttribute(v) )); yield return(new SvgAttribute("paragraph-settings", null, XmlNamespace.AurigmaVectorObjects, () => ParagraphSettingsJson, v => ParagraphSettingsJson = v )); yield return(new SvgAttribute("vertical-alignment", TextVerticalAlignment.Top.ToString().ToLowerInvariant(), XmlNamespace.AurigmaVectorObjects, () => VerticalAlignment.ToString().ToLowerInvariant(), v => VerticalAlignment = SvgAttribute.ParseEnumAttribute <TextVerticalAlignment>(v) )); yield return(new SvgAttribute("is-vertical", bool.FalseString, () => IsVertical.ToString(), v => IsVertical = SvgAttribute.ParseBooleanAttribute(v) )); }
/// <summary> /// Raises the <see cref = "E:System.Web.UI.Control.Load" /> event. /// </summary> /// <param name = "e">The <see cref = "T:System.EventArgs" /> object that contains the event data.</param> protected override void OnLoad(EventArgs e) { base.OnLoad(e); try { // Assign field values FontNameDropDownList.SelectedValue = FontName; CustomFontPathTextBox.Text = CustomFontPath; FontSizeTextBox.Text = FontSize.ToString(); foreach (var fontStyle in FontStyles.Where(fontStyle => fontStyle != FontStyle.Regular)) { FontStyleCheckBoxList.Items.FindByText(fontStyle.ToString()).Selected = true; } ForegroundColorPicker.Value = ForegroundColor; BackgroundColorPicker.Value = BackgroundColor; ShadowColorPicker.Value = ShadowColor; HorizontalAlignmentDropDownList.SelectedValue = HorizontalAlignment.ToString(); VerticalAlignmentDropDownList.SelectedValue = VerticalAlignment.ToString(); ImageHeightTextBox.Text = ImageHeight.ToString(); ImageWidthTextBox.Text = ImageWidth.ToString(); _dataExtractor.Value = BackgroundMediaId; BackgroundMediaChooser.Value = _dataExtractor.Value.ToString(); ImageFormatDropDownList.SelectedValue = OutputFormat.ToString(); // Image Preview //var image = System.Drawing.Image.FromFile(IOHelper.MapPath(ImagePreviewUrl)); ImagePreview.Height = ImageHeight < 1 ? Unit.Empty : Unit.Pixel(ImageHeight); ImagePreview.Width = ImageWidth < 1 ? Unit.Empty : Unit.Pixel(ImageWidth); ImagePreview.ImageUrl = ImagePreviewUrl; } catch (Exception exception) { SetErrorMessage(exception); } }
public bool Draw(RootElement source, OnRenderEventArgs eventArgs) { if (useCustomFont) { return(MtaClient.DxDrawText(Content, Position.X, Position.Y, BottomRight.X, BottomRight.Y, Color.Hex, Scale.X, Scale.Y, CustomFont.MTAFont, HorizontalAlignment.ToString().ToLower(), VerticalAlignment.ToString().ToLower(), Clip, WordBreak, PostGUI, ColorCoded, SubPixelPositioning, Rotation, RotationOrigin.X, RotationOrigin.Y)); } else { return(MtaClient.DxDrawText(Content, Position.X, Position.Y, BottomRight.X, BottomRight.Y, Color.Hex, Scale.X, Scale.Y, StandardFont.ToString().ToLower(), HorizontalAlignment.ToString().ToLower(), VerticalAlignment.ToString().ToLower(), Clip, WordBreak, PostGUI, ColorCoded, SubPixelPositioning, Rotation, RotationOrigin.X, RotationOrigin.Y)); } }
/// <summary> /// Create a new text item /// </summary> public Item(Display display, string content, Vector2 position, Priority priority, Color color, float scale, HorizontalAlignment alignX, VerticalAlignment alignY, int shadowAlpha = 0) { Display = display; ItemElement = MtaServer.TextCreateTextItem(content, position.X, position.Y, priority.ToString().ToLower(), color.R, color.G, color.B, color.A, scale, alignX.ToString().ToLower(), alignY.ToString().ToLower(), shadowAlpha); MtaServer.TextDisplayAddText(display.DisplayElement, ItemElement); visible = true; }
public Bubble() { Style = MainWindow.MainApp.BackButton.Style; HorizontalAlignment = HorizontalAlignment.Center; VerticalAlignment = VerticalAlignment.Center; Click += Bubble_Click; Padding = new Thickness(12, 7, 12, 7); #region members = new Dictionary <string, Variable> { { "Width", new FVariable { ongetvalue = () => new Gnumber(Width), onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); } } }, { "Height", new FVariable { ongetvalue = () => new Gnumber(Height), onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); } } }, { "Horizontal", new FVariable { ongetvalue = () => new Gstring(HorizontalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { HorizontalAlignment = HorizontalAlignment.Center; } else if (value.ToString() == "left") { HorizontalAlignment = HorizontalAlignment.Left; } else if (value.ToString() == "right") { HorizontalAlignment = HorizontalAlignment.Right; } else if (value.ToString() == "stretch") { HorizontalAlignment = HorizontalAlignment.Stretch; } return(0); } } }, { "Vertical", new FVariable { ongetvalue = () => new Gstring(VerticalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { VerticalAlignment = VerticalAlignment.Center; } else if (value.ToString() == "bottom") { VerticalAlignment = VerticalAlignment.Bottom; } else if (value.ToString() == "stretch") { VerticalAlignment = VerticalAlignment.Stretch; } else if (value.ToString() == "top") { VerticalAlignment = VerticalAlignment.Top; } return(0); } } }, { "Margin", new FVariable { ongetvalue = () => new Glist { new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Margin = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Visibility", new FVariable { ongetvalue = () => { string s = "null"; switch (Visibility) { case Visibility.Collapsed: s = "gone"; break; case Visibility.Hidden: s = "hidden"; break; case Visibility.Visible: s = "visible"; break; } return(new Gstring(s)); }, onsetvalue = (value) => { if (value.ToString() == "gone") { Visibility = Visibility.Collapsed; } else if (value.ToString() == "hidden") { Visibility = Visibility.Hidden; } else if (value.ToString() == "visible") { Visibility = Visibility.Visible; } return(0); } } }, { "Text", new FVariable { ongetvalue = () => new Gstring(Content.ToString()), onsetvalue = (value) => { Content = value.ToString(); return(0); } } }, { "FontSize", new FVariable { ongetvalue = () => new Gnumber(FontSize), onsetvalue = (value) => { FontSize = Convert.ToDouble(value); return(0); } } }, { "Padding", new FVariable { ongetvalue = () => new Glist { new Variable(Padding.Left), new Variable(Padding.Top), new Variable(Padding.Right), new Variable(Padding.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Padding = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Background", new FVariable { ongetvalue = () => new Gstring(Background.ToString()), onsetvalue = (value) => { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString())); return(0); } } }, { "Foreground", new FVariable { ongetvalue = () => new Gstring(Foreground.ToString()), onsetvalue = (value) => { Foreground = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString())); return(0); } } }, { "Clickevent", new FVariable { ongetvalue = () => event_click as IOBJ, onsetvalue = (value) => { event_click = value; return(0); } } } }; parent = new GTWPF.Control(this); #endregion }
public PositionConfigBuilder At(HorizontalAlignment h, VerticalAlignment v) { base.Options["at"] = (h.ToString() + " " + v.ToString()).ToLower(); return(this); }
public Image() { HorizontalAlignment = HorizontalAlignment.Center; VerticalAlignment = VerticalAlignment.Center; #region members = new Dictionary <string, Variable> { { "Width", new FVariable { ongetvalue = () => new Gnumber(Width), onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); } } }, { "Height", new FVariable { ongetvalue = () => new Gnumber(Height), onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); } } }, { "Horizontal", new FVariable { ongetvalue = () => new Gstring(HorizontalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { HorizontalAlignment = HorizontalAlignment.Center; } else if (value.ToString() == "left") { HorizontalAlignment = HorizontalAlignment.Left; } else if (value.ToString() == "right") { HorizontalAlignment = HorizontalAlignment.Right; } else if (value.ToString() == "stretch") { HorizontalAlignment = HorizontalAlignment.Stretch; } return(0); } } }, { "Vertical", new FVariable { ongetvalue = () => new Gstring(VerticalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { VerticalAlignment = VerticalAlignment.Center; } else if (value.ToString() == "bottom") { VerticalAlignment = VerticalAlignment.Bottom; } else if (value.ToString() == "stretch") { VerticalAlignment = VerticalAlignment.Stretch; } else if (value.ToString() == "top") { VerticalAlignment = VerticalAlignment.Top; } return(0); } } }, { "Margin", new FVariable { ongetvalue = () => new Glist { new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Margin = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Visibility", new FVariable { ongetvalue = () => { string s = "null"; switch (Visibility) { case Visibility.Collapsed: s = "gone"; break; case Visibility.Hidden: s = "hidden"; break; case Visibility.Visible: s = "visible"; break; } return(new Gstring(s)); }, onsetvalue = (value) => { if (value.ToString() == "gone") { Visibility = Visibility.Collapsed; } else if (value.ToString() == "hidden") { Visibility = Visibility.Hidden; } else if (value.ToString() == "visible") { Visibility = Visibility.Visible; } return(0); } } }, { "Source", new FVariable { ongetvalue = () => new GStream((System.IO.Stream) new ImageSourceConverter().ConvertTo(Source, typeof(System.IO.Stream))), onsetvalue = (value) => { try { Source = (ImageSource) new ImageSourceConverter().ConvertFrom(value.IGetCSValue()); } catch (Exception e) { MessageBox.Show(e.ToString()); } return(0); } } }, }; parent = new GTWPF.Control(this); #endregion }
public GridFlat() { #region members = new Dictionary <string, Variable> { { "Width", new FVariable { ongetvalue = () => new Gnumber(Width), onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); } } }, { "Height", new FVariable { ongetvalue = () => new Gnumber(Height), onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); } } }, { "Horizontal", new FVariable { ongetvalue = () => new Gstring(HorizontalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { HorizontalAlignment = HorizontalAlignment.Center; } else if (value.ToString() == "left") { HorizontalAlignment = HorizontalAlignment.Left; } else if (value.ToString() == "right") { HorizontalAlignment = HorizontalAlignment.Right; } else if (value.ToString() == "stretch") { HorizontalAlignment = HorizontalAlignment.Stretch; } return(0); } } }, { "Vertical", new FVariable { ongetvalue = () => new Gstring(VerticalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { VerticalAlignment = VerticalAlignment.Center; } else if (value.ToString() == "bottom") { VerticalAlignment = VerticalAlignment.Bottom; } else if (value.ToString() == "stretch") { VerticalAlignment = VerticalAlignment.Stretch; } else if (value.ToString() == "top") { VerticalAlignment = VerticalAlignment.Top; } return(0); } } }, { "Margin", new FVariable { ongetvalue = () => new Glist { new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Margin = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Visibility", new FVariable { ongetvalue = () => { string s = "null"; switch (Visibility) { case Visibility.Collapsed: s = "gone"; break; case Visibility.Hidden: s = "hidden"; break; case Visibility.Visible: s = "visible"; break; } return(new Gstring(s)); }, onsetvalue = (value) => { if (value.ToString() == "gone") { Visibility = Visibility.Collapsed; } else if (value.ToString() == "hidden") { Visibility = Visibility.Hidden; } else if (value.ToString() == "visible") { Visibility = Visibility.Visible; } return(0); } } }, { "Background", new FVariable { ongetvalue = () => new Gstring(Background.ToString()), onsetvalue = (value) => { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString())); return(0); } } }, { "Add", new Variable(new MFunction(add, this)) }, { "AddRow", new Variable(new MFunction(addrow, this)) }, { "AddColumn", new Variable(new MFunction(addcolume, this)) } }; parent = new GTWPF.Control(this); #endregion }
protected override void Render(HtmlTextWriter writer) { if (this.Page == null || this.Page.Site == null || !this.Page.Site.DesignMode) { StringBuilder sb = new StringBuilder(); sb.Append(ResolveUrl(HandlerUrl)); sb.Append("?url="); sb.Append(ResolveUrl(ImageUrl)); if (!IsNullOrEmpty(BackgroundImageUrl)) { sb.Append("&bg="); sb.Append(ResolveUrl(BackgroundImageUrl)); } if (!IsNullOrEmpty(ForegroundImageUrl)) { sb.Append("&fg="); sb.Append(ResolveUrl(ForegroundImageUrl)); } if (!IsNullOrEmpty(NotFoundImageUrl)) { sb.Append("&nf="); sb.Append(ResolveUrl(NotFoundImageUrl)); } if (DrawSize.Height > 0) { sb.Append("&h="); sb.Append(DrawSize.Height); } if (DrawSize.Width > 0) { sb.Append("&w="); sb.Append(DrawSize.Width); } if (VerticalAlignment != VerticalAlignment.NotSet) { sb.Append("&y="); sb.Append(VerticalAlignment.ToString().Substring(0, 1).ToLower()); } else if (DrawTop > 0) { sb.Append("&y="); sb.Append(DrawTop); } if (HorizontalAlignment != HorizontalAlignment.NotSet) { sb.Append("&x="); sb.Append(HorizontalAlignment.ToString().Substring(0, 1).ToLower()); } else if (DrawLeft > 0) { sb.Append("&x="); sb.Append(DrawLeft); } if (NoCache) { sb.Append("&nocache="); } if (Cache > 0) { sb.Append("&cache="); sb.Append(Cache); } if (SmoothingMode != SmoothingMode.Default) { sb.Append("&sm="); sb.Append(SmoothingMode); } if (CompositingQuality != CompositingQuality.Default) { sb.Append("&cq="); sb.Append(CompositingQuality); } if (WebImageFormat != WebImageFormat.Auto) { sb.Append("&f="); sb.Append(WebImageFormat.ToString()); } ImageUrl = sb.ToString(); } base.Render(writer); }
object IGetter.IGetVerticalAlignment() { return(VerticalAlignment.ToString()); }
public ScrollFlat() { HorizontalScrollBarVisibility = ScrollBarVisibility.Auto; VerticalScrollBarVisibility = ScrollBarVisibility.Auto; #region members = new Dictionary <string, Variable> { { "Width", new FVariable { ongetvalue = () => new Gnumber(Width), onsetvalue = (value) => { Width = Convert.ToDouble(value); return(0); } } }, { "Height", new FVariable { ongetvalue = () => new Gnumber(Height), onsetvalue = (value) => { Height = Convert.ToDouble(value); return(0); } } }, { "Horizontal", new FVariable { ongetvalue = () => new Gstring(HorizontalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { HorizontalAlignment = HorizontalAlignment.Center; } else if (value.ToString() == "left") { HorizontalAlignment = HorizontalAlignment.Left; } else if (value.ToString() == "right") { HorizontalAlignment = HorizontalAlignment.Right; } else if (value.ToString() == "stretch") { HorizontalAlignment = HorizontalAlignment.Stretch; } return(0); } } }, { "Vertical", new FVariable { ongetvalue = () => new Gstring(VerticalAlignment.ToString()), onsetvalue = (value) => { if (value.ToString() == "center") { VerticalAlignment = VerticalAlignment.Center; } else if (value.ToString() == "bottom") { VerticalAlignment = VerticalAlignment.Bottom; } else if (value.ToString() == "stretch") { VerticalAlignment = VerticalAlignment.Stretch; } else if (value.ToString() == "top") { VerticalAlignment = VerticalAlignment.Top; } return(0); } } }, { "Margin", new FVariable { ongetvalue = () => new Glist { new Variable(Margin.Left), new Variable(Margin.Top), new Variable(Margin.Right), new Variable(Margin.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Margin = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Visibility", new FVariable { ongetvalue = () => { string s = "null"; switch (Visibility) { case Visibility.Collapsed: s = "gone"; break; case Visibility.Hidden: s = "hidden"; break; case Visibility.Visible: s = "visible"; break; } return(new Gstring(s)); }, onsetvalue = (value) => { if (value.ToString() == "gone") { Visibility = Visibility.Collapsed; } else if (value.ToString() == "hidden") { Visibility = Visibility.Hidden; } else if (value.ToString() == "visible") { Visibility = Visibility.Visible; } return(0); } } }, { "Padding", new FVariable { ongetvalue = () => new Glist { new Variable(Padding.Left), new Variable(Padding.Top), new Variable(Padding.Right), new Variable(Padding.Bottom) }, onsetvalue = (value) => { var list = value.IGetCSValue() as Glist; Padding = new Thickness( Convert.ToDouble(list[0].value), Convert.ToDouble(list[1].value), Convert.ToDouble(list[2].value), Convert.ToDouble(list[3].value) ); return(0); } } }, { "Background", new FVariable { ongetvalue = () => new Gstring(Background.ToString()), onsetvalue = (value) => { Background = new SolidColorBrush((Color)ColorConverter.ConvertFromString(value.ToString())); return(0); } } }, { "ScrollPosition", new FVariable { ongetvalue = () => { return(new Glist { new Variable(ScrollInfo.HorizontalOffset), new Variable(ScrollInfo.VerticalOffset) }); }, onsetvalue = (value) => { if (value.IGetType() == "List") { var list = value.IGetCSValue() as Glist; var ho = Convert.ToDouble(list[0].value); var vo = Convert.ToDouble(list[1].value); ScrollToHorizontalOffset(ho); ScrollToVerticalOffset(vo); } else { string s_info = value.ToString(); switch (s_info) { case "bottom": ScrollToBottom(); return(0); case "end": ScrollToEnd(); return(0); case "home": ScrollToHome(); return(0); case "leftend": ScrollToLeftEnd(); return(0); case "rightend": ScrollToRightEnd(); return(0); case "top": ScrollToTop(); return(0); default: break; } } return(0); } } }, { "SetContent", new Variable(new MFunction(setcontent, this)) } }; parent = new GTWPF.Control(this); #endregion }
/// <summary> /// Returns a <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"></see> as a CSS-Style. /// </summary> /// <returns> /// A <see cref="T:System.String"></see> that represents the current <see cref="T:System.Object"> as a CSS-Style</see>. /// </returns> /// <remarks>Documented by Dev05, 2007-10-30</remarks> public string ToString(string basePath) { string cssString = "\n" + Name + "\n" + "{\n"; if (forecolor.Name != "Empty" && forecolor.Name != "0") { cssString += "\tcolor:\t\t\t\t" + string.Format("#{0:x2}{1:x2}{2:x2};", forecolor.R, forecolor.G, forecolor.B) + "\n"; } if (backcolor.Name != "Empty" && backcolor.Name != "0") { cssString += "\tbackground-color:\t" + string.Format("#{0:x2}{1:x2}{2:x2};", backcolor.R, backcolor.G, backcolor.B) + "\n"; } if (fontFamily != null) { cssString += "\tfont-family:\t\t" + fontFamily.Name + ";\n"; } if ((fontStyle & CSSFontStyle.Bold) == CSSFontStyle.Bold) { cssString += "\tfont-weight:\t\tbold;\n"; } if ((fontStyle & CSSFontStyle.Italic) == CSSFontStyle.Italic) { cssString += "\tfont-style:\t\t\titalic;\n"; } if ((fontStyle & CSSFontStyle.Strikeout) == CSSFontStyle.Strikeout) { cssString += "\ttext-decoration:\tline-through" + ((fontStyle & CSSFontStyle.Underline) == CSSFontStyle.Underline ? ", underline" : "") + ";\n"; } else if ((fontStyle & CSSFontStyle.Underline) == CSSFontStyle.Underline) { cssString += "\ttext-decoration:\tunderline;\n"; } else if ((fontStyle & CSSFontStyle.Regular) == CSSFontStyle.Regular && (fontStyle & CSSFontStyle.None) != CSSFontStyle.None) { cssString += "\ttext-decoration:none;\n"; } if (fontSize > 0) { cssString += "\tfont-size:\t\t\t" + fontSize.ToString() + (fontSizeUnit == FontSizeUnit.Pixel ? "px" : "%") + ";\n"; } if (valign != VerticalAlignment.None) { cssString += "\tvertical-align:\t\t" + valign.ToString().ToLower() + ";\n"; } if (halign != HorizontalAlignment.None) { cssString += "\ttext-align:\t\t\t" + halign.ToString().ToLower() + ";\n"; } foreach (KeyValuePair <string, string> pair in otherElements) { string item = pair.Key + ":"; //[ML-1210] Card Style rendering is slow - this was never visible and only for cosmetic purposes - removed //float width = Graphics.FromImage(new Bitmap(10, 10)).MeasureString(item, new Font("Courier New", 12)).Width; //if (width < 36) // item += "\t\t\t\t\t"; //else if (width < 80) // item += "\t\t\t\t"; //else if (width < 115) // item += "\t\t\t"; //else if (width < 160) // item += "\t\t"; //else // item += "\t"; item += "\t"; if (string.IsNullOrEmpty(basePath)) { cssString += "\t" + item + "\t" + pair.Value + ";\n"; } else { Match m = m_ResourceFinder.Match(pair.Value); if (m.Success) { string url = m.Groups["url"].Value.Trim(new char[] { '"', '\'' }); Uri uri; if (Uri.IsWellFormedUriString(url, UriKind.Absolute)) { uri = new Uri(url); } else { uri = new Uri(new Uri(basePath + "/"), url); } cssString += "\t" + item + pair.Value.Replace(url, uri.AbsoluteUri) + ";\n"; } else { cssString += "\t" + item + pair.Value + ";\n"; } } } cssString += "}\n"; return(cssString); }