Let me give a detailed explanation: In example Chart there are two forms. The first one is for collecting the chart data, so it isn't very interesting. I'll list you the second class, which is reponsible for the chart-drawing:
Public total As Integer Public value As Float[] Public Sub btnClose_Click() Me.Close End Public Sub _new() Me.Center End Public Sub Form_Open() Draw_Chart End Public Sub Draw_Chart() Dim i As Integer Dim skala_1 As Integer Dim skala_2 As Integer Dim distance_x As Float Dim distance_y As Float Dim width_draw As Integer Dim tot As Integer Dim colors As Integer[] Dim bottom As Integer Dim sumdata As Integer colors = New Integer[] colors.Resize(total + 1) For i = 1 To total sumdata = sumdata + value[i] Next If sumdata = 0 Then sumdata = 1 For i = 1 To total value[i] = (value[i] / sumdata) * 10 Next drwchart.Clear draw.Begin(drwchart) skala_1 = drwchart.ClientH / 11 distance_y = drwchart.ClientH - skala_1 bottom = distance_y + 8 For i = 0 To 100 Step 10 draw.Foreground = color.black draw.Text(i, 0, distance_y) draw.Line(25, distance_y + 8, drwchart.clientw, distance_y + 8) distance_y = distance_y - skala_1 Next draw.Line(30, 0, 30, drwchart.ClientH) skala_2 = (drwchart.ClientW - 30) \ 10 distance_x = skala_2 + 30 width_draw = skala_2 / 2 For i = 1 To Total draw.LineWidth = 1 draw.Foreground = color.Black draw.Text(i, distance_x - (width_draw / 2) - 4, drwchart.ClientH - 20) draw.Line(distance_x - (width_draw / 2), 0, distance_x - (width_draw / 2), drwchart.ClientH - skala_1 + 8) draw.LineWidth = width_draw draw.Foreground = color.RGB(i * 100, i * 10, i * 50) colors[i] = draw.Foreground tot = skala_1 * value[i] + skala_1 - 8 draw.Line(distance_x - (width_draw / 2), bottom, distance_x - (width_draw / 2), drwchart.ClientH - tot) distance_x = distance_x + skala_2 Next DRAW.End End Public Sub btnAbout_Click() Dim i As String i = "<h2>Example to make bar chart</h2>\n" i = i & "This example has made by : " & Chr(10) i = i & " Yudi Astira" & Chr(10) i = i & " y...@kecoak.or.id" & Chr(10) i = i & " necrose #hdteam on Dal.Net" & Chr(10) i = i & "Thank You" message.Info(i, "&Close") End ----------------------------------------------- If you take a look to the structure of this, the first thing is that only the Draw_Chart() is interesting. If I would like to emphasize the real important things I'd shorten it to this: Public Sub Draw_Chart() drwchart.Clear draw.Begin(drwchart) draw.LineWidth = 1 draw.Foreground = color.Black draw.Line(30, 0, 30, drwchart.ClientH) draw.End End The other things can be done if you know the basic synthax. And here comes the first irregularity: if I try to implement these steps in a program where I'm creating new DrawingArea if I put the creation of this into the same function as the Begin method, I run into error "Drawing cannot be done outside the Draw event handler". But actually it works in this example! And this is the only available example for chart-drawing, and it isn't written in the spirit of the documents! I simply don't know how to write a working function for that task. A good example is made of usable, simple bricks: if I know how to draw a line, I'll know how to draw a circle, rectangle etc. too. So what's the structure of the printing process? If I define a printer: Public samsung AS Printer How to force it to print a line, a text or an image? At least in the documentation it should be clearly stated. Should I write a sub: PUBLIC SUB Printit() ??? what to put here, can I do it in one function??? END Or I will need: 1. PUBLIC SUB Printit() 2. PUBLIC SUB samsung_Begin() 3. PUBLIC SUB samsung_Draw() What is defined in 1,2 and 3 function? And the same stands for the DrawingArea task too. I don't know how to initiate the process! One task for 3 functions?! I hope I was clear. > Did you read the Printing example source code? Did you find it too complex? > > -- > Benoît Minisini > > ------------------------------------------------------------------------------ > All of the data generated in your IT infrastructure is seriously valuable. > Why? It contains a definitive record of application performance, security > threats, fraudulent activity, and more. Splunk takes this data and makes > sense of it. IT sense. And common sense. > http://p.sf.net/sfu/splunk-d2d-c2 > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user > ------------------------------------------------------------------------------ All of the data generated in your IT infrastructure is seriously valuable. Why? It contains a definitive record of application performance, security threats, fraudulent activity, and more. Splunk takes this data and makes sense of it. IT sense. And common sense. http://p.sf.net/sfu/splunk-d2d-c2 _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user