|
-
August 11th, 2005, 09:07 AM
#1
number pixel
How can I determine number pixel in resolution?
-
August 11th, 2005, 11:44 AM
#2
Re: number pixel
Try to use Screen.Width and Screen.TwipsPerPixelX
You'll get needed values.
Vlad
-
August 12th, 2005, 03:56 AM
#3
Re: number pixel
You could also try:
Code:
Option Explicit
'Declarations
Private Declare Function GetDeviceCaps Lib _
"gdi32" (ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Const HORZRES = 8 'X axis in pixels
Private Const VERTRES = 10 'Y axis in pixels
Private Const BITSPIXEL = 12 'Number of bits per pixel
Dim i As Integer
Private Sub cmdChange_Click() 'access the Desktop Properties Window
Call Shell("rundll32.exe shell32.dll,Control_RunDLL desk.cpl")
End Sub
Private Sub Form_Load()
Dim x, y, bp, ncol As Long
x = GetDeviceCaps(Me.hdc, HORZRES)
y = GetDeviceCaps(Me.hdc, VERTRES)
MsgBox "Current Resolution is " & x & " X " & y & " Pixels"
If x > 800 And y > 600 Or x < 800 And y < 600 Then
MsgBox "This Program Is Designed In 600 By 800 Mode, " _
& "Please Reset Your Resolution Settings To Get The Best Effect"
End
End If
bp = GetDeviceCaps(Me.hdc, BITSPIXEL) 'get the bits per pixel
MsgBox "Current Resolution Has " & bp & " Bits / Pixels"
ncol = 1
For i = 1 To bp 'determine number of colours
ncol = ncol * 2
Next
MsgBox "Number Of Colors Is " & ncol
End Sub
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
|