TSkin

Fuente: source/classes/skin.prg

Inherits from: TControl

TSkin applies a custom bitmap-based skin to a window, replacing the standard Windows title bar, borders and caption buttons with styled images. It loads 11 component bitmaps from a skin folder (corner pieces, edge tiles, close/maximize/minimize buttons) and handles hit-testing, window dragging and resizing. A convenience function SKIN() provides one-line activation.

Key DATA Members

DATATypeDescription
aBmpArrayArray of 11 TBitmap objects forming the skin: corners (1-3,5-7), edges (4,8), buttons (9-11)
cSkinCharacterPath to the skin folder containing w01-w12, close, max, min .bmp files
nTransNumericWindow transparency level (0-255)
lReSizeLogicalEnable window resizing by dragging skin edges/corners
nTextColorNumericColor of the title bar text

Methods

MethodDescription
New( oWnd, cSkin, nTrans, lReSize, nTextColor, nTextTop )Create a skin overlay. Loads all 11 bitmap components from the skin folder
Update()Reposition and redraw all skin elements to match the current window size and position
Position( oBmp, nTop, nLeft, nWidth, nHeight )Position a skin bitmap at the given coordinates and dimensions
Transparent( nTrans )Adjust the transparency level of the skin
End()Clean up and remove the skin

SKIN() Function

SyntaxDescription
SKIN( oWnd, cSkinFolder )Free function that creates a TSkin instance attached to the given window

Example: Apply Custom Skin to Window

#include "FiveWin.ch"

function Main()

   local oWnd

   DEFINE WINDOW oWnd TITLE "Skinned Window" SIZE 600, 400

   SKIN( oWnd, "c:\skins\mySkin\" )

   ACTIVATE WINDOW oWnd CENTERED

return nil

Notes

Ver También