Pixel/Points Units
-
I have an Image server control on my page. In my codebehind, I am trying to convert the Image.Height and Image.Width properties of that Image into a string. Can anyone tell me how this is done? I cannot find any correct way to convert the Unit type into a string. Jon G www.Gizmocoder.com
-
I have an Image server control on my page. In my codebehind, I am trying to convert the Image.Height and Image.Width properties of that Image into a string. Can anyone tell me how this is done? I cannot find any correct way to convert the Unit type into a string. Jon G www.Gizmocoder.com
I found out how to accomplish this task. Here is what I ended up doing (after a painful hour of brute forcing): I created a new image (not a webcontrol image, but a system.drawing image):
Dim myImage As System.Drawing.Image = System.Drawing.Image.FromFile(UploadPath + NewPicName)
The image was created from the network path. In my case it was an uploaded file. After this, everything got easy. Dim tempHeight = myImage.Height Dim tempWidth = myImage.Width For future reference, Webcontrol Images do not allow you to retrieve the height and width of an image. If it does, I would like someone to let me know how. Jon G www.Gizmocoder.com