Quantcast
Channel: VBForums - Visual Basic 6 and Earlier
Viewing all articles
Browse latest Browse all 21843

[RESOLVED] Drawing a Color Border around TextBox - Need modification

$
0
0
Dears,

I have downloaded the code to draw color border around text box, it is working fine if text boxes are placed on Form, the code is not working if text boxes are placed in Frame Control. I need help to make it possible.
The code is as under

In Module
Code:

Public ctl As Control

Public Sub drawborder(cntl As Control, inout)
    createborder cntl.Parent, cntl.Top - 30, cntl.Left - 30, cntl.Top + cntl.Height + 15, cntl.Left + cntl.Width + 15, inout
End Sub

Public Sub eraseborder(cntl As Control)
    createborder cntl.Parent, cntl.Top - 30, cntl.Left - 30, cntl.Top + cntl.Height + 15, cntl.Left + cntl.Width + 15, 2
End Sub

Public Sub createborder(formf As Form, topf, leftf, bottf, rightf, inout)
If inout = 0 Then
    Dim clr1 As Long, clr2 As Long, au As Long
    clr1& = RGB(66, 158, 238) ''QBColor(8)
    clr2& = RGB(66, 158, 238) ''QBColor(15)
   
    End If
    au& = formf.AutoRedraw
    formf.AutoRedraw = True
    formf.Line (leftf, topf)-(rightf, topf), clr1
    formf.Line (leftf, topf)-(leftf, bottf), clr1
    formf.Line (leftf, bottf)-(rightf + 15, bottf), clr2
    formf.Line (rightf, topf)-(rightf, bottf + 15), clr2
    formf.AutoRedraw = au&
End Sub


Public Sub GoDraw(frm As Form)
    For Each ctl In frm.Controls
        If TypeOf ctl Is TextBox _
        Or TypeOf ctl Is CommandButton Then
           
            drawborder ctl, 0
        End If
    Next

In Form
Code:

Private Sub Form_Load()
    GoDraw Me
End Sub


Viewing all articles
Browse latest Browse all 21843

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>