Picturebox Height property is not an integer as claimed 
Author Message
 Picturebox Height property is not an integer as claimed

I have a VB.NET application that  resizes a Picturebox control to fit a
specified number of thumbnail images. It worked fine for small numbers of
thumbnails, but truncated larger displays on the bottom (190 rows of
thumbnails).

After some debugging, I found that the reason was that the Height property
of the picture box was truncating a computed value of 36464 to 32767. As a
test, I declared a variable to be Integer, and stored the exact same
computed height value there. I got the correct value of 36464.

The documentation claims that the Height property is an Integer, but my
tests show that it is a Short (Int16) instead.

Is there a workaround? Is this fixed in the upcoming version of Visual
Studio?

Don Peters



Thu, 22 Sep 2005 09:50:18 GMT  
 Picturebox Height property is not an integer as claimed
Don,

About the picture box bug: 36464 can't be truncated to 32767, primarily because 36,464 is a smaller number than 32,767.  It will, however, be chopped if the value is greater than 32767, because (I don't no this for a fact) internally it might still be running off the COM/ActiveX  PictureBox. The Height property *is* an integer value, the problem is in what ever the .NET object is wrapping. But this isn't the point...

Why are you resizing the picture box to such massive sizes?! If you want to buffer the image data, store it in memory in a BitMap object, don't use the Picture property of a picture box. If this is because your trying to scroll the thumbnails, you can still use a memory bmp, just blit it onto the surface where you want it to appear and use height/width of the picture box as the size.

In my opinion, you should never use controls as a short cut to coding highly graphical interfaces. It will have bugs every time.

Jeremy

Quote:

> I have a VB.NET application that  resizes a Picturebox control to fit a
> specified number of thumbnail images. It worked fine for small numbers of
> thumbnails, but truncated larger displays on the bottom (190 rows of
> thumbnails).

> After some debugging, I found that the reason was that the Height property
> of the picture box was truncating a computed value of 36464 to 32767. As a
> test, I declared a variable to be Integer, and stored the exact same
> computed height value there. I got the correct value of 36464.

> The documentation claims that the Height property is an Integer, but my
> tests show that it is a Short (Int16) instead.

> Is there a workaround? Is this fixed in the upcoming version of Visual
> Studio?

> Don Peters



Thu, 22 Sep 2005 11:26:21 GMT  
 Picturebox Height property is not an integer as claimed


Quote:

> primarily because 36,464 is a smaller number than 32,767.  It will,

Are you sure about that?  Every math class I ever took would state that
36,464 is a LARGER number than 32,767. ;)

Chris

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Fri, 23 Sep 2005 21:43:30 GMT  
 Picturebox Height property is not an integer as claimed


Quote:
> property of the picture box was truncating a computed value of 36464
> to 32767. As a test, I declared a variable to be Integer, and stored

> The documentation claims that the Height property is an Integer, but
> my tests show that it is a Short (Int16) instead.

Height is inherited from Control and according to the Object Browser it is
an Integer, but the PictureBox may be performing some check and only
allowing 32767 as a maximum value.  I looked through the IL for the
PictureBox and cannot find anything that shows it changing the value.  
Everything I saw indicates that it should support an Integer, but your code
and sample code that I created on my own, shows that the value is being
truncated to 32767.  There must be some code somewhere that checks the
height and resets it to 32767.  

Any comments from the VB Team?

--
If you don't like lunchmeat, please remove it from my e-mail address to
send me an e-mail



Fri, 23 Sep 2005 22:23:27 GMT  
 Picturebox Height property is not an integer as claimed
rofl... :)
Quote:



> > primarily because 36,464 is a smaller number than 32,767.  It will,

> Are you sure about that?  Every math class I ever took would state that
> 36,464 is a LARGER number than 32,767. ;)

> Chris

> --
> If you don't like lunchmeat, please remove it from my e-mail address to
> send me an e-mail



Sat, 24 Sep 2005 03:10:04 GMT  
 
 [ 5 post ] 

 Relevant Pages 

1. Toolbar Height Property Not Updating in VB6.0

2. Toolbar Height Property Not Updating in VB6.0

3. VB.NEt 2003 and Picturebox not allow .TIF in Property Window

4. Property AutoSize of picturebox is not working

5. I am trying to update a record, i am not using data control

6. I am trying to update a record, i am not using data control

7. PictureBox Height & Width

8. PictureBox Height / Width

9. Assign a control property with integer constant

10. Height properties of a selected image

11. BMP-file: Change properties height and width

12. How to fix Width,Height properties (ACTIVEX)

 

 
Powered by phpBB® Forum Software