A TPanel component that displays a PNG glyph from TImageCollection

Completed Posted 3 years ago Paid on delivery
Completed Paid on delivery

Write in Delphi 10.4 or compatible a TCustomPanel descendant that supports drawing of a PNG glyph inside the panel, with the glyph aligned left within the panel.

The control shall have these custom properties:

ImageCollection : TImageCollection; - Defines the source from which the panel reads the PNG glyph

GlyphName : String; - Defines the name of the image inside TImageCollection that the control draws to its canvas.

GlyphLeftMargin : Integer; - Defines the distance between the left edge of the control and the PNG glyph drawn. For example, if GlyphLeftMargin = 5, there will be empty space of 5 units between the left edge of the control and the left edge of the PNG glyph.

GlyphTopPadding : Integer; - Defines a minimum space required to be empty between the top of the PNG Glyph and the edge of the control.

GlyphResizing : Boolean; - Defines whether the glyph can be resized. Note: If set to true, the resizing shall not ever change the ratio of height and width of the glyph.

The PNG Glyph shall be drawn to the left side of the control, vertically centered.

The control must automatically choose the best size image from the TImageCollection of the matching GlyphName.

For example, should the linked TImageCollection contain picture named "tool_icon" in sizes of 32x32, 48x48, 64x64 and 128x128 pixels, and the size of the control is 100x100, GlyphLeftMargin = 10 and GlyphTopPadding = 5, GlyphResizing = false, the PNG Glyph from TImageCollection named "tool_icon" of size 64x64 will be drawn at position of left 10 pixels and vertically centered. The glyph is not resized, but drawn as it is, in the best matching (largest possible) size, i.e. 64x64.

If in the above case, the GlyphResizing = true and GlyphLeftMargin = 0, then "tool_icon" size 128x128 is selected and resized to be 100x100, filling the entire canvas of the panel.

If in the above case, the GlyphResizing = true and GlyphLeftMargin = 10, then "tool_icon" size 128x128 is selected and resized to be 90x90, and drawn to the canvas vertically centered, 10 units from the left edge of the control.

If in the above case, the GlyphResizing = true and GlyphTopPadding = 5, then "tool_icon" size 128x128 is selected and resized to be 95x95, and drawn to the canvas vertically centered, 0 units from the left edge of the control.

Delphi

Project ID: #28293503

About the project

1 proposal Remote project Active 3 years ago

Awarded to:

(113 Reviews)
5.7