Virtual screen

This forum is for eXpress++ general support.
Message
Author
User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Virtual screen

#11 Post by rdonnay »

eXpress++ scaling doesn't work with graphic images.

This must be handled at the OS level.
The eXpress train is coming - and it has more cars.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Virtual screen

#12 Post by Auge_Ohr »

unixkd wrote:You can never know the type of screen resolution that your would be client will have.
Right ... so try to think "other" Way

my Calendar Listview have "fix" Row for 24 Hour / Day.
now i let User choise Font/Size in Setup.

than i calculate, using GraQueryTextBox() / GetTextExtentPoint32A(), how much space i need for a Refence SLE -> Scale Factor

so User have to choise a Font which let him see hole Form. :liar:

as Roger say you have to begin with smallest Font/Size which can be scale up.
also all your GRA painting should recognize "real" native Screens Size.
greetings by OHR
Jimmy

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Virtual screen

#13 Post by Auge_Ohr »

Eugene Lutsenko wrote:But my question was different: if the program already creates an image with high resolution, is there a way to display it on the screen with the lower resolution scale it to a smaller resolution, and after that display?
if you have a Image on SDD/HDD than you just have to GraBitBlt() to resize it.

but you are "painting" your own Image and if your DC ( Device Context ) is shorter it will not display.
same like a Printer if you "print" outside Paper, both give wrong Result.

---

User can also use Windows Build Scale so Xbase++

Code: Select all

AppDeskTop():CurrentSize()
is not "native" Monitor Size !

remember that all "Windows" since Vista a "paint" from DWM so they a "virtuell". this is why

Code: Select all

nLogPixX := GetDeviceCaps(hDC,LOGPIXELSX)
will always return 96 which is wrong.
you need new Constante to get "native" Monitor Size to calculate Scale

Code: Select all

#define HWND_DESKTOP  0  
#define LOGPIXELSX 88 
#define LOGPIXELSY 90 
#define HORZRES 8 
#define VERTRES 10 
#define DESKTOPVERTRES 117 
#define DESKTOPHORZRES 118 

LOCAL aSize := AppDeskTop():CurrentSize()
// ot4xb Syntax
LOCAL hDC := @user32:GetDC( HWND_DESKTOP )
LOCAL nXLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSX )
LOCAL nYLogPixel := @Gdi32:GetDeviceCaps( hDC, LOGPIXELSY )
LOCAL nVERTRES   := @Gdi32:GetDeviceCaps( hDC, VERTRES    )
LOCAL nHORZRES   := @Gdi32:GetDeviceCaps( hDC, HORZRES    )
LOCAL nDHORZRES  := @Gdi32:GetDeviceCaps( hDC, DESKTOPHORZRES ) // native Monitor Size !
LOCAL nDVERTRES  := @Gdi32:GetDeviceCaps( hDC, DESKTOPVERTRES ) // native Monitor Size !
here same DLL Function in pure Xbase++

Code: Select all

DLLFUNCTION GetDC( nHWND ) USING STDCALL FROM USER32.DLL
DLLFUNCTION ReleaseDC( nHWND, nHDC ) USING STDCALL FROM USER32.DLL
DLLFUNCTION GetDeviceCaps( nHWND, nIndex ) USING STDCALL FROM GDI32.DLL
to "overrule" User Windows Build Scale i recommend to made your Xbase++ App DPI-Aware and enhance Manifest File with

Code: Select all

  <application xmlns="urn:schemas-microsoft-com:asm.v3">
       <windowsSettings xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">
           <dpiAware>true</dpiAware>
       </windowsSettings>
  </application>
greetings by OHR
Jimmy

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Virtual screen

#14 Post by Eugene Lutsenko »

Jimmy!

And could you post a working example that you can compile and try. The big picture is formed, but is not displayed and scaled with fewer pixels and then displayed.

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Virtual screen

#15 Post by Auge_Ohr »

Eugene Lutsenko wrote:And could you post a working example that you can compile and try.
do not understand what you want me to do ...
i just try to explain what work have to be done to get a Scale able Xbase++ App
Eugene Lutsenko wrote:The big picture is formed, but is not displayed and scaled with fewer pixels and then displayed.
:?: :?: :?:
it sound like i say before : you can't use a bigger DC (Presspace) than Monitor native have !
greetings by OHR
Jimmy

Victorio
Posts: 620
Joined: Sun Jan 18, 2015 11:43 am
Location: Slovakia

Re: Virtual screen

#16 Post by Victorio »

Eugene wrote :
But my question was different: if the program already creates an image with high resolution, is there a way to display it on the screen with the lower resolution scale it to a smaller resolution, and after that display?

If you need display only graphics images, can you do something like this ?

generate image (for example 2000x2000 pixels)
resample image to lower resolution (for example 600x600 pixels to preserve x-y , and this lower resolution you set by max resolution monitor)
show resampled image

Because I send you JPEG Resampler link, which know resample JPEG files to several types, set resolution, set size x,y pixels, size file etc.
Exist many resampler application, then you must run it with runshell as external app.
Best will be resampling by command line, if some soft has this support, and user not need know about processing resample.
Attachments
jpegres.gif
jpegres.gif (31.83 KiB) Viewed 13122 times

User avatar
Eugene Lutsenko
Posts: 1649
Joined: Sat Feb 04, 2012 2:23 am
Location: Russia, Southern federal district, city of Krasnodar
Contact:

Re: Virtual screen

#17 Post by Eugene Lutsenko »

Unfortunately, this assumes that the high resolution image exists. But the whole point is not to create it by the program execution with displaying on the screen, just somewhere in memory. And then to scale with the reduction and only then display.

User avatar
unixkd
Posts: 565
Joined: Thu Feb 11, 2010 1:39 pm

Re: Virtual screen

#18 Post by unixkd »

Hi Roger

You promised to write a sample on the above topic, any one available now ? This problem is still hanging

Joe

User avatar
Auge_Ohr
Posts: 1405
Joined: Wed Feb 24, 2010 3:44 pm

Re: Virtual screen

#19 Post by Auge_Ohr »

hi Eugene,

have you try to run "virtual" System :?:
you can change Resolution in "virtual" System but Maximum ist Host Resolution when used "Full Screen".

it is Window which will not display what is "outside" of Monitor Resolution

when connect a 2nd Monitor your Windows Desk expand and you got bigger Resolution.
there is also Software for "virtual" Desktop but you need real Monitor to get bigger Resolution "as one Screen"

---

Windows can Scale UP but not Down ...
when reduce from 1920 x 1080 to 1024 x 768 all must reduce and your Font go from e.g. 12 Point to 6 Point so hard to read :geek:

---

when use a Static which is bigger as Drawingarea than Dialog Window become Scrollbar.
so you can use a Static with 1920 x 1080 as Parent for your Control.
if Monitor is to small User have to use Scrollbar ... :whistle:
greetings by OHR
Jimmy

User avatar
rdonnay
Site Admin
Posts: 4722
Joined: Wed Jan 27, 2010 6:58 pm
Location: Boise, Idaho USA
Contact:

Re: Virtual screen

#20 Post by rdonnay »

You promised to write a sample on the above topic, any one available now ? This problem is still hanging
Try this:

Code: Select all

aScreenArea := DC_GetWorkArea()
aWindowSize := oDlg:currentSize()

nScale1 := (aScreenArea[3]-aScreenArea[1]) / aWindowSize[1]
nScale2 := (aScreenArea[4]-aScreenArea[2]) / aWindowSize[2]

aScale := { nScale1, nScale2, nScale1, nScale2, .t. }

DCGETOPTIONS SCALEFACTOR aScale
This requires that you know the size of the Dialog Window (oDlg:currentSize())
The eXpress train is coming - and it has more cars.

Post Reply