...... Dim CBMP as new Bitmap (236,184) 'create a bitmap instance with a canvas width of 236 and a height of 184 Dim cgraphic as graphics Dim ccolor () as color = {color. Red, color. Blue, color. Green, color. Gray ,_ Color. lightcoral, color. Gold} '5 colors Dim cpen as pen Dim csolidbrush as solidbrush Dim cpoints () as point Dim rownum as integer = 3' defines the number of slice Blocks Dim I as integer = 0 Dim J as integer = 0 Dim cangle as integer = 0 Dim TMP as integer = 0 Dim xcirclecenter as integer = 100 'defines the center X coordinate Dim ycirclecenter as integer = 100 'defines the Y coordinate of the center Cgraphic = graphics. fromimage (CBMP) Cgraphic. Clear (color. Snow) For J = 0 to rownum Cangle = 90' defines the slice Angle Redim cpoints (cangle + 1) 'Draw circles with mathematical formulas Cpen = new pen (ccolor (J), 3) Csolidbrush = new solidbrush (ccolor (j )) For I = TMP to TMP + cangle Cpoints (I-TMP) = new point Cpoints (I-TMP). x = (1-system. Math. Sin (I/360*2 * system. Math. Pi) * (xcirclecenter-30) + 10 Cpoints (I-TMP). Y = (1-system. Math. Cos (I/360*2 * system. Math. Pi) * (ycirclecenter-30) + 10 Next I 'Add the coordinate point of the center Cpoints (cangle + 1) = new point Cpoints (cangle + 1). x = xcirclecenter-20 Cpoints (cangle + 1). Y = ycirclecenter-20 'Area of the slice to be drawn Cpen = new pen (ccolor (J), 3) Csolidbrush = new solidbrush (ccolor (j )) Cgraphic. drawpolygon (cpen, cpoints) Cgraphic. fillpolygon (csolidbrush, cpoints) TMP = TMP + cangle Next Pb_graphic.image = CBMP ...... |