Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > IT форум > Помощь студентам
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 04.12.2010, 14:03   #1
Coyot
 
Регистрация: 04.12.2009
Сообщений: 8
По умолчанию GetWindowLong и SetWindowLong

не получается реализовать эти функции в новом своем компоненте.. можете объяснить почему или как реализовать эти функции.


Сам текст программы:

unit WSVeronica;

interface

uses
SysUtils, Classes, Controls, StdCtrls ,ExtCtrls;

type
TVeronica = class(TButton)
private
{ Private declarations }
protected

{ Protected declarations }
public
{ Public declarations }
cchecked:Boolean;
Button1:TButton;
CCaption:TCaption;
CWidth:integer;
CHeight:integer;
CClick:TNotifyEvent;
procedure Button1Click(Sender: TObject; Button: TMouseButton;Shift: TShiftState; X, Y: Integer);
constructor create(AOwner:TComponent);override;
destructor destroy;override;
published
{ Published declarations }
procedure SetClick(newEvent:TNotifyEvent);
procedure SetCaption(NewCaption:TCaption);
procedure SetWidth(Newi:integer);
procedure SetHeight(Newi:integer);
property caption read CCaption write SetCaption;
property ComWidth:integer read cwidth write SetWidth;
property ComHeight:integer read cheight write SetHeight;
property top;
property left;
property OnCLick read CClick write SetClick;
end;

procedure Register;

implementation
var
o: integer;
t: integer;

constructor TVeronica.Create(AOwner:TComponent) ;
begin
inherited Create(AOwner);
Caption:='';
CWidth:=75;
CHeight:=25;
Height:=CHeight;
Width:=Cwidth;
Button1:=TButton.Create(self);
Button1.Parent:=self;
Button1.Width:=75;
Button1.Height:=25;
Button1.Top:=top;
Button1.Left:=left;
Button1.OnMouseDown:=Button1Click;
Button1.Caption:='';
end;
///////////
destructor TVeronica.destroy;
begin
inherited;
end;
///////////
procedure TVeronica.SetCaption(NewCaption:TCa ption);
var
i,j: integer;
s,c: string[255];
begin
CCaption:=NewCaption;
i := GetWindowLong(Button1.Handle, GWL_STYLE);

SetWindowLong(Button1.Handle, GWL_STYLE, i or BS_MULTILINE);


S:=Newcaption;
for j:=1 to length(S) do begin
C[j]:=S[j];
if S[j]=' ' then begin C[j+1]:=#13#10 end; end;
Button1.Caption:=S;

end;
Coyot вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
GetWindowLong, GWL_SETYLE что такое? Dimarik Win Api 4 16.10.2009 01:53
Вопрос про SetWindowLong() yngwie Win Api 2 03.04.2009 11:55