Board index » delphi » StretchDIBits and Win200/Win98
jf.jouvet
![]() Delphi Developer |
StretchDIBits and Win200/Win982003-07-04 11:46:46 PM delphi98 Hello I have a problem with StretchDIBits with Windows 2000 but not with Win98 Principe: I have 4 Tables, each filled with a constant value When I try to display one with StretchDIBits, appearance is good when size of Table is small (100*100) but the display is not refresh when size is bigger(1000*1000) on win2000, but it is ok on win98. Does any one know why? How to do? Thanks for any help Here is the code unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls; type TForm1 = class(TForm) Button1: TButton; procedure Button1Click(Sender: TObject); procedure FormCreate(Sender: TObject); private { Déclarations privées } public { Déclarations publiques } end; var Form1: TForm1; implementation type tVector = array of Byte; type tImage = array of tVector; var Image: tImage; NbImage, WidthImage, HeightImage, Num: dWord; PimHeader: tBitMapInfo; {$R *.dfm} procedure TForm1.FormCreate(Sender: TObject); var i, j: LongInt; begin // Fill Each Image with a constant byte for i:=0 to NbImage-1 do for j:=0 to WidthImage*HeightImage-1 do Image[i,j]:=i*64; PimHeader.BmiHeader.biSize := sizeof(tBITMAPINFOHEADER); PimHeader.BmiHeader.biWidth := WidthImage; PimHeader.BmiHeader.biHeight := HeightImage; PimHeader.BmiHeader.biPlanes := 1; PimHeader.BmiHeader.biBitCount := 8; PimHeader.BmiHeader.biCompression := 0; PimHeader.BmiHeader.biSizeImage := (HeightImage*WidthImage); PimHeader.BmiHeader.biXPel{*word*237}eter := 0; PimHeader.BmiHeader.biYPel{*word*237}eter := 0; PimHeader.BmiHeader.biClrUsed := 0; PimHeader.BmiHeader.biClrImportant := 0; {$r-} for i := 0 to 255 do begin PimHeader.BmiColors[i].rgbBlue :=i; PimHeader.BmiColors[i].rgbGreen:=i; PimHeader.BmiColors[i].rgbRed :=i; PimHeader.BmiColors[i].rgbReserved:=0; end; {$r+} Num:=0; end; procedure TForm1.Button1Click(Sender: TObject); var hdc_local: hdc; begin Num := (Num+1) mod NbImage; Form1.Button1.Caption:=IntToStr(Num); hdc_local := GetDc(Form1.Handle); StretchDIBits( hdc_local, 0, 0, Form1.Width, Form1.Height, 0, 0, WidthImage, HeightImage, Image[Num], PimHeader, DIB_RGB_COLORS, SRCCOPY); ReleaseDC(Form1.Handle, hdc_local); GdiFlush; Application.ProcessMessages; end; Initialization NbImage := 4; // OK WidthImage := 100; HeightImage := 100; // FAIL WidthImage := 1000; HeightImage := 1000; // SetLength(Image, NbImage, WidthImage*HeightImage); Finalization SetLength(Image, 0); end. |