Welcome Guest! You need to login or register to make posts.



Go to last post Go to first unread
#1 Posted : Tuesday, October 25, 2005 3:10:23 PM(UTC)

Rank: Member

Groups: Member
Joined: 7/6/2005(UTC)
Posts: 16

I'm not exactly sure how to describe this problem... but, I've loaded a bitmap into the bitmapviewer object, and in a loop and trying to plot points.

If when I Initialize the bitmap object to a new image, I also use the following code:

Dim g As Graphics = bmvMain.Bitmap.GetGdiplusGraphics
g.DrawLine(Pens.White, 0, 80, 15, 100)
g.DrawLine(Pens.White, 15, 100, 18, 76)

I see two connected lines on my bitmap... however when the same values are drawn from within a loop, I get one or maybe two pixels of the first line, and nothing else after that. In addition, it seems the bitmap class stops responding to subsequent draw commands.

If I simply add the points to an array, and then use:

g.DrawLines(Pens.White, aryPoints)

I see all the points just fine. Also, substituting g.DrawLine with bmvMain.Bitmap.SetPixel also draws the first 1 or two pixels and then stops responding.

The only thing I can think of that's different from my code in the loop and the initializing code where I draw two subsequent lines is in the loop (where the calls seem to fail) I subsequently call Thread.Sleep before the next iteration of the loop.

Any help would be greatly appreciated :)

While I could use the scenario where I load an array as I go, which I'm currently doing as a work around... I would much rather this work properly since I'm intending to show the points and lines being drawn in real time.

Edited by user Sunday, December 23, 2007 5:08:21 PM(UTC)  | Reason: Not specified

#2 Posted : Tuesday, October 25, 2005 3:34:01 PM(UTC)

Rank: Member

Groups: Member
Joined: 7/6/2005(UTC)
Posts: 16

I found out what the problem is.. or rather where the problem was... after this posting, I went in and redid this section of the code replacing the bitmap viewer with the standard picturebox and used the .net bitmap and still noticed the problem... I then when BACK to the aurigma controls and used Gdi instead of GdiPlus and everything worked fine. So I take it this is a problem with GdiPlus?

Are there disadvantages to using Gdi instead of GdiPlus? Is GdiPlus supposed to be better than Gdi?
#3 Posted : Wednesday, October 26, 2005 1:42:30 PM(UTC)

Rank: Advanced Member

Groups: Member, Administration, Moderator
Joined: 8/3/2003(UTC)
Posts: 1,070

Thanks: 1 times
Was thanked: 12 time(s) in 12 post(s)

GDI+ has some more advantage regarding to GDI, for example it handles alpha channel in images. But performance in GDI+ is less than in GDI. If your requirements on features are satisfied by GDI, I recommend you to use it.
Sincerely yours,
Dmitry Sevostyanov

UserPostedImage Follow Aurigma on Twitter!
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.