Formularios
Congelar la ventana
www.cssboulevar.com.ar/vb/codigos/?id=53
Public Declare Function LockWindowUpdate Lib "user32" (ByVal hwndLock As Long) As Long
'To freeze a window:
LockWindowUpdate hwnd
'To unlock the window:
LockWindowUpdate 0
Solo números
www.cssboulevar.com.ar/vb/codigos/?id=88
' place this in the 'Keypress' event of a text box
Const Number$ = "0123456789." ' only allow these characters
If KeyAscii <> 8 Then
If InStr(Number$, Chr(KeyAscii)) = 0 Then
KeyAscii = 0
Exit Sub
End If
End If
OR:
' Force numbers only in a text box
If IsNumeric(Chr(KeyAscii)) <> True Then KeyAscii = 0
Resize
www.vbcode.com/Asp/showsn.asp?theID=12923
'Created by Brendan Nichols
Use On load form: Call GetPos(Frm as Form, resize_text as boolean)
Notes:
Resize_text = true then text is resized as form is resized, resize_text must be the same in getpos as in resizeform
In form_resize:
Call ResizeForm(frm as form, resize_text as boolean)
Global Ratio(10000) As Double
Global x As Integer
Public Sub GetPos(Frm As Form, resize_text As Boolean)
x = 0
Dim c As Control
For Each c In Frm.Controls
Ratio(x) = c.Width / Frm.Width
Ratio(x + 1) = c.Height / Frm.Height
Ratio(x + 2) = c.Left / Frm.Width
Ratio(x + 3) = c.Top / Frm.Height
If c.FontSize > 0 And resize_text = True Then
Ratio(x + 4) = c.FontSize / (Frm.Height * Frm.Width)
x = x + 5
Else
x = x + 4
End If
Next c
End Sub
Public Sub ResizeForm(Frm As Form, resize_text As Boolean)
x = 0
Dim c As Control
For Each c In Frm.Controls
c.Width = Frm.Width * Ratio(x)
c.Height = Frm.Height * Ratio(x + 1)
c.Left = Frm.Width * Ratio(x + 2)
c.Top = Frm.Height * Ratio(x + 3)
If c.FontSize > 0 And resize_text = True Then
c.FontSize = Int((Frm.Height * Frm.Width) * Ratio(x + 4))
x = x + 5
Else
x = x + 4
End If
Next c
End Sub