On Wednesday 15 December 2010 15:10:46 Benoît Minisini wrote: > > I'm trying to paint a continuous graph to an image, the image should grow > > in width as needed. I thought the following code might do the job but it > > generates not a clear graph after first Image.Resize. (see attachment) > > > > How looks a better coding to do this job ? > > thanks wally > > > > code: GB3 > > Public Sub Button4_Click() > > Dim t As Integer > > Dim y As Integer > > > > myImage1 = New Image(210, 128, Color.RGB(255, 255, 223)) > > > > For t = 0 To 2000 > > If (t Mod 25 = 0) Then > > y = CInt(Rnd(0, 128)) > > Endif > > > > If t > myImage1.W Then > > myImage1.Resize(myImage1.w + 10, myImage1.H) > > PictureBox1.w += 10 > > Endif > > > > > > Paint.Begin(myImage1) > > Paint.Brush = Paint.Color(Color.RGB(0, 0, 0)) > > Paint.LineWidth = 1 > > Paint.MoveTo(last_t, last_y) > > Paint.LineTo(t, y) > > Paint.Stroke > > Paint.End > > > > Wait 0.05 > > > > PictureBox1.H = myImage1.H > > PictureBox1.Picture = myImage1.Picture > > ScrollView1.EnsureVisible(t, 64, 50, 50) > > > > last_t = t > > last_y = y > > Next > > End > > When you create an image, or enlarge it, the contents is never initialized by > default. You must paint the background of the new part first. > > Regards, > > -- > Benoît Minisini > > ------------------------------------------------------------------------------ > Lotusphere 2011 > Register now for Lotusphere 2011 and learn how > to connect the dots, take your collaborative environment > to the next level, and enter the era of Social Business. > http://p.sf.net/sfu/lotusphere-d2d > _______________________________________________ > Gambas-user mailing list > Gambas-user@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/gambas-user >
Benoit, thank you, but how to paint the background of the new part first ? wally :) ------------------------------------------------------------------------------ Lotusphere 2011 Register now for Lotusphere 2011 and learn how to connect the dots, take your collaborative environment to the next level, and enter the era of Social Business. http://p.sf.net/sfu/lotusphere-d2d _______________________________________________ Gambas-user mailing list Gambas-user@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/gambas-user