WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: SewWrite on January 16, 2021, 10:05:13 AM

Title: Picture size in dialogs
Post by: SewWrite on January 16, 2021, 10:05:13 AM
I searched for this but didn't find any specific information... is there an easy way to display a picture in a dialog such that it is not resized and is the exact same size as the original bitmap? I have a dialog with a 94x259 pixel graphic. Using trial and error, I have it close to the correct size but can't seem to get it to be exact and some of the lines in the dialog are therefore blurred. Or at least get the aspect ratio correct so that there is less stuttering in the image? Or alternatively, a way to figure out how many pixels an area of the WinBatch dialog needs to be 1:1 ratio? 
Title: Re: Picture size in dialogs
Post by: kdmoyers on January 18, 2021, 07:12:01 AM
If I remember correctly, this question is all about getting the image size in dialog units to match the image size in pixels.
If that's true, then maybe the help file article on "Dialog Units" will be helpful?  Not sure.

Key bit from the article:

The WinMetrics function can help you calculate pixels per Dialog unit size.
pixperunit_horz = WinMetrics(-5)
pixperunit_vert = WinMetrics(-6)

Title: Re: Picture size in dialogs
Post by: td on January 19, 2021, 09:08:55 AM
Converting the bitmap size from pixels to dialog units is the solution.  There are several articles about this in the Tech Database. Here is a link to one:

https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.X+Bitmap~Resizing~in~Dialog.txt (https://techsupt.winbatch.com/webcgi/webbatch.exe?techsupt/nftechsupt.web+WinBatch/Dialog~Editor/Dialog~Editor~version~6.X+Bitmap~Resizing~in~Dialog.txt)