Guest:
Register
|
Login
|
Member List
|
Search
|
Statistics
|
FAQ
Language
----------
Simplifed Chinese
Traditional Chinese
English
CnPack Forum
»
CnVCL 组件包
» TCnButtonEdit 组件的 ButtonVisible 与 Alignment 属性的配合BUG
‹‹ Last Thread
|
Next Thread ››
Poll
Trade
Reward
Activity
Printable Version
|
Email to Friend
|
Subscription
|
Favorites
Subject: TCnButtonEdit 组件的 ButtonVisible 与 Alignment 属性的配合BUG
gaoyanan
(高亚男)
普通灌水员
UID 39457
Digest Posts 0
Credits 62
Posts 22
点点分 62
Reading Access 10
Registered 2008-4-1
Status Offline
#1
Post at 2010-10-20 13:15
Profile
|
Blog
|
P.M.
|
TCnButtonEdit 组件的 ButtonVisible 与 Alignment 属性的配合BUG
如题!
当:
ButtonVisible := False;
Alignment := taRightJustify;
嘿嘿,文字少了3个半。
我看了一下代码:
procedure TCnButtonEdit.UpdateFormatRect;
var
Rect: TRect;
begin
Rect := ClientRect;
if FButtonVisible then
Dec(Rect.Right, FButton.Height)
else
Inc(Rect.Right, FButton.Height);
SendMessage(Handle, EM_SETRECTNP, 0, Longint(@Rect));
end;
当然,很多地方都调用了这个方法,对于
EM_SETRECTNP
消息我不是很熟悉,我查看了一下Raize Components的TRzButtonEdit,他的实现方式类似:
protected
procedure SetEditRect; virtual;
procedure TGcxCustomEdit.SetEditRect;
begin
if (Handle = 0) or (not Assigned(Self.Parent)) then
Exit;
SendMessage(Handle, EM_SetMargins, EC_LeftMargin, MakeLong(FMargin, 0));
SendMessage(Handle, EM_SetMargins, EC_RightMargin, MakeLong(0, FMargin));
end;
然后
然后覆盖CreateWnd方法。
procedure TGcxCustomEdit.CreateWnd;
begin
inherited;
SetEditRect;
end;
最近在写组件玩,刚好写到Margin属性,互相参考学习一下。
没有尝试修改CnButtonEdit文件,所以也没法做确切的修正,请版主及模块所有者参考下帖修正:
http://gaoyanan.blog.sohu.com/161260637.html
Poll
Trade
Reward
Activity
CnPack Forum
CnPack English Forum
> CnWizards IDE Wizards
> CVSTracNT
> Announcements & Others
All times are GMT++8, the time now is 2024-11-22 12:27
Powered by
Discuz!
5.0.0
© 2001-2006
Comsenz Inc.
Processed in 0.008797 second(s), 9 queries , Gzip enabled
TOP
Clear Cookies
-
Contact Us
-
CnPack Website
-
Archiver
-
WAP
Member's CP Home
Edit Profile
Credits Transaction
Public User Groups
Buddy List
Main
Page Views
User Agents
Posts History
Top Forums
Top Threads
Post Ranking
Credit Ranking
Online Time
Team
Moderation Stats