public ImageDetailedKineticListView() : base(KineticControlScrollType.Vertical, new KineticControlsSetting { //PrimaryTextFontGdi = FontCache.CreateFont("Calibri", 12, FontStyle.Bold, true), //SecondaryTextFontGdi = FontCache.CreateFont("Calibri", 11, FontStyle.Regular, true), //ThirdTextFontGdi = FontCache.CreateFont("Calibri", 11, FontStyle.Regular, true), TextPixMargin = 0, ListItemPixSize = 10, }) { ShowGroupHeader = true; ShowScrollbar = true; _priFont = FontCache.CreateFont("Calibri", 12, FontStyle.Bold, true); _secFont = FontCache.CreateFont("Calibri", 11, FontStyle.Regular, true); // PrimaryTextFontGdi = FontCache.CreateFont("Calibri", 12, FontStyle.Bold, true), //SecondaryTextFontGdi = FontCache.CreateFont("Calibri", 11, FontStyle.Regular, true), //ThirdTextFontGdi = FontCache.CreateFont("Calibri", 11, FontStyle.Regular, true), }
protected override void OnRender(Gdi graphics, Rectangle clipRect) { if (_leftPart != null && _rightPart != null && _centerPart != null) { var rect = new Rectangle(clipRect.Left + _leftPartSize.Width, clipRect.Top, clipRect.Width - _rightPartSize.Width - _leftPartSize.Width, clipRect.Height); if (!_pressed) { graphics.DrawImageAlphaChannel(_leftPart, clipRect.Left, clipRect.Top); graphics.DrawImageAlphaChannel(_rightPart, rect.Right, clipRect.Top); graphics.DrawImageAlphaChannel(_centerPart, rect); } else { graphics.DrawImageAlphaChannel(_leftPartPressed, clipRect.Left, clipRect.Top); graphics.DrawImageAlphaChannel(_rightPartPressed, rect.Right, clipRect.Top); graphics.DrawImageAlphaChannel(_centerPartPressed, rect); } if (!string.IsNullOrEmpty(Text)) { FontGdi font = Font; if (_pressed) { font = PressedFont; } /*else if (_selected) * font = SelectedFont;*/ Color color = FontColor; if (_pressed) { color = PressedFontColor; } /*else if (_selected) * color = SelectedFontColor;*/ graphics.Font = font; graphics.TextColor = color; Size textSize = graphics.GetTextExtent(Text); int topAdjust = 0; switch (VerticalTextAlignment) { case VerticalAlignment.Top: topAdjust = 0 + _verticalTextMargin; break; case VerticalAlignment.Bottom: topAdjust = Height - textSize.Height - _verticalTextMargin; break; case VerticalAlignment.Center: topAdjust = (Height - textSize.Height) / 2; break; } if (_dropShadow && !_pressed) { graphics.TextColor = FontColorShadow; graphics.ExtTextOut(clipRect.Left + (clipRect.Width - textSize.Width) / 2 + UISettings.CalcPix(1), clipRect.Top + topAdjust + UISettings.CalcPix(1), textSize.Width, Text); } graphics.TextColor = color; graphics.ExtTextOut(clipRect.Left + (clipRect.Width - textSize.Width) / 2, clipRect.Top + topAdjust, textSize.Width, Text); } } }
public UILabel(string text, FontGdi font, Thickness margin) : this(text, font) { Margin = margin; }
public UILabel(string text, FontGdi font, Thickness margin, Color foreColor) : this(text, font, margin) { ForeColor = foreColor; }
public UILabel(string text, FontGdi font) : this(text) { Font = font; }
protected override void OnRender(Gdi gMem, Rectangle clipRect) { switch (Style) { case ButtonStyle.AlphaChannel: IImage img1 = null; if (_selected && !_pressed) { img1 = TransparentButtonSelected; } if (_pressed || (_selected && img1 == null)) { img1 = TransparentButtonPressed; } if (!_pressed && !_selected) { img1 = TransparentButton; } if (img1 != null) { gMem.DrawImageAlphaChannel(img1, clipRect); } break; case ButtonStyle.TransparentBackground: ImageData img2 = null; if (_selected && !_pressed) { img2 = ButtonSelected; } if (_pressed || (_selected && img2 == null)) { img2 = ButtonPressed; } if (!_pressed && !_selected) { img2 = Button; } if (img2 != null) { int imgWidth = img2.ImageSize.Width; int imgHeight = img2.ImageSize.Height; gMem.TransparentImage(clipRect.Left, clipRect.Top, clipRect.Width, clipRect.Height, img2.ImageHandle, img2.ImageOffset.X, img2.ImageOffset.Y, imgWidth, imgHeight, img2.TransparentColor); } break; default: if (_pressed || _selected) { gMem.FillRect(clipRect, BackColor); } else { gMem.FillRect(clipRect, ForeColor); } break; } if (!string.IsNullOrEmpty(Text)) { FontGdi font = Font; if (_pressed) { font = PressedFont; } else if (_selected) { font = SelectedFont; } Color color = FontColor; if (_pressed) { color = PressedFontColor; } else if (_selected) { color = SelectedFontColor; } gMem.Font = font; gMem.TextColor = color; Size textSize = gMem.GetTextExtent(Text); int topAdjust = 0; switch (VerticalTextAlignment) { case VerticalAlignment.Top: topAdjust = 0 + _verticalTextMargin; break; case VerticalAlignment.Bottom: topAdjust = Height - textSize.Height - _verticalTextMargin; break; case VerticalAlignment.Center: topAdjust = (Height - textSize.Height) / 2; break; } gMem.ExtTextOut(clipRect.Left + (clipRect.Width - textSize.Width) / 2, clipRect.Top + topAdjust, textSize.Width, Text); } }