TMlSkinShape

A shape control for circles, ellipses, rectangles and rounded rectangles, and for arbitrary shapes drawn from an SVG path.

Category
Panels & containers
Unit
uMlSkinShape.pas
Inherits from
TMlSkinCustomShapeTMlSkinCustomControl

Notes

  • Shape picks the shape; for rounded rectangles the radius comes from RoundRadius.
  • The fill is set in Brush, while the outline color, style and width are in Pen.
  • For an irregular shape, put the SVG path data into SvgPath.

Example

From the demo MlSkin.Demo.HtmlLabel&TMlSkinPopupMessage功能演示.v4.x (.dfm form file)

object shp1: TMlSkinShape
  Left = 8
  Top = 10
  Width = 657
  Height = 225
  Shape = skRoundRect
  Brush.Color = 15658734
  Brush.Visible = True
  Pen.Color = 5664760
  Pen.Visible = False
  Pen.Style = psSolid
  Pen.Width = 2
  DoubleBuffered = False
  Anchors = [akLeft, akTop, akRight]
  DesignSize = (
  657
  225)
  ...

Properties 7

NameTypeDefaultDescription
AlphaByte255Opacity: 0 fully transparent, 255 opaque.
ShapeTMlShapeKindskCircleThe shape to draw: circle, ellipse, rectangle, rounded rectangle, rounded square and so on.
BrushTMlBrushFill settings: the fill color and whether it is painted at all (Visible).
PenTMlPenOutline settings: pen style (solid, dotted, dashed), width and color.
RoundRadiusInteger8Corner radius in pixels, used by the rounded shapes.
SvgPathstringSVG path data: fill it in to draw an arbitrary shape from that path.
ColorTColorclWhiteBackground color of the control; ignored while Transparent is on.
Properties of TMlSkinCustomControl 4
NameTypeDefaultDescription
AboutTMlAboutInfoA design-time property: double-clicking it in the Object Inspector opens the MLSkin about box with the component version. It has no effect at run time and is not stored in the .dfm.
TransparentBooleanTrueTransparent background: the control skips its own fill and shows the form background (image or color) instead.
AutoInvalidateBooleanFalseRepaints automatically when the content changes. Turn it on if property changes do not show up.
EraseBackgroundBooleanFalseWhether the background is erased before painting; worth toggling if the control flickers.
Events of TMlSkinCustomControl 4
NameTypeDefaultDescription
OnDPIChangedTMlDPIChangedEventFires when the screen DPI changes, for example when the window moves to a monitor with a different scaling — a good place to re-adjust anything you draw yourself.
OnBackgroundChangingTMlBackgroundEventFires just before the background changes, giving you a chance to adjust what is drawn.
OnBackgroundChangedTMlCustomDrawEventFires after the background has been drawn, so you can paint on top of it.
OnVisibleChangedTNotifyEventFires when the control is shown or hidden.

Only the properties and events MLSkin adds are listed here. Standard VCL properties such as Align, Anchors, Font and OnClick are available too and behave exactly as on the stock controls.

Offline helpA PDF / CHM version is available for offline reading.