AppFrame




Public Sub DrawFrameOn(TopLeftControl As Control, _
LowRightControl As Control, _
Style As String, FrameWidth)
Dim dw, fs, sm
Dim st$
Dim Lft, Toplft, Hite
Dim Rite, Ritebotm
Dim lt As Long
Dim rb As Long

'Routine per disegnare una finestra intorno a qualsiasi controllo


'Variations can be achieved by changing "DrawWidth",

'shadow colors and the width of the frame

'elements in the form Paint Event


'Save the current settings

dw = DrawWidth
fs = FillStyle
sm = ScaleMode

DrawWidth = 1
FillStyle = 1
ScaleMode = 3

st = LCase(Left$(Style, 1))
Lft = TopLeftControl.Left
Toplft = TopLeftControl.Top
Hite = TopLeftControl.Height

Rite = LowRightControl.Left + LowRightControl.Width
Ritebotm = LowRightControl.Top + LowRightControl.Height

If Ritebotm > Hite Then Hite = Ritebotm

lt = vb3DHighlight
rb = vbButtonShadow

'Swap dei colori se viene richiesta l'inversione

If st = "i" Then
lt = vb3DDKShadow
rb = vb3DHighlight
End If

'Disegna la finestra

Line (Lft - FrameWidth, Toplft - FrameWidth)-(Rite + FrameWidth, Toplft - FrameWidth), lt
Line (Lft - FrameWidth, Toplft - FrameWidth)-(Lft - FrameWidth, Hite + FrameWidth), lt
Line (Rite + FrameWidth, Toplft - FrameWidth)-(Rite + FrameWidth, Ritebotm + FrameWidth), rb
Line (Rite + FrameWidth, Ritebotm + FrameWidth)-(Lft - FrameWidth, Hite + FrameWidth), rb

'Ristabilisce i settaggi originali

DrawWidth = dw
FillStyle = fs
ScaleMode = sm

End Sub classici metodi di utilizzo

DrawFrameOn Text1, Text1, "outward", 3
DrawFrameOn Command1, Command3, "outward", 4

DrawFrameOn Command4, Command6, "outward", 4
DrawFrameOn Command4, Command6, "inward", 1

DrawFrameOn pic1, pic1, "outward", 4
DrawFrameOn pic1, pic1, "inward", 1

DrawFrameOn Text2, Command7, "outward", 4
DrawFrameOn Text2, Command7, "inward", 1

DrawFrameOn Combo1, Combo1, "outward", 3










( appframe.html )- by Paolo Puglisi - Modifica del 17/12/2023