Ajuste de la Resolución de pantalla en una aplicación de Visual Basic
Quisiera saber como se controla la resolución de pantalla en una aplicación de VB por medio de código.
Calcular la profundidad de color (bits por pixel) y resolución de Windows:
Crear un formulario y un TextBox y escribir:
Private Declare Function GetDeviceCaps Lib "gdi32"
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Sub Form_Load()
Dim col, bit, largo, alto As Integer
col = GetDeviceCaps(Form1.hdc, 12)
If col = 1 Then
bit = GetDeviceCaps(Form1.hdc, 14)
If bit = 1 Then
Text1.Text = "Resolucion de 1 bit / 2 colores"
ElseIf bit = 4 Then
Text1.Text = "Resolucion de 4 bits / 16 colores"
End If
ElseIf col = 8 Then
Text1.Text = "Resolucion de 8 bits / 256 colores"
ElseIf col = 16 Then
Text1.Text = "Resolucion de 16 bits / 65000 colores"
Else
Text1.Text = "Resolucion de 16 M colores"
End If
largo = GetDeviceCaps(Form1.hdc, 8)
alto = GetDeviceCaps(Form1.hdc, 10)
Text1.Text = Text1.Text & " " & largo & "x" & alto & " pixels"
End Sub
ESPERO SEA LO QUE BUSCAS
[email protected]
Crear un formulario y un TextBox y escribir:
Private Declare Function GetDeviceCaps Lib "gdi32"
(ByVal hdc As Long, ByVal nIndex As Long) As Long
Private Sub Form_Load()
Dim col, bit, largo, alto As Integer
col = GetDeviceCaps(Form1.hdc, 12)
If col = 1 Then
bit = GetDeviceCaps(Form1.hdc, 14)
If bit = 1 Then
Text1.Text = "Resolucion de 1 bit / 2 colores"
ElseIf bit = 4 Then
Text1.Text = "Resolucion de 4 bits / 16 colores"
End If
ElseIf col = 8 Then
Text1.Text = "Resolucion de 8 bits / 256 colores"
ElseIf col = 16 Then
Text1.Text = "Resolucion de 16 bits / 65000 colores"
Else
Text1.Text = "Resolucion de 16 M colores"
End If
largo = GetDeviceCaps(Form1.hdc, 8)
alto = GetDeviceCaps(Form1.hdc, 10)
Text1.Text = Text1.Text & " " & largo & "x" & alto & " pixels"
End Sub
ESPERO SEA LO QUE BUSCAS
[email protected]