Jump to content

Resolution Estimation Error


Recommended Posts

Hi,

I made a small blunder with my code. I created the GUI under 1920x1080 resolution however, my user is configured to ONLY 1080x720 and cannot go any further than that.

What do you guys think is the best way to correct this one? Resolution mathematics is something that came to mind however I do not have access to his PC to check  from time to time if  my estimation is correct and the resolution on my PC doesn't go down to 1080x720.

Please help. :(

~XN~

;) ~XN~ ;)

Link to comment
Share on other sites

The easiest way could be to check the user's resolution and apply a ratio when creating gui, controls and so on

Global $s
$res = _GetCurrentDisplaySettings()
;$s = 1080/1920
$s = $res/1920
_Gui()

While 1
Sleep(10)
Wend


Func _Gui()
Global $gui = GUICreate("test", 345*$s, 218*$s, 192, 124)
Global $List = GUICtrlCreateList("", 168*$s, 48*$s, 169*$s, 73*$s)
Global $btn1 = GUICtrlCreateButton("Button1", 144*$s, 168*$s, 97*$s, 33*$s)
Global $btn2 = GUICtrlCreateButton("Button2", 249*$s, 168*$s, 87*$s, 33*$s)
Global $btn3 = GUICtrlCreateButton("Button3", 8*$s, 32*$s, 145*$s, 33*$s)
Global $Label1 = GUICtrlCreateLabel(" This is a label...", 8*$s, 8*$s, 324*$s, 17*$s)
GUISetState()
EndFunc

Func _GetCurrentDisplaySettings()
Dim $Obj_WMIService = ObjGet('winmgmts:\\.\root\cimv2')
    Dim $Col_Items = $Obj_WMIService.ExecQuery('Select * from Win32_VideoController')
    For $Obj_Item In $Col_Items
        $curHR = $Obj_Item.CurrentHorizontalResolution
        $curVR = $Obj_Item.CurrentVerticalResolution
    Next
;msgbox(0,"", $curHR & " x " & $curVR)
Return $curHR
EndFunc

 

Link to comment
Share on other sites

 

8 minutes ago, mikell said:

he easiest way could be to check the user's resolution and apply a ratio when creating gui, controls and so on

Thank you so much. This is a very plausible way to do it and I really get the idea, believe me I do. However, I have a dynamic set of codes and at least 600 lines for GUI alone. Im not really sure if time would be on my side for that. :'( 

~XN~

 

;) ~XN~ ;)

Link to comment
Share on other sites

1 minute ago, Earthshine said:

could you post some code?

$Form1_1 = GUICreate("Smart_Wrapper v1.2.7", 323, 947, 1580, 0, $ws_popup + $ws_caption, BitOR($WS_EX_TOPMOST, $WS_EX_WINDOWEDGE))
GUISetBkColor(0xFFFFFF)
$ButPause = GUICtrlCreateButton("Pause", 98, 108, 128, 31)
GUICtrlSetFont(-1, 14, 800, 0, "MS Sans Serif")
$TimerLab = GUICtrlCreateLabel($defText, 0, 64, 320, 40, $SS_CENTER)
GUICtrlSetFont(-1, 26, 800, 0, "Lucida Sans Unicode")
GUISetIcon(@WorkingDir & "\digital_river.ico ")
;~ ====================TAB 1======================================
$Tab1 = GUICtrlCreateTab(0, 144, 321, 801)
GUICtrlSetFont(-1, 10, 400, 0, "Arial")
$TabSheet1 = GUICtrlCreateTabItem("Resolutions")
GUICtrlSetState(-1, $GUI_SHOW)
$ResoLab = GUICtrlCreateLabel("Proposed Resolutions/s:", 8, 210, 175, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$editResolution = GUICtrlCreateEdit("", 8, 228, 305, 281, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
$DateLab = GUICtrlCreateLabel("Ordered: N/A", 80, 179, 133, 20, $SS_LEFT)
GUICtrlSetFont(-1, 11.5, 800, 0, "MS Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$dtpDate = GUICtrlCreateDate("2018/01/03 23:56:10", 216, 177, 98, 24, 0)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$butGetter = GUICtrlCreateButton("Physical", 11, 175, 67, 24)
GUICtrlSetFont(-1, 10, 800, 0, "MS Serif")
$GCommentLab = GUICtrlCreateLabel("GC Documentation:", 8, 530, 136, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$editGComments = GUICtrlCreateEdit("", 8, 548, 305, 113, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlSetFont(-1, 11, 800, 0, "Arial")
$inOrderNumber = GUICtrlCreateInput("", 176, 517, 137, 24, BitOR($GUI_SS_DEFAULT_INPUT, $ES_CENTER))
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$butGComment = GUICtrlCreateButton("Open GC && Copy", 182, 663, 128, 25)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
$notesLab = GUICtrlCreateLabel("Contact Notes:", 8, 682, 105, 20)
GUICtrlSetFont(-1, 10, 800, 0, "MS Sans Serif")
GUICtrlSetBkColor(-1, 0xFFFFFF)
$editNotes = GUICtrlCreateEdit("", 8, 700, 305, 161, BitOR($ES_AUTOVSCROLL, $ES_WANTRETURN, $WS_VSCROLL), BitOR($WS_EX_CLIENTEDGE, $WS_EX_STATICEDGE))
GUICtrlSetFont(-1, 11, 800, 0, "Arial")

 

;) ~XN~ ;)

Link to comment
Share on other sites

I can't compile that. I am willing to look, but I am not going to make your script work if it does not already. Post the whole thing.

Note to OP. I can see why you are having great difficulty now. Just look at that mess. Nothing formatted, no requirements for variable to be declared before usage, monolithic code (not broken into logical functions for maintainability). If you seriously want help I suggest you post the whole thing, you can attach files if you need to.

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

3 hours ago, XaelloNegative said:

However, I have a dynamic set of codes and at least 600 lines for GUI alone.

You need to reconfigure your code then, that's far too many lines for a GUI set up, even WITH dynamic controls. Use loops and arrays, and then use variables for the parameters so you only have to change them once, and not for each line.

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...