📄 sedit.pas
字号:
{$IFDEF LOGGED}
AddToLog(Message);
{$ENDIF}
if Message.Msg = SM_ALPHACMD then case Message.WParamHi of
AC_CTRLHANDLED : begin Message.LParam := 1; Exit end; // AlphaSkins supported
AC_GETAPPLICATION : begin Message.Result := longint(Application); Exit end;
AC_REMOVESKIN : if LongWord(Message.LParam) = LongWord(SkinData.SkinManager) then begin
CommonWndProc(Message, FCommonData);
exit
end;
AC_REFRESH : if (LongWord(Message.LParam) = LongWord(SkinData.SkinManager)) then begin
CommonWndProc(Message, FCommonData);
if FCommonData.Skinned then begin
end;
Repaint;
exit
end;
AC_SETNEWSKIN : if (LongWord(Message.LParam) = LongWord(SkinData.SkinManager)) then begin
CommonWndProc(Message, FCommonData);
exit
end;
AC_CHILDCHANGED : begin
Message.LParam := 0; // Internal buttons not required in the repainting
Exit;
end;
end;
if not ControlIsReady(Self) or not FCommonData.Skinned then inherited else begin
case Message.Msg of
WM_ERASEBKGND, CN_DRAWITEM : Exit;
WM_NCPAINT : begin
PaintBorder;
Exit;
end;
WM_PAINT : begin
FCommonData.Updating := FCommonData.Updating;
if FCommonData.Updating then begin // Exit if parent is not ready yet
BeginPaint(Handle, PS);
EndPaint(Handle, PS);
Exit;
end;
if ControlIsActive(FCommonData) then begin
if not FCommonData.CustomColor and (Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotColor) then Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotColor;
if not FCommonData.CustomFont and (Font.Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotFontColor[1]) then Font.Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].HotFontColor[1];
end
else begin
if not FCommonData.CustomColor and (Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].Color) then Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].Color;
if not FCommonData.CustomFont and (Font.Color <> FCommonData.SkinManager.gd[FCommonData.SkinIndex].FontColor[1]) then Font.Color := FCommonData.SkinManager.gd[FCommonData.SkinIndex].FontColor[1];
end;
inherited;
exit;
end;
WM_PRINT : begin
try
SkinData.Updating := False;
DC := TWMPaint(Message).DC;
PrepareCache;
UpdateCorners(SkinData, 0);
try
bw := integer(BorderStyle <> bsNone) * (1 + integer(Ctl3d));
BitBltBorder(DC, 0, 0, SkinData.FCacheBmp.Width, SkinData.FCacheBmp.Height, SkinData.FCacheBmp.Canvas.Handle, 0, 0, bw);
OurPaintHandler(DC);
MoveWindowOrg(DC, bw, bw);
IntersectClipRect(DC, 0, 0,
SkinData.FCacheBmp.Width - 2 * bw,
SkinData.FCacheBmp.Height - 2 * bw);
finally
end;
except
end;
end;
CM_COLORCHANGED: if FCommonData.CustomColor then FCommonData.BGChanged := True; // v4.43
end;
CommonWndProc(Message, FCommonData);
inherited;
if Message.Msg = SM_ALPHACMD then case Message.WParamHi of
AC_ENDPARENTUPDATE : if FCommonData.Updating then begin
FCommonData.Updating := False;
Repaint;
SendMessage(Handle, WM_NCPAINT, 0, 0);
end;
AC_URGENTPAINT : begin // v4.08
if FCommonData.UrgentPainting then PrepareCache;
end;
end
else case Message.Msg of
WM_KILLFOCUS, CM_EXIT: begin
FCommonData.FFocused := False;
FCommonData.FMouseAbove := False;
FCommonData.BGChanged := True;
if Visible then Repaint;
end;
WM_SETTEXT{v4.09}, CM_TEXTCHANGED, CM_VISIBLECHANGED, CM_ENABLEDCHANGED, WM_SETFONT : if not (csLoading in ComponentState) then begin
FCommonData.Invalidate;
SendMessage(Handle, WM_NCPAINT, 0, 0);
end;
WM_SIZE : begin
SendMessage(Handle, WM_NCPAINT, 0, 0);
end;
end;
end;
// Aligning of the bound label
if Assigned(BoundLabel) and Assigned(BoundLabel.FtheLabel) then case Message.Msg of
WM_SIZE, WM_WINDOWPOSCHANGED : begin BoundLabel.AlignLabel end;
CM_VISIBLECHANGED : begin BoundLabel.FtheLabel.Visible := Visible; BoundLabel.AlignLabel end;
CM_ENABLEDCHANGED : begin BoundLabel.FtheLabel.Enabled := Enabled; BoundLabel.AlignLabel end;
CM_BIDIMODECHANGED : begin BoundLabel.FtheLabel.BiDiMode := BiDiMode; BoundLabel.AlignLabel end;
end;
end;
procedure TsEdit.CreateParams(var Params: TCreateParams);
begin
inherited;
// Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
end;
{
procedure TsEdit.CNCtlColorEdit(var Message: TWMCTLCOLOREDIT);
begin
with Message do begin
SetBkMode(ChildDC, Windows.Transparent);
SetTextColor(ChildDC, Font.Color);
Result := GetStockObject(NULL_BRUSH);
end
end;
procedure TsEdit.CNCtlColorStatic(var Message: TWMCTLCOLORSTATIC);
begin
with Message do begin
SetBkMode(ChildDC, Windows.Transparent);
SetTextColor(ChildDC, Font.Color);
Result := GetStockObject(NULL_BRUSH);
end
end;
}
{$IFDEF TNTUNICODE}
procedure TsEdit.ActionChange(Sender: TObject; CheckDefaults: Boolean);
begin
TntControl_BeforeInherited_ActionChange(Self, Sender, CheckDefaults);
inherited;
end;
procedure TsEdit.CreateWindowHandle(const Params: TCreateParams);
begin
TntCustomEdit_CreateWindowHandle(Self, Params);
end;
procedure TsEdit.CreateWnd;
begin
inherited;
TntCustomEdit_AfterInherited_CreateWnd(Self, FPasswordChar);
end;
procedure TsEdit.DefineProperties(Filer: TFiler);
begin
inherited;
TntPersistent_AfterInherited_DefineProperties(Filer, Self);
end;
function TsEdit.GetActionLinkClass: TControlActionLinkClass;
begin
Result := TntControl_GetActionLinkClass(Self, inherited GetActionLinkClass);
end;
function TsEdit.GetHint: WideString;
begin
Result := TntControl_GetHint(Self)
end;
function TsEdit.GetPasswordChar: WideChar;
begin
Result := TntCustomEdit_GetPasswordChar(Self, FPasswordChar);
end;
function TsEdit.GetSelLength: Integer;
begin
Result := TntCustomEdit_GetSelLength(Self);
end;
function TsEdit.GetSelStart: Integer;
begin
Result := TntCustomEdit_GetSelStart(Self);
end;
function TsEdit.GetSelText: WideString;
begin
Result := TntCustomEdit_GetSelText(Self);
end;
function TsEdit.GetText: WideString;
begin
Result := TntControl_GetText(Self);
end;
function TsEdit.IsHintStored: Boolean;
begin
Result := TntControl_IsHintStored(Self);
end;
procedure TsEdit.SetHint(const Value: WideString);
begin
TntControl_SetHint(Self, Value);
end;
procedure TsEdit.SetPasswordChar(const Value: WideChar);
begin
TntCustomEdit_SetPasswordChar(Self, FPasswordChar, Value);
end;
procedure TsEdit.SetSelLength(const Value: Integer);
begin
TntCustomEdit_SetSelLength(Self, Value);
end;
procedure TsEdit.SetSelStart(const Value: Integer);
begin
TntCustomEdit_SetSelStart(Self, Value);
end;
procedure TsEdit.SetSelText(const Value: WideString);
begin
TntCustomEdit_SetSelText(Self, Value);
end;
procedure TsEdit.SetText(const Value: WideString);
begin
TntControl_SetText(Self, Value);
end;
{$ENDIF}
end.
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -