|
-
Oct 27th, 2001, 11:48 AM
#1
Thread Starter
Addicted Member
Screen Resulation Problem
I have made an application using 1024 X 768 (That's my computer's screen) but my customer has 800 X 600 and it cannot be increased because of the crapy video card. All forms are big for him.
Is there anyway of fixing that problem without changing his screen resulation?
Thanks in advance
Ideas are dime a dozen.
People who put them into action are priceless.
-
Oct 27th, 2001, 11:50 AM
#2
Junior Member
I would say make smaller forms, but that probably doesn't help you much.
-
Oct 27th, 2001, 11:52 AM
#3
Thread Starter
Addicted Member
That's a lot of work because there are so many form in my applicaiton.
Any other way please
Ideas are dime a dozen.
People who put them into action are priceless.
-
Oct 27th, 2001, 12:03 PM
#4
I wonder how many charact
You have to use a form resize module that resizes the forms and controls to fit the proper resolution...
As far as what the customer has right now, its too late... you'd have to send him an updated program that resizes the forms to fit 800x600....
-
Oct 27th, 2001, 12:08 PM
#5
Hyperactive Member
this is the answer u want.......
try this tutorial from VBworld. this should solve your problem.
http://www.vbworld.com/graphics/screenres/
-
Oct 27th, 2001, 12:13 PM
#6
I wonder how many charact
put this in a module in your project...
call the routine in this module, Resize_for_resolution() in your form load event, passing the form as the parameter.
Public Xtwips As Integer, Ytwips As Integer
Public Xpixels As Integer, Ypixels As Integer
Type FRMSIZE
Height As Long
Width As Long
End Type
Public RePosForm As Boolean
Public DoResize As Boolean
Sub Resize_For_Resolution(MyForm As Form)
Dim lngGraphfontsize As Long
Dim i As Integer
Dim SFFont As Single
Dim yesnosmallfonts As Boolean
yesnosmallfonts = SmallFonts()
lnggraphsize = 10
SFY = 1
If yesnosmallfonts = True Then SFY = 1.28
SFX = SFY
SFFont = (SFX + SFY) / 2 ' average scale
' Size the Controls for the new resolution
On Error Resume Next ' for read-only or nonexistent properties
With MyForm
For i = 0 To .Count - 1
If TypeOf .Controls(i) Is ComboBox Then ' cannot change Height
.Controls(i).Left = .Controls(i).Left * SFX
.Controls(i).Top = .Controls(i).Top * SFY
.Controls(i).Width = .Controls(i).Width * SFX
Else
.Controls(i).Move .Controls(i).Left * SFX, _
.Controls(i).Top * SFY, _
.Controls(i).Width * SFX, _
.Controls(i).Height * SFY
End If
' Be sure to resize and reposition before changing the FontSize
lngGraphfontsize = 10
If TypeOf .Controls(i) Is MSChart Then
If yesnosmallfonts = False Then lngGraphfontsize = 8
' Get a reference to the x axis
Set currentaxis = .Controls(i).Plot.Axis(VtChAxisIdX)
' Loop though and set the font of each label
For Each currentlabel In currentaxis.Labels
currentlabel.VtFont.Size = lngGraphfontsize
Next currentlabel
' get a reference to the y axis
Set currentaxis = .Controls(i).Plot.Axis(VtChAxisIdY)
' loop through and set the font of each label
For Each currentlabel In currentaxis.Labels
currentlabel.VtFont.Size = lngGraphfontsize
Next currentlabel
.Controls(i).Title.VtFont.Size = lngGraphfontsize
Else
.Controls(i).FontSize = .Controls(i).FontSize * SFFont
End If
Next i
If RePosForm Then
' Now size the Form
.Move .Left * SFX, .Top * SFY, .Width * SFX, .Height * SFY
End If
End With
End Sub
-
Oct 27th, 2001, 12:14 PM
#7
I wonder how many charact
Put this code in another module in your project... it is needed by the previous code to determine if the system font size is set to small or large..because that can also extend your forms...
'*----------------------------------------------------------*
'* Purpose : Returns true if the system is using small *
'* : fonts, false if using large fonts *
'*----------------------------------------------------------*
'* Parameters : None *
'*----------------------------------------------------------*
'* Return : TRUE if the system is using small fonts, *
'* : FALSE if using large fonts *
'*----------------------------------------------------------*
'* Comments : Source: the MS KB article Q152136. *
'*----------------------------------------------------------*
Public Function SmallFonts() As Boolean
Dim hdc As Long
Dim hWnd As Long
Dim PrevMapMode As Long
Dim tm As TEXTMETRIC
' Set the default return value to small fonts
SmallFonts = True
' Get the handle of the desktop window
hWnd = GetDesktopWindow()
' Get the device context for the desktop
hdc = GetWindowDC(hWnd)
If hdc Then
' Set the mapping mode to pixels
PrevMapMode = SetMapMode(hdc, MM_TEXT)
' Get the size of the system font
GetTextMetrics hdc, tm
' Set the mapping mode back to what it was
PrevMapMode = SetMapMode(hdc, PrevMapMode)
' Release the device context
ReleaseDC hWnd, hdc
' If the system font is more than 16 pixels high,
' then large fonts are being used
If tm.tmHeight > 16 Then SmallFonts = False
End If
End Function
-
Oct 27th, 2001, 12:15 PM
#8
I wonder how many charact
Use the call to Resize_For_Resolution as listed below in every form_load() event in your program...
Public Sub form_load()
ScaleMode = 1 ' twips
Resize_For_Resolution Me
end sub
-
Oct 27th, 2001, 12:16 PM
#9
Frenzied Member
Although it is too late now, in the future you might want to program at 800X600, and make sure your program is atleast usable at 640X480. That is what I do.
If you must code at higher resolutions, you might want to create an application that has nothing but one form set at 800X600. You could then test your forms as you go by running that app and then resizing your forms to fit that area.
I think forcing people to run at 1024X768 is unreasonable.
Greg
Free VB Add-In - The Reference Librarian
Click Here for screen shot and download link.
-
Oct 27th, 2001, 12:59 PM
#10
PowerPoster
well
I agree. But uynless you a distibuting video card with your apps, you will always be stuck...
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Oct 27th, 2001, 05:16 PM
#11
Hyperactive Member
There's a simple explanation to this: Use DirectDraw7 (DirectX7) to change the monitor resolution. Now I know you said that you didn't wanna do this, but it really is the fastest and easiest. The only thing is... the user has to have DirectX7 installed on his/her computer. Or you could use ChangeDisplaySettings API to change resolution without using DirectX.
[vbcode]
' comment
Rem remark
[/vbcode]
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|