Hi all! Thank you for reading my question!
I'm using a simple bit of code to draw a background on the form canvas. This is what I use (ok, a bit more complex than this due to supporting jpegs, resizing, etc as well but anyway):
Now what happens when I just scroll the form a little bit, the image isn't (IMHO) drawn properly, instead of it showing normally, it'll show like this:
And it should look like this (the pic that is):
Is there anything I can do about that? I've been scouring the interwebz but all this has done is:
Can you help me fix this, or is this just a fact of life?
BobbaFet
I'm using a simple bit of code to draw a background on the form canvas. This is what I use (ok, a bit more complex than this due to supporting jpegs, resizing, etc as well but anyway):
Code:
...
private
myBackground: TBitmap;
...
function GetDesktopBG: string;
var R: TRegistry;
begin
R := TRegistry.Create;
R.RootKey := HKEY_CURRENT_USER;
R.OpenKey('\Control Panel\Desktop',False);
Result := R.ReadString('WallPaper');
R.Free;
end;
procedure TForm1.FormCreate(Sender:TObject);
begin
myBackground := TBitmap.Create;
myBackground.LoadFromFile(GetDesktopBG);
// resize to form dimensions
end;
procedure TForm1.FormPaint(Sender: TObject);
begin
Canvas.Draw(0, 0, myBackground);
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
myBackground.Free;
end;
Now what happens when I just scroll the form a little bit, the image isn't (IMHO) drawn properly, instead of it showing normally, it'll show like this:
And it should look like this (the pic that is):
Is there anything I can do about that? I've been scouring the interwebz but all this has done is:
Can you help me fix this, or is this just a fact of life?
BobbaFet
Code:
if not Programming = 'Severe Migraine' then
ShowMessage('Eureka!');