📄 dialogstaticcontrols.pas
字号:
SS_WHITERECT, SS_WHITEFRAME : result := 2;
SS_ETCHEDFRAME : result := 3;
end;
1 : if IsGraphicControl then
if fTitleSzOrID.isID then
result := IntToStr (fTitleSzOrID.ID)
else
result := fTitleSzOrID.sz;
2 :
if tp in [SS_BLACKFRAME, SS_GRAYFRAME, SS_WHITEFRAME, SS_ETCHEDFRAME] then
result := 0
else
if tp in [SS_BLACKRECT, SS_GRAYRECT, SS_WHITERECT] then
result := 1
else
if tp = SS_ICON then
result := 2
else
if tp = SS_BITMAP then
result := 3
else
if tp = SS_ENHMETAFILE then
result := 4
else
result := 0
end
end;
pkStyle :
case idx of
0 : if GetPropertyValue (pkGeneral, inherited GetPropertyCount (pkGeneral) + 2) < 2 then
Result := Unassigned
else
begin
s := Style and SS_CENTERIMAGE or SS_REALSIZEIMAGE or SS_REALSIZECONTROL;
if (s and SS_CENTERIMAGE) <> 0 then
Result := 1
else
if (s and SS_REALSIZEIMAGE) <> 0 then
Result := 2
else
if (s and SS_REALSIZECONTROL) <> 0 then
Result := 3
else
Result := 0
end;
1 : if GetPropertyValue (pkGeneral, inherited GetPropertyCount (pkGeneral) + 2) < 2 then
Result := Unassigned
else
Result := HasStyle [SS_RIGHTJUST];
end
end
end
end;
procedure TPictureControlInfo.SetPropertyValue(kind: TPropertyKind;
idx: Integer; const Value: Variant);
var
tp : Integer;
colorIdx : Integer;
isFrame : boolean;
frameChanged, recreateRequired : Boolean;
begin
frameChanged := False;
recreateRequired := False;
if idx < inherited GetPropertyCount (kind) then
inherited SetPropertyValue (kind, idx, Value)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
case kind of
pkGeneral :
begin
frameChanged := True;
tp := style and SS_TYPEMASK;
isFrame := tp in [SS_BLACKFRAME, SS_GRAYFRAME, SS_WHITEFRAME, SS_ETCHEDFRAME];
if tp in [SS_BLACKFRAME, SS_BLACKRECT] then
colorIdx := 0
else
if tp in [SS_GRAYFRAME, SS_GRAYRECT] then
colorIdx := 1
else
if tp in [SS_WHITEFRAME, SS_WHITERECT] then
colorIdx := 2
else
colorIdx := -1;
case idx of
0 : case value of
0 : if isFrame then SetMaskedStyle (SS_BLACKFRAME, SS_TYPEMASK) else SetMaskedStyle (SS_BLACKRECT, SS_TYPEMASK);
1 : if isFrame then SetMaskedStyle (SS_GRAYFRAME, SS_TYPEMASK) else SetMaskedStyle (SS_GRAYRECT, SS_TYPEMASK);
2 : if isFrame then SetMaskedStyle (SS_WHITEFRAME, SS_TYPEMASK) else SetMaskedStyle (SS_WHITERECT, SS_TYPEMASK);
3 : SetMaskedStyle (SS_ETCHEDFRAME, SS_TYPEMASK);
end;
1 : begin
fTitleSzOrID := StringtoSzOrID (value);
recreateRequired := True
end;
2 : case value of
0 : case colorIdx of
0 : SetMaskedStyle (SS_BLACKFRAME, SS_TYPEMASK);
1 : SetMaskedStyle (SS_GRAYFRAME, SS_TYPEMASK);
2 : SetMaskedStyle (SS_WHITEFRAME, SS_TYPEMASK);
else
SetMaskedStyle (SS_ETCHEDFRAME, SS_TYPEMASK)
end;
1 : case colorIdx of
0 : SetMaskedStyle (SS_BLACKRECT, SS_TYPEMASK);
1 : SetMaskedStyle (SS_GRAYRECT, SS_TYPEMASK);
2 : SetMaskedStyle (SS_WHITERECT, SS_TYPEMASK);
else
SetMaskedStyle (SS_BLACKRECT, SS_TYPEMASK);
end;
2 : begin
SetMaskedStyle (SS_ICON, SS_TYPEMASK);
recreateRequired := True;
end;
3 : begin
SetMaskedStyle (SS_BITMAP, SS_TYPEMASK);
recreateRequired := True;
end;
4 : begin
SetMaskedStyle (SS_ENHMETAFILE, SS_TYPEMASK);
recreateRequired := True;
end;
end
end
end;
pkStyle:
begin
case idx of
0 :
begin
case value of
0 : SetMaskedStyle (0, SS_CENTERIMAGE or SS_REALSIZEIMAGE or SS_REALSIZECONTROL);
1 : SetMaskedStyle (SS_CENTERIMAGE, SS_CENTERIMAGE or SS_REALSIZEIMAGE or SS_REALSIZECONTROL);
2 : SetMaskedStyle (SS_REALSIZEIMAGE, SS_CENTERIMAGE or SS_REALSIZEIMAGE or SS_REALSIZECONTROL);
3 : SetMaskedStyle (SS_REALSIZECONTROL, SS_CENTERIMAGE or SS_REALSIZEIMAGE or SS_REALSIZECONTROL)
end
end;
1 :
HasStyle [SS_RIGHTJUST] := Value
end;
recreateRequired := True
end;
end;
DoPropertyChange
end;
if frameChanged then
SetWindowPos(ControlHandle, 0, 0, 0, 0, 0, SWP_FRAMECHANGED or SWP_NOACTIVATE or SWP_NOMOVE or SWP_NOSIZE or SWP_NOZORDER);
if recreateRequired then
RecreateWnd
end;
{ TCaptionedStaticControlInfo }
function TCaptionedStaticControlInfo.GetPropertyCount(
kind: TPropertyKind): Integer;
begin
Result := inherited GetPropertyCount (kind) + CaptionedStaticControlPropertyCount [kind]
end;
function TCaptionedStaticControlInfo.GetPropertyEnumCount(
kind: TPropertyKind; idx: Integer): Integer;
begin
if idx < inherited GetPropertyCount (kind) then
Result := inherited GetPropertyEnumCount (kind, idx)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
Result := 0;
case kind of
pkStyle :
case idx of
0 : Result := 3;
1 : Result := 4
end
end
end
end;
function TCaptionedStaticControlInfo.GetPropertyEnumName(
kind: TPropertyKind; idx, enum: Integer): string;
begin
if idx < inherited GetPropertyCount (kind) then
Result := inherited GetPropertyEnumName (kind, idx, enum)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
Result := '';
case kind of
pkStyle :
case idx of
0 :
case enum of
0 : Result := rstLeft;
1 : Result := rstCenter;
2 : Result := rstRight
end;
1 :
case enum of
0 : Result := rstNone;
1 : Result := rstEndEllipsis;
2 : Result := rstWordEllipsis;
3 : Result := rstPathEllipsis
end
end
end
end
end;
function TCaptionedStaticControlInfo.GetPropertyName(kind: TPropertyKind;
idx: Integer): string;
begin
if idx < inherited GetPropertyCount (kind) then
Result := inherited GetPropertyName (kind, idx)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
Result := '';
case kind of
pkGeneral : Result := CaptionedStaticControlPropertyGeneralName [idx];
pkStyle : Result := CaptionedStaticControlPropertyStyleName [idx];
pkExtended : Result := CaptionedStaticControlPropertyExtendedName [idx];
end
end
end;
function TCaptionedStaticControlInfo.GetPropertyType(kind: TPropertyKind;
idx: Integer): TPropertyType;
begin
if idx < inherited GetPropertyCount (kind) then
Result := inherited GetPropertyType (kind, idx)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
Result := ptInteger;
case kind of
pkGeneral : Result := CaptionedStaticControlPropertyGeneralType [idx];
pkStyle : Result := CaptionedStaticControlPropertyStyleType [idx];
pkExtended : Result := CaptionedStaticControlPropertyExtendedType [idx];
end
end
end;
function TCaptionedStaticControlInfo.GetPropertyValue(kind: TPropertyKind;
idx: Integer): Variant;
begin
if idx < inherited GetPropertyCount (kind) then
Result := inherited GetPropertyValue (kind, idx)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
case kind of
pkGeneral :
case idx of
0 : Result := WindowText;
end;
pkStyle :
case idx of
0 : Result := Style and 3;
1 : case Style and SS_ELLIPSISMASK of
SS_ENDELLIPSIS : Result := 1;
SS_WORDELLIPSIS : Result := 2;
SS_PATHELLIPSIS : Result := 3;
else
Result := 0
end;
2 : Result := HasStyle [SS_CENTERIMAGE];
3 : Result := HasStyle [SS_NOPREFIX];
4 : Result := HasStyle [SS_LEFTNOWORDWRAP];
5 : Result := HasStyle [SS_SIMPLE]
end;
pkExtended:
case idx of
0 : Result := HasExStyle [WS_EX_RTLREADING];
1 : Result := HasExStyle [WS_EX_RIGHT];
end
end
end
end;
procedure TCaptionedStaticControlInfo.SetPropertyValue(kind: TPropertyKind;
idx: Integer; const Value: Variant);
var
s : Integer;
recreateRequired : boolean;
begin
recreateRequired := False;
if idx < inherited GetPropertyCount (kind) then
inherited SetPropertyValue (kind, idx, Value)
else
begin
Dec (idx, inherited GetPropertyCount (kind));
case kind of
pkGeneral :
case idx of
0 : WindowText := Value;
end;
pkStyle :
begin
recreateRequired := True; // Maybe not - but the docs say you should...
case idx of
0 : SetMaskedStyle (Value, 3);
1 :
begin
case Value of
1 : s := SS_ENDELLIPSIS;
2 : s := SS_WORDELLIPSIS;
3 : s := SS_PATHELLIPSIS
else
s := 0;
end;
SetMaskedStyle (s, SS_ELLIPSISMASK)
end;
2 : HasStyle [SS_CENTERIMAGE] := Value;
3 : HasStyle [SS_NOPREFIX] := Value;
4 : HasStyle [SS_LEFTNOWORDWRAP] := Value;
5 : HasStyle [SS_SIMPLE] := Value;
end
end;
pkExtended :
case idx of
0 : HasExStyle [WS_EX_RTLREADING] := Value;
1 : HasExStyle [WS_EX_RIGHT] := Value;
end
end
end;
if recreateRequired then
RecreateWnd
end;
{ TStaticTextControlInfo }
class function TStaticTextControlInfo.GetDescription: string;
begin
Result := rstStaticText;
end;
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -