怎样让edit中的内容右对齐或居中? 怎样让edit中的内容右对齐或居中? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_CENTER);SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_RIGHT);看以前的帖子http://expert.csdn.net/Expert/topic/2067/2067579.xml?temp=8.785647E-02 firetoucher(风焱)的方法好!我用了! 继承TEdit,重载CreateParams,修改Param即可。 procedure TEdit_Ex.CreateParams(var Params: TCreateParams); begin inherited; if self.FTextOnRight then Params.Style:=Params.Style or ES_RIGHT; end; firetoucher(风焱)的方法在我这里没有效果。环境:win2k+d6 我看帮助上面明明写着有的,为什么delphi6里没有 --------------------------------------------------------------- 其实可以自己做一个,我给你个吧,接着…………:) //---------------------------------------------------- unit WCAlignEdit; interface uses Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TWCAlignEdit = class(TEdit) private { Private declarations } FAlignment : TAlignment; protected { Protected declarations } procedure SetAlignment(Value: TAlignment); public { Public declarations } procedure CreateParams(var Params : TCreateParams); override; published { Published declarations } property Alignment: TAlignment read FAlignment write SetAlignment default taLeftJustify; end; procedure Register; implementation procedure Register; begin RegisterComponents('Samples', [TWCAlignEdit]); end; procedure TWCAlignEdit.CreateParams(var Params : TCreateParams); begin inherited CreateParams(Params); case FAlignment of taRightjustify: params.style := params.style or es_right; taLeftjustify : params.style := params.style or es_left; taCenter : params.style := params.style or es_center; end; end; procedure TWCAlignEdit.SetAlignment; begin if FAlignment <> Value then begin FAlignment := Value; RecreateWnd; end; end; end. 我的win2000+dephi6用firetoucher(风焱)的方法也不行,是不是我的系统或是dephi有问题呢? SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_CENTER);Edit1.Refresh;SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_RIGHT);Edit1.Refresh;————————————————————————————————————宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。———————————————————————————————————— lxpbuaa(桂枝香在故国晚秋) 方法好像不可行 我有控件楼主要不要,if You want then Send me! 中文软件在英文系统编码问题 fastreport 问题 个人信息卡 行数固定 打印两页 主从表 从表第一页有部分,第二页有一部分 select * from '的问题 全局变量声明引用 在DELPHI中怎么从EXCEL中批量提取数据? 怎样在dll中定义全局变量? 简单打印可总报错 请教关于Delphi程序中图象的问题???急 打印预览窗口的OnClose事件怎么不能响应啊? 老调重弹:PARADOX数据表的密码忘记了,怎么打开? 如何继承现有的fcOutlookbar控件生成ocx控件? 谁有超市收银系统的简单程序啊
SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_RIGHT);看以前的帖子
http://expert.csdn.net/Expert/topic/2067/2067579.xml?temp=8.785647E-02
procedure TEdit_Ex.CreateParams(var Params: TCreateParams);
begin
inherited;
if self.FTextOnRight then Params.Style:=Params.Style or ES_RIGHT;
end;
---------------------------------------------------------------
其实可以自己做一个,我给你个吧,接着…………:)
//----------------------------------------------------
unit WCAlignEdit;
interface
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls;
type
TWCAlignEdit = class(TEdit)
private
{ Private declarations }
FAlignment : TAlignment;
protected
{ Protected declarations }
procedure SetAlignment(Value: TAlignment);
public
{ Public declarations }
procedure CreateParams(var Params : TCreateParams); override;
published
{ Published declarations }
property Alignment: TAlignment read FAlignment write SetAlignment
default taLeftJustify;
end;
procedure Register;
implementation
procedure Register;
begin
RegisterComponents('Samples', [TWCAlignEdit]);
end;
procedure TWCAlignEdit.CreateParams(var Params : TCreateParams);
begin
inherited CreateParams(Params);
case FAlignment of
taRightjustify: params.style := params.style or es_right;
taLeftjustify : params.style := params.style or es_left;
taCenter : params.style := params.style or es_center;
end;
end;
procedure TWCAlignEdit.SetAlignment;
begin
if FAlignment <> Value then
begin
FAlignment := Value;
RecreateWnd;
end;
end;
end.
Edit1.Refresh;
SetWindowLong(Edit1.handle, GWL_STYLE,GetWindowlong(edit1.Handle, GWL_STYLE) +ES_RIGHT);
Edit1.Refresh;————————————————————————————————————
宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
————————————————————————————————————
方法好像不可行
if You want then
Send me!