Hi I created the most simple app you can think of and in the FormPaint event I do the following:
procedure TForm1.FormPaint(Sender: TObject);
var
x : HWND;
dc : HDC;
rect : TRect;
blueBrush : HBRUSH;
newPen : HPEN;
begin
x := Handle;
dc := GetDeviceContext(x);
newPen := CreatePen(PS_SOLID,1,RGB(0,0,255));
SelectObject(dc,newPen);
movetoex(dc,70,70,nil);
lineto(dc,500,500);
rect := TRect.Create(100,100,100,100);
blueBrush := CreateSolidBrush(RGB(0,123,255));
FillRect(dc,rect,bluebrush);
end;
And while the line is being drawn the Rect doesn't. Any ideas?