Forum > QT

[Solved] Custom Control causes QTransform error

<< < (2/4) > >>

zeljko:
I don't see any attachment

alanphys:
Sorry Zeljko

Component attached. But I have in the meantime got a minimal project to create the error. Open a new project and put the following code in the form's OnPaint event handler.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormPaint(Sender: TObject);var ABitmap    :TBitMap;beginABitmap := TBitMap.Create;ABitmap.Width := 20;ABitmap.Height := 10;Canvas.Brush.Style := bsClear;Canvas.TextOut(5,5, 'Okay');ABitmap.Canvas.CopyRect(Rect(0,0,ABitmap.Width,ABitmap.Height),                        Canvas,                        Rect(5,5,5+ABitmap.Width,5+ABitMap.Height));Canvas.TextOut(250,120, 'Not Okay');end;
Compile and run with the form on the second (external) screen.

Regards
Alan

zeljko:
Can you add ABitmap.Free at the end ? I cannot test with 2 monitors atm, but will check

alanphys:
Yes, sorry. Sloppy programming. Corrected procedure below.


--- Code: Pascal  [+][-]window.onload = function(){var x1 = document.getElementById("main_content_section"); if (x1) { var x = document.getElementsByClassName("geshi");for (var i = 0; i < x.length; i++) { x[i].style.maxHeight='none'; x[i].style.height = Math.min(x[i].clientHeight+15,306)+'px'; x[i].style.resize = "vertical";}};} ---procedure TForm1.FormPaint(Sender: TObject);var ABitmap    :TBitMap;beginABitmap := TBitMap.Create;ABitmap.Width := 20;ABitmap.Height := 10;Canvas.Brush.Style := bsClear;Canvas.TextOut(5,5, 'Okay');ABitmap.Canvas.CopyMode := cmSrcCopy;ABitmap.Canvas.CopyRect(Rect(0,0,ABitmap.Width,ABitmap.Height),                        Canvas,                        Rect(5,5,5+ABitmap.Width,5+ABitMap.Height));Canvas.TextOut(250,120, 'Not Okay');Abitmap.Free;end;
This still gives the problem. It appears to be caused by something in CopyRect but only appears later in TextOut.

Regards
Alan

zeljko:
Can you test with trunk lazarus ?

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version