DPlot Forum Index DPlot
http://www.dplot.com
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

DATA_3DR Not using entire picturebox

 
Post new topic   Reply to topic    DPlot Forum Index -> Basic
View previous topic :: View next topic  
Author Message
xander_P



Joined: 11 Sep 2006
Posts: 10

PostPosted: Thu May 24, 2007 1:38 pm    Post subject: DATA_3DR Not using entire picturebox Reply with quote

I recently upgraded my copy of DPLOT from 2.1.0.5 to 2.1.1.8 and noticed an unfortunate side effect (for me at least) in doing so. It appears that when displaying a plot using the DATA_3DR data format the generated plot doesn't fill up the entire picturebox anymore. At least it appears that way on my current setup.

The easiest way to understand, I believe, is to try the BTEST2 sample project you provide with the DPLOTLIB. In the 2.1.0.5 version pressing the "gridded data" button followed by the "random data" button produces the following result (basically the random data plot completely covers the previous plot):
http://s14.photobucket.com/albums/a337/xanderP/?action=view&current=DPLOT2105.jpg

In the 2.1.1.8 version when I follow the same steps it appears as though the plot doesn't generate wide enough and as a result gets anchored to the left side of the plot, thus not completely covering the previous plot:
http://s14.photobucket.com/albums/a337/xanderP/?action=view&current=dplot2118.jpg

So is there anyway (new command?) I can get the new version to react the same way as 2.1.0.5 version? Should I start to look for ways to counteract this new result in my program? Could the problem be specific to my computer? Note its not the failure to cover the previous plot that is my concern, its more that it doesn't completely fill the picturebox, and is no longer centered in the picturebox.

Any help is appreciated. Very Happy
Back to top
View user's profile Send private message
DPlotAdmin
Site Admin


Joined: 24 Jun 2003
Posts: 2310
Location: Vicksburg, Mississippi

PostPosted: Fri May 25, 2007 2:43 am    Post subject: Reply with quote

That's an unintended side effect of a recent change that, by default, removes most white space from bitmaps. Unfortunately the new [SetImageCrop()] command has no effect on bitmaps retrieved with any of the DPLOTLIB functions, only on bitmaps saved to disk. I'll fix this oversight in the next release, sorry for the trouble.

In the meantime about all you can do is erase the interior of the destination rectangle before drawing the bitmap. In the btest2 demo's Picture1_Paint routine, add

ret = FillRect(hdc, rcPic, GetStockObject(WHITE_BRUSH))

anywhere after "hdc = GetDC(Picture1.hwnd)" and before the BitBlt line.

If it's important to you that the bitmap is centered in the destination rectangle then you'll also need to make use of the bitmap dimensions retrieved with GetObject:

Dim dx, dy As Long

ret = GetObject(hBitmap, Len(bm), bm)
dx = (rcPic.Right - rcPic.Left - bm.bmWidth) / 2
dy = (rcPic.Bottom - rcPic.Top - bm.bmHeight) / 2

ret = BitBlt(hdc, rcPic.Left + dx, rcPic.Top + dy, ....
_________________
Visualize Your Data
support@dplot.com
Back to top
View user's profile Send private message Send e-mail Visit poster's website
xander_P



Joined: 11 Sep 2006
Posts: 10

PostPosted: Fri May 25, 2007 10:28 am    Post subject: Reply with quote

Thanks for looking into it. And thanks for the advice on centering the plot in the meantime. Very Happy
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    DPlot Forum Index -> Basic All times are GMT - 5 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group