Edit: Basic4ppc version 6.30 includes a new compilation target: Forced QVGA. In this method VGA screens will behave as regular QVGA screens, making it simpler to target both VGA and QVGA devices.
Windows Mobile devices come with two types of screens.
The regular QVGA screen: 240 * 320 (regular), 240 * 240 (square screen) or 320 * 240 (landscape).
High resolution screens - VGA: 480 * 640 (regular), 480 * 480 (square screen) or 640 * 480 (landscape).
VGA devices use a special mechanism to properly show applications which were not designed for VGA screens. It is called pixel doubling.
Each pixel is doubled and the result is a pseudo lower resolution screen (QVGA).
Non-optimized compiled applications use pixel doubling. Therefore your application will show exactly the same on VGA and QVGA screens.
Optimized compiled applications do not use this method (.Net CF 2.0 restriction).
This allows you to take advantage of the higher resolution screen.
However if you don't explicitly handle VGA screens, your application will not show properly on such devices.
The following code automatically changes the layout of all controls to match the VGA screen:
	
	
	
	
	
	
	
		
			
			
			
			
			
		
	
	
	
		
	
	
		
	
'Controls' is an array that later holds all controls.
Somewhere in the beginning of the program you should check one of the forms height (doesn't matter which form), and call ChangeToVGA if necessary.
ChangeToVGA should only be called once and it will handle all the controls on all forms.
* Calendars controls do not show properly on VGA screens (with the optimized compiler). It will be fixed in the future.
* The image in ImageButtons and Images controls not in cStretchImage mode will be smaller on VGA screens. You should use two sets of images in that case.
			
			Windows Mobile devices come with two types of screens.
The regular QVGA screen: 240 * 320 (regular), 240 * 240 (square screen) or 320 * 240 (landscape).
High resolution screens - VGA: 480 * 640 (regular), 480 * 480 (square screen) or 640 * 480 (landscape).
VGA devices use a special mechanism to properly show applications which were not designed for VGA screens. It is called pixel doubling.
Each pixel is doubled and the result is a pseudo lower resolution screen (QVGA).
Non-optimized compiled applications use pixel doubling. Therefore your application will show exactly the same on VGA and QVGA screens.
Optimized compiled applications do not use this method (.Net CF 2.0 restriction).
This allows you to take advantage of the higher resolution screen.
However if you don't explicitly handle VGA screens, your application will not show properly on such devices.
The following code automatically changes the layout of all controls to match the VGA screen:
			
				B4X:
			
		
		
		Sub Globals
    Dim Controls(0)
End Sub
Sub App_Start
    If form1.Height > 400 Then ChangeToVGA
    Form1.Show
End Sub
Sub ChangeToVGA
    Controls() = GetControls("")
    For i = 0 To ArrayLen(Controls())-1
        Select ControlType(Controls(i))
            Case "ListBox","NumUpDown","Button","TextBox","Label","ComboBox","Panel","RadioBtn","Table","ImageButton","CheckBox","Image"
                Control(Controls(i)).Left = 2 * Control(Controls(i)).Left
                Control(Controls(i)).Top = 2 * Control(Controls(i)).Top
                Control(Controls(i)).Height = 2 * Control(Controls(i)).Height
                Control(Controls(i)).Width = 2 * Control(Controls(i)).Width
'*** Uncomment these lines if your application includes Tables.
'                If ControlType(Controls(i)) = "Table" Then
'                    tbl = Controls(i)
'                    For i2 = 0 To Control(tbl,Table).ColCount-1
'                        col = Control(tbl,Table).ColName(i2)
'                        Control(tbl,Table).ColWidth(col) = Control(tbl,Table).ColWidth(col) * 2
'                    Next
'                End If
        End Select
    Next
End Sub
	Somewhere in the beginning of the program you should check one of the forms height (doesn't matter which form), and call ChangeToVGA if necessary.
ChangeToVGA should only be called once and it will handle all the controls on all forms.
* Calendars controls do not show properly on VGA screens (with the optimized compiler). It will be fixed in the future.
* The image in ImageButtons and Images controls not in cStretchImage mode will be smaller on VGA screens. You should use two sets of images in that case.