Foxtable(狐表)用户栏目专家坐堂 → 这些代码都是用什么语言编写


  共有2065人关注过本帖树形打印复制链接

主题:这些代码都是用什么语言编写

帅哥哟,离线,有人找我吗?
kaituozhe
  1楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:九尾狐 帖子:2236 积分:15335 威望:0 精华:0 注册:2015/7/18 10:10:00
这些代码都是用什么语言编写  发帖心情 Post By:2017/7/9 10:03:00 [只看该作者]

这段代码我的目的是美化了一下文本框的显示,
   Public Sub BeautifyControls(ByVal e As WinForm.Form,ByVal _Values As String)
Dim Values() As String = _Values.Split(",")
For Index As Integer = 0 To Values.Length - 1
    Dim BeautifyControl As New BeautifyControl(e.Controls(Values(Index)))
Next

End Sub


Public Class BeautifyControl
    Private Control As WinForm.Control
    Private Label As WinForm.Label
    Public Sub New(ByVal _Control As WinForm.Control)

        Dim lbl As WinForm.Label
        lbl = _Control.Form.CreateControl("lable1", ControlTypeEnum.Label)
        lbl.Name = "lable-" & _Control.Name
        lbl.BackColor = Color.Transparent
        lbl.TextAlign = ContentAlignment.MiddleLeft
        _Control.Parent.AddControl(lbl)
        lbl.AutoSize = False
        lbl.SetBounds(_Control.Left, _Control.Top, _Control.Width, _Control.Height)
        lbl.Anchor = _Control.Anchor
        lbl.Dock = _Control.Dock


        Me.Control = _Control
        Me.Label = lbl
        Me.Control.Visible = False

        Dim ln As WinForm.Line = _Control.Form.CreateControl("lable1", ControlTypeEnum.Line)
        ln.Anchor = _Control.Anchor
        _Control.Parent.AddControl(ln)
        ln.Left = _Control.Left
        ln.Top = _Control.Top + _Control.Height - 16
        ln.Width = _Control.Width

        AddHandler lbl.BaseControl.Click, AddressOf Label_Click
        AddHandler lbl.BaseControl.VisibleChanged, AddressOf Label_VisibleChanged
        AddHandler Me.Control.BaseControl.Leave, AddressOf Control_Leave
    End Sub

    Private Sub Label_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Control.Visible = True
        Me.Control.Select()
        Me.Control.Form.Controls(Control.Name).BaseControl.SelectionLength = 0
        Me.Label.Visible = False
    End Sub

    Private Sub Label_VisibleChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
        If Me.Label.Visible = True Then
            If Me.Control.Form.ExistControl(Control.Name) Then
                If Me.Control.BindingField = Nothing Then
                    Me.Label.Text = Me.Control.Form.Controls(Control.Name).Value
                Else
                    Me.Label.BindingField = Me.Control.BindingField
                End If
                Me.Label.ForeColor = Me.Control.ForeColor
            End If
        End If
    End Sub
    '当文本控件不是活动控件的时候发生
    Private Sub Control_Leave(ByVal sender As System.Object, ByVal e As System.EventArgs)
        Me.Label.Visible = True
        Me.Control.Visible = False
    End Sub
End Class

 回到顶部
帅哥哟,离线,有人找我吗?
有点甜
  2楼 | 信息 | 搜索 | 邮箱 | 主页 | UC


加好友 发短信
等级:版主 帖子:85326 积分:427815 威望:0 精华:5 注册:2012/10/18 22:13:00
  发帖心情 Post By:2017/7/9 10:09:00 [只看该作者]

vb.net语言,foxtable用的就是vb.net语法。


 回到顶部