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

Вниз

Как выводить пропорциональную картину в DBImage?   Найти похожие ветки 

 
Dimaz-z ©   (2003-10-14 20:33) [0]

Как выводить пропорциональную картину в DBImage? (Вне зависимости от Stretch=True или Fasle) А то картинка (при Stretch = True) растягивается на весь компонент!


 
Dimaz-z ©   (2003-10-14 21:06) [1]

ЭЙ!!!!!


 
me   (2003-10-14 21:16) [2]

Породить от TDBImage новый класс TDBProportionalImage, перекрыть виртуальный метод Paint и в нем сделать примерно такое:
procedure TDBProportionalImage.Paint;
var
W, H : Integer;
ScW, ScH : real;
Dest : TRect;
Palette : THandle;
begin
ScH := Picture.Height / Height;
ScW := Picture.Width / Width;
if (ScH <> 0) and (ScW <> 0) then
begin
if ScW > ScH then
begin
H := Round(Picture.Height / ScW);
SetRect(Dest, 0, (ClientHeight-H) div 2, ClientWidth, (ClientHeight+H) div 2)
end
else
begin
W := Round(Picture.Width / ScH);
SetRect(Dest, (ClientWidth-W) div 2, 0, (ClientWidth+W) div 2, ClientHeight);
end;
end;
with inherited Canvas do
begin
Palette := 0;
FillRect(Rect(0, 0, Width, Height));
try
if Picture.Bitmap.Palette <> 0 then
begin
Palette := SelectPalette(Handle, Picture.Bitmap.Palette, False);
RealizePalette(Handle);
end;
StretchDraw(Dest, Picture.Bitmap);
finally
if Palette <> 0 then SelectPalette(Handle, Palette, True);
end;
end;
end;


 
Dimaz-z ©   (2003-10-14 21:53) [3]

Спасибо!



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

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

Наверх




Память: 0.47 MB
Время: 0.017 c
6-89415
Finger
2003-09-02 12:11
2003.10.27
снифер


7-89622
_man_
2003-08-12 15:30
2003.10.27
Как считать default-значение ключа реестра?


1-89233
mikmik
2003-10-15 13:12
2003.10.27
RAVE


1-89388
BAzul
2003-10-13 09:24
2003.10.27
странный переход по Tab в ActiveX-форме


1-89344
Виталя
2003-10-16 10:24
2003.10.27
Как сделать фон иконки формы прозрачной ?