= SliderCount) then exit;
with Sliders[Index] do
begin
if style=''''H'''' then begin //水平
n := Trunc(Offset*(max-Slider.Width-min))+min;
if n < min then n := min;
if n > max then n := max;
Slider.Left := n;
FSliderPosition := Trunc((n)/(max-Slider.Width-min)*100);
end else begin //
n := Trunc(Offset*(max-Slider.Height-min))+min;
if n < min then n := min;
if n > max then n := max;
Slider.top := n;
FSliderPosition := Trunc((n)/(max-Slider.Height-min)*100);
end;
end;
Result := True;
end;
//得到 Slider 的位置.
function TSkin.SliderPositon(Index : Integer) : Integer;
begin
Result := 0;
if (Index > SliderCount) then exit;
with Sliders[Index] do
if style=''''H'''' then
FSliderPosition := Trunc((Slider.Left-min)/(max-Slider.Width-min)*100)
else
FSliderPosition := Trunc((Slider.top-min)/(max-Slider.height-min)*100);
Result := FSliderPosition;
end;
//设置文本显示.
function TSkin.SetText(Index : Integer; Str : String) : Boolean;
begin
Result := False;
if (Index >= TextCount) then Exit;
Texts[Index].EText.Hint:=Str; //暂存当前文字.
with Texts[Index].EText.Canvas do
TextRect(ClipRect,0,0,Str);
if Index=0 then FText1Text := Str;
//得到 Text1.text 的文本,由于滚动显示.
Result := True; //刷新时有闪烁现象出现 !!!
end;
{实现异型窗体.}
function TSkin.CreateRegion(wMask:TBitmap;wColor:TColor;hControl:THandle): HRGN;
var
dc, dc_c: HDC;
rgn: HRGN;
x, y: integer;
coord: TPoint;
line: boolean;
color: TColor;
begin
dc := GetWindowDC(hControl);
dc_c := CreateCompatibleDC(dc);
SelectObject(dc_c, wMask.Handle);
BeginPath(dc);
for x:=0 to wMask.Width-1 do
begin
line := false;
for y:=0 to wMask.Height-1 do
begin
color := GetPixel(dc_c, x, y);
if not (color = wColor) then
begin
if not line then
begin
line := true;
coord.x := x;
coord.y := y;
end;
end;
if (color = wColor) or (y=wMask.Height-1) then
begin
if line then
begin
line := false;
MoveToEx(dc, coord.x, coord.y, nil);
LineTo(dc, coord.x, y);
LineTo(dc, coord.x + 1, y);
LineTo(dc, coord.x + 1, coord.y);
CloseFigure(dc);
end;
end;
end;
end;
EndPath(dc);
rgn := PathToRegion(dc);
ReleaseDC(hControl, dc);
Result := rgn;
end;
end.