TEdit的Ctl3D属性指定为False后,Edit的边框变为黑色,这是在哪里实现的
解决方案 »
- 如何能实现可以把文件拖放到ShellListView中?
- 【delphi5 Edit 显示小数的问题!!!】
- 关于文本框的小问题,请各位大侠帮帮我!
- 窗体在游戏里弹出,不失真!如何做!快快快!
- 谁有可垂直居中的QRLabel?
- 关于设计模式的问题
- 请大家帮帮我。做完马上给分
- 强烈要求斑竹写个程序!!!!!!我送斑竹1000分,
- 大家注意:有人叫你登入http://go6.163.com/disparity千万不要信 这是个木马程序!...请高手们想办法扫除这些害虫呀!!!!
- 如果C#胜于Delphi and 很多人准备转向C#,我就抛弃它
- 保存图片到SQL Server数据库中
- 请大家看下invalid floating point operation原因
Ctl3D属性应该是从TCustomEdit这来的
当修改Ctl3D的属性的时候就会触发CM_CTL3DCHANGED这个消息
然后再procedure TCustomEdit.CMCtl3DChanged(var Message: TMessage);
响应过程中处理,主要就是UpdateHeight和RecreateWnd这两个过程
具体的可以看看不得闲大牛的博客:
http://www.cnblogs.com/DxSoft/archive/2010/04/30/1724809.html
StdCtrls.pas
procedure TCustomEdit.CMCtl3DChanged(var Message: TMessage);
begin
if NewStyleControls and (FBorderStyle = bsSingle) then
begin
UpdateHeight;
RecreateWnd;
end;
inherited;
end;procedure TCustomEdit.UpdateHeight;
begin
if FAutoSize and (BorderStyle = bsSingle) then
begin
ControlStyle := ControlStyle + [csFixedHeight];
AdjustHeight;
end else
ControlStyle := ControlStyle - [csFixedHeight];
end;Controls.pas
procedure TWinControl.RecreateWnd;
begin
if WindowHandle <> 0 then Perform(CM_RECREATEWND, 0, 0);
end;
procedure TCustomEdit.CreateParams(var Params: TCreateParams);
const
Passwords: array[Boolean] of DWORD = (0, ES_PASSWORD);
ReadOnlys: array[Boolean] of DWORD = (0, ES_READONLY);
CharCases: array[TEditCharCase] of DWORD = (0, ES_UPPERCASE, ES_LOWERCASE);
HideSelections: array[Boolean] of DWORD = (ES_NOHIDESEL, 0);
OEMConverts: array[Boolean] of DWORD = (0, ES_OEMCONVERT);
begin
inherited CreateParams(Params);
CreateSubClass(Params, 'EDIT');
with Params do
begin
Style := Style or (ES_AUTOHSCROLL or ES_AUTOVSCROLL) or
BorderStyles[FBorderStyle] or Passwords[FPasswordChar <> #0] or
ReadOnlys[FReadOnly] or CharCases[FCharCase] or
HideSelections[FHideSelection] or OEMConverts[FOEMConvert];//设置它的风格
if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then
begin//如果是Ctl3D才会执行
Style := Style and not WS_BORDER;
ExStyle := ExStyle or WS_EX_CLIENTEDGE;
end;
end;
end;
这恐怕正是你想找的地方了吧?
// if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then
把 StdCtrls.dcu 改个名字,让系统自己重新编译过它以后,那么,你就再无法令“TEdit的Ctl3D属性指定为False后,Edit的边框变为黑色”了。所以,说明StdCtrls单元的TCustomEdit.CreateParams 里面,正是“实现的地方”。