Главная страница
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.04 c
14-89481
Knight
2003-10-06 23:53
2003.10.27
Первая сотня!!!


14-89492
Мазут Береговой
2003-10-09 01:22
2003.10.27
Сегодня праздник! : Календарь рыболова: Сергии Радонежский


6-89418
Pavel Oliynik
2003-09-02 12:00
2003.10.27
проблема с письмом, скачиваю, неудаляю, а Батом скачать немогу !!


1-89232
Alex_x
2003-10-15 10:14
2003.10.27
Как правильно виходить из приложения?


14-89469
Nik8.
2003-10-07 11:56
2003.10.27
ZZZZ