Forum > Beginners

Canvas and TextOut in center

<< < (2/2)

howardpc:

--- 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  radius: Integer;  R: TRect;  ts: TTextStyle;begin  if not ButtonClicked then    exit;  if Width < Height then    radius := Width * 4 div 10  else    radius := Height * 4 div 10;  R.Create(ClientRect.CenterPoint, radius, radius);  Canvas.Brush.Color := clYellow;   // is the fillcolor for the circle  Canvas.Ellipse(R);  Canvas.Font.Size:=22;  Canvas.Font.Color:=clRed;  ts := Canvas.TextStyle;  ts.Alignment := taCenter;  ts.Layout := tlCenter;  ts.SingleLine := False;  ts.Wordbreak := True;  Canvas.TextRect(R, 0, 0, 'Hello'+LineEnding+'World', ts);end;

seghele0:
 :)
Wonderful!.

Navigation

[0] Message Index

[*] Previous page

Go to full version