Woutero Posted April 24 Share Posted April 24 Sherzod I'm using a UniCanvas but the very first time I draw something on it, its starts off being black even though the Brush Color is clWhite? The following code always show a black Canvas the very first time its used. When the code is executed a second time thereafter the background is white as it should be. UniCanvas1.Clear; UniCanvas1.Brush.Color:=clWhite; UniCanvas1.MoveTo(X1, Y1); UniCanvas1.LineTo(X2, Y2); If I just execute the first two lines once: UniCanvas1.Clear; UniCanvas1.Brush.Color:=clWhite; I end up with a black canvas. The UniCanvas sits on a UniPanel. I'm using UniGUI Complete Professional V1.90.0.1560 Another question: Is there any way to display Text on a UniCanvas? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 24 Share Posted April 24 Hello, How can we reproduce your issue? Quote Link to comment Share on other sites More sharing options...
Sherzod Posted April 24 Share Posted April 24 1 hour ago, Woutero said: Another question: Is there any way to display Text on a UniCanvas? Quote Link to comment Share on other sites More sharing options...
Ron Posted April 25 Share Posted April 25 Using Clear clears the canvas, making it black. Setting the brush color only sets the brush color, and does not affect the canvas. To fill a rectangle with the current brush color, use the fillRect function. The lineTo function draws a line with pen.color and pen.width with the current pen.style. E.g.: with UniCanvas1 do begin Clear; Brush.Color:=clWhite; FillRect(0, 0, 100, 100); Pen.width:=2; Pen.Color:=clBlack; MoveTo(X1, Y1); LineTo(X2, Y2); end; Quote Link to comment Share on other sites More sharing options...
Woutero Posted April 25 Author Share Posted April 25 Thank you Sherzod & Ron! Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.