Help please make such a thing as in the photo, only with the Russian text. Sectors in pascal I can draw, but how to fill them with text? Perhaps this can be done easier in other languages, just with simple drawing modules I only know Pascal .

enter image description here

 uses crt, GraphABC; const A: array[1..33] of integer = (1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1); var u, u0, S, i: integer; begin SetWindowSize(800, 800); circle(400, 400, 50); S:=0; u0:=0; for i:=1 to 33 do S:=S+A[i]; for i:=1 to 33 do begin SetBrushColor(rgb(255,255,255)); u:=u0+round(A[i]*360/S); Pie(400,400,390,u0,u); u0:=u; end; drawcircle(400, 400, 330); circle(400, 400, 270); end. 
  • If you have PascalABC.NET, then there, it seems, you can choose WPF. And on WPF, you can easily text on any path, at least in a circle. An example can be found in MSDN magazine 2008, December (you need to download chm ). - Alexander Petrov
  • @AlexanderPetrov, yes, PascalABC.NET, hmm, I don’t really see anything about WPF, I’ll look for it - NTP

1 answer 1

You can display rotated text using PascalABC itself. I liked your task, and Pascal decided to remember. Changed your code a bit:

 uses GraphABC; const r1 = 180; r2 = 240; r3 = 300; r23 = (r2 + r3) div 2; w = 2 * r3; h = 2 * r3; cx = r3; cy = r3; N = 32; procedure draw_rotated_text(x, y, a: integer; s: string); var prev_a: real; begin coordinate.OriginX := coordinate.OriginX + x; coordinate.OriginY := coordinate.OriginY + y; prev_a := coordinate.Angle; coordinate.Angle := a; DrawTextCentered(0, 0, 0, 0, s); coordinate.OriginX := coordinate.OriginX - x; coordinate.OriginY := coordinate.OriginY - y; coordinate.Angle := prev_a; end; var i, S, u0, u1, u01, x, y: integer; a, ai: real; begin SetWindowSize(w, h); window.SetPos(300, 10); font.Size := 30; a := 0; ai := 360 / N; for i := 1 to N do begin u0 := round(a); u1 := round(a + ai); u01 := (u0 + u1) div 2; x := cx + round(r23 * cos(degtorad(u01))); y := cy - round(r23 * sin(degtorad(u01))); Pie(cx, cy, r3, u0, u1); draw_rotated_text(x, y, 90 - u01, 'A'); a := a + ai; end; drawcircle(cx, cy, r2); circle(cx, cy, r1); end.