| View previous topic :: View next topic |
| Author |
Message |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri Nov 21, 2003 7:22 pm Post subject: "Actual Size" Graphics? |
|
|
Hi All,
This may be a dumb question... But....
What is the best way to display an "actual size" graphic to users having different screen resolutions?
For example, let's say I have a graphic file of an object that is actual size (this is, the graphic displays at the same size as the item in real life). The graphic is displayed actual size on a screen at 800x600. However, how can I allow the graphic to display at actual size on a user's screen that is set at 1024x768?
I know I can detect a user's resolution, then create separate versions of the dialog for different resolutions, but is there a way to display the graphic "actual size" without having to create separate dialogs or dialog elements?
Also, is it possible to temporarily reset a user's screen resolution when a VDS program is run, then return the screen resolution to the previously set state upon exit of the VDS program?
Thanks guys,
Keith L. |
|
| Back to top |
|
 |
Skit3000 Admin Team

Joined: 11 May 2002 Posts: 2166 Location: The Netherlands
|
Posted: Fri Nov 21, 2003 7:56 pm Post subject: |
|
|
You can do this by using the "stretch" style with bitmap elements...
Example:
| Code: | %%Bitmap =
DIALOG CREATE,Nieuw Dialoog,0,0,@sysinfo(SCREENWIDTH),@sysinfo(SCREENHEIGHT),NOTITLE
DIALOG ADD,BITMAP,BITMAP1,0,0,@sysinfo(SCREENWIDTH),@sysinfo(SCREENHEIGHT),%%Bitmap,,STRETCH
DIALOG SHOW
wait 1 |
_________________ [ Add autocomplete functionality to your VDS IDE windows! ]
Voor Nederlandse beginners met VDS: bekijk ook eens deze tutorial! |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Fri Nov 21, 2003 8:28 pm Post subject: |
|
|
Thanks. However, I want the dialog, as well as the "actual size" graphic, to display the same at all resolutions... Any ideas?
Thanks,
Keith L. |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sat Nov 22, 2003 5:20 pm Post subject: |
|
|
Perhaps using OPTION SCALE would help?  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sat Nov 22, 2003 11:47 pm Post subject: Option scale... |
|
|
Thanks FreezingFire, but I already tried that. The problem is that my application needs to display an "actual size" graphic of an object.
I have played with option scale, but unfortunately, different screen resolutions result in different graphic sizes on screen.
I'll keep playing with it. Hey, is there any way to temporarily change a user's screen resolution temporarily and then reset it upon closing of the program? (That is, by using API calls and/or by accessing the registry?)
Thanks,
Keith L. |
|
| Back to top |
|
 |
FreezingFire Admin Team

Joined: 23 Jun 2002 Posts: 3508
|
Posted: Sun Nov 23, 2003 12:56 am Post subject: |
|
|
I think CodeScript might have posted an example to do this however I'm not sure.  _________________ FreezingFire
VDSWORLD.com
Site Admin Team |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sun Nov 23, 2003 6:41 am Post subject: |
|
|
I think U can resize your bitmap using strech style as Skit suggested
Only problem is if your bitmap is non-photograhic and contains sharp edges
like text etc. The code below should display a bitmap in real size
whatever the screen resolution. (you can extend the same to your dialog)
| Code: | %%Bitmap =
REM specify here below the values form your
REM bitmap file properties
%%Bitmapwidth =
%%Bitmapheight =
REM I used 800x600 resolution as standard.
%%deltaX = @FDIV(@sysinfo(SCREENWIDTH),800)
%%deltaY = @FDIV(@sysinfo(SCREENHEIGHT),600)
%%width = @FINT(@FMUL(%%Bitmapwidth,%%deltaX))
%%height = @FINT(@FMUL(%%Bitmapheight,%%deltaY))
DIALOG CREATE,New Dialog,139,223,370,262
DIALOG ADD,BITMAP,BITMAP1,41,33,%%width,%%height,%%Bitmap,,STRETCH
DIALOG SHOW
INFO %%width|%%height |
Changing the screen resolution is possible but I haven't put up any examples.
One problem is that the process may not be seamless with all display adaptors
Some of them (older ones) change the refresh rate and refuse to reset back with API
causing irritation to the end user. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Sun Nov 23, 2003 11:48 am Post subject: |
|
|
If you don't put OPTION SCALE then the size of all the dialog elements stays the same, but the font sizes still change, hence the result can look odd and text might get truncated. If there's little or no text on the dialog, you can get away with it. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sun Nov 23, 2003 11:58 am Post subject: |
|
|
I doubt that - just checked it on 800x600 and 1024x768 actual size of bitmap is quite different (much smaller with higher resolution) - whether OPTION SCALE is specified or not. _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
vdsalchemist Admin Team

Joined: 23 Oct 2001 Posts: 1448 Location: Florida, USA
|
Posted: Sun Nov 23, 2003 3:56 pm Post subject: |
|
|
Hi All,
Jules is saying that when you develop your App you will want to use Option Scale so that people that use the large Font Size 120dpi as apposed to the Small Font Size 96dpi scale will be able to read fonts on your dialog too. This has nothing to do with the Bitmap element.
I am not really sure what you all are trying to do with the bitmaps Do you want your dialog to change with the resolution of the bitmap reguardless of the resolution of the users screen? _________________ Home of
Give VDS a new purpose!
 |
|
| Back to top |
|
 |
CodeScript Moderator Team

Joined: 08 Jun 2003 Posts: 1060 Location: India
|
Posted: Sun Nov 23, 2003 5:02 pm Post subject: |
|
|
| mindpower wrote: | I am not really sure what you all are trying to do with the bitmaps |
Even I am not sure why such a thing should be done -- I guess some printing etc from screen  _________________ Regards
- CodeScript
Give your application a professional look with the VDSGUI Extension |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Sun Nov 23, 2003 7:25 pm Post subject: |
|
|
Hi Guys,
Thanks for all of your input.
The solution from CodeScript is similar to a workaround I came up with and should suffice. (Thanks CodeScript!)
Actually, my dialog can vary somewhat here and there, but the important thing is to have a consistently sized graphic regardles of the enduser's display resolution.
What I need to do is for the enduser to see, on her/his screen, is the actual size of a particular object. For example, if I place a graphic of a quarter on the screen, I need the enduser to be able to see the quarter "actual size."
Thanks again,
Keith L. |
|
| Back to top |
|
 |
LiquidCode Moderator Team
Joined: 05 Dec 2000 Posts: 1753 Location: Space and Time
|
Posted: Mon Nov 24, 2003 12:18 pm Post subject: |
|
|
Here is a script that you can use to detect the actual size of a bitmap without using a DLL. I have used it many times and it works great. I hope this helps. This needs VDS 4 or higher.
| Code: |
rem - A script to find the size of a bitmap
rem - create a dummy dialog without the Dialog Show
rem - because Child dlgs are easire to distroy
dialog create,dummy,0,0,0,0
DIALOG CREATE,Find Bitmap Size,-1,0,221,46
dialog ADD,STYLE,STYLE1,,,B,,004080
DIALOG ADD,TEXT,TEXT1,16,6,76,13,Select Bitmap:
DIALOG ADD,BUTTON,BUTTON1,14,100,64,24,Select,,HAND
dialog SHOW
:evloop
wait event
goto @event()
:button1button
%%file = @filedlg(*.bmp)
if @ok()
if %%file
gosub getsize
end
end
info Width@tab()%%iwidth@cr()Height@tab()%%iheight
goto evloop
:getsize
dialog create,temp,0,0,0,0
dialog add,bitmap,temp,0,0,0,0,%%file
%%iwidth = @dlgpos(temp,W)
%%iheight = @dlgpos(temp,H)
dialog select,2
dialog close
%e = @event()
dialog select,1
exit
:close
stop
|
_________________ Chris
Http://theblindhouse.com |
|
| Back to top |
|
 |
jules Professional Member


Joined: 14 Sep 2001 Posts: 1043 Location: Cumbria, UK
|
Posted: Tue Nov 25, 2003 8:48 am Post subject: |
|
|
| CodeScript wrote: | | I doubt that - just checked it on 800x600 and 1024x768 actual size of bitmap is quite different (much smaller with higher resolution) - whether OPTION SCALE is specified or not. |
It's physically smaller because the number of pixels stays the same. OPTION SCALE will cause the dialog to be scaled up, but only if you use a large fonts setting which is the only way to make dialogs etc appear larger on a higher resolution desktop. _________________ The Tech Pro
www.tech-pro.net |
|
| Back to top |
|
 |
Boo Valued Contributor


Joined: 31 Oct 2003 Posts: 599 Location: Gulf Breeze, Florida USA
|
Posted: Tue Nov 25, 2003 5:34 pm Post subject: |
|
|
| Thanks LiquidCode! This will be useful in various apps. |
|
| Back to top |
|
 |
|
|
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 You can attach files in this forum You can download files in this forum
|
|