Главная страница
Top.Mail.Ru    Яндекс.Метрика
Текущий архив: 2006.06.04;
Скачать: CL | DM;

Вниз

ListBox и фоновый рисунок   Найти похожие ветки 

 
tytus   (2006-04-27 15:12) [0]

Добрый день всем. Вот код моего ЛистБокса, пожалуйста подскажите, как его заставить писать строчки. Картинку он загружает, но перестал рисовать итемы.


 
tytus   (2006-04-27 15:12) [1]

unit BmpListBox;
{$R-,T-,H+,X+}
interface

uses
 Windows, SysUtils, Classes, Controls, StdCtrls,
 Graphics, Messages, ToolWin;

type
 TBmpListBox = class(TListBox)
 private
   { Private declarations }
   FBitMap:TBitMap;
   function GetBitMap:TBitMap;
   procedure SetBitMap(Value:TBitMap);
 protected
   { Protected declarations }
  procedure WndProc(var Message: TMessage);override;

 public
  {  Public declarations }
   constructor Create(AOwner:TComponent);override;
   destructor Destroy;override;
 published
   { Published declarations }
   property BitMap:TBitMap read GetBitMap write SetBitMap;
 end;

procedure Register;

implementation

procedure Register;
begin
 RegisterComponents("MaPage", [TBmpListBox]);
end;

constructor TBmpListBox.Create(AOwner:TComponent);
begin
Inherited Create(AOwner);
FBitMap:=TBitMap.Create;
end;

Destructor TBmpListBox.Destroy;
begin
FBitMap.Dormant;
FBitMap.FreeImage;
FBitMap.Free;
Inherited Destroy;
end;

function TBmpListBox.GetBitMap:TBitMap;
begin
if FBitMap<>nil then Result:=FBitMap
 else
   Result:=nil;
end;

procedure TBmpListBox.SetBitMap(Value:TBitMap);
begin
if Value<>nil then
 FBitMap.Assign(Value)
else if Value<>nil then
begin
 FBitMap.Dormant;
 FBitMap.FreeImage;
 FBitMap.ReleaseHandle;
end;
end;

procedure TBmpListBox.WndProc(var Message:TMessage);
begin
Inherited WndProc(Message);
case Message.Msg of
 WM_PAINT:begin
       if FBitMap<>nil then Canvas.StretchDraw(ClientRect,FBitMap);
     end;
 WM_ERASEBKGND:begin
       if FBitMap<>nil then  Canvas.StretchDraw(ClientRect,FBitMap);
     end;
end;
end;

end.



Страницы: 1 вся ветка

Текущий архив: 2006.06.04;
Скачать: CL | DM;

Наверх




Память: 0.47 MB
Время: 0.042 c
15-1147414464
Ламот
2006-05-12 10:14
2006.06.04
Диспетчер сервера терминалов отображает не всех пользователей


2-1147930384
zorik
2006-05-18 09:33
2006.06.04
TPageControl. Скрыть закладки


2-1148017662
ZV
2006-05-19 09:47
2006.06.04
Save and Load


15-1147087612
Некто_
2006-05-08 15:26
2006.06.04
Аналог TryStrToDate в php


15-1147236828
Ega23
2006-05-10 08:53
2006.06.04
С Днём рождения! 10 мая