首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > VB Dotnet >

QQ签字式文本框控件

2013-06-26 
QQ签名式文本框控件Public Class QQ好友列表控件Public Shared Items() As ContentsItemShared ContentSiz

QQ签名式文本框控件



Public Class QQ好友列表控件
    Public Shared Items() As ContentsItem
    Shared ContentSize As Integer = 60

    Public Shared Event ContentsClick(ByVal Index As Integer, ByVal Open As Boolean)
    Public Shared Event ContentClick(ByVal ContentIndex As Integer, ByVal ContentsIndex As Integer)

    Shared Sub RaiseContentsClick(ByVal Index As Integer, ByVal Open As Boolean)
        RaiseEvent ContentsClick(Index, Open)
    End Sub '供目录类和子项类调用的事件触发过程

    Shared Sub RaiseContentClick(ByVal ContentIndex As Integer, ByVal ContentsIndex As Integer)
        RaiseEvent ContentClick(ContentIndex, ContentsIndex)
    End Sub '供目录类和子项类调用的事件触发过程

    Class ContentsItem
        Inherits Label
        Dim pb As PictureBox
        Public DetailInfo() As ContentItem
        Property myKey As String
        Property OpenSwitch As Boolean = False
        Property Index As Integer
        Dim myBottom As Integer
        Protected Overrides Sub OnCreateControl()
            MyBase.OnCreateControl()
            MyBase.Size = New Size(MyBase.Parent.Size.Width, 20)
            MyBase.Font = New Font("微软雅黑", 9.5)
            myBottom = MyBase.Bottom
            OpenSwitch = False
            MyBase.BackColor = Color.GhostWhite
            pb = New PictureBox
            With pb
                .Image = My.Resources._1
                .Size = New Size(20, 20)
                .Location = New Point(0, 0)
            End With
            MyBase.Controls.Add(pb)
        End Sub

        Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)


            MyBase.OnMouseUp(e)
            If OpenSwitch Then
                pb.Image = My.Resources._1
                OpenSwitch = Not OpenSwitch
                CloseMe()
            Else
                pb.Image = My.Resources._2
                OpenSwitch = Not OpenSwitch
                OpenMe()
            End If
            QQ好友列表控件.RaiseContentsClick(Me.Index, OpenSwitch)
        End Sub

        Public Sub OpenMe()
            If Me.DetailInfo IsNot Nothing Then
                DetailInfo(0).Top = MyBase.Bottom
                DetailInfo(0).Visible = True
                For i As Integer = 1 To Me.DetailInfo.Length - 1
                    DetailInfo(i).Top = DetailInfo(i - 1).Bottom
                    DetailInfo(i).Visible = True
                Next
                myBottom = Me.Bottom + Me.DetailInfo.Length * ContentSize
            Else
                myBottom = Me.Bottom
            End If

            For i As Integer = Me.Index + 1 To Items.Length - 1
                'MsgBox(i - 1 & Items(i - 1).myBottom)
                If Items(i - 1).DetailInfo IsNot Nothing AndAlso Items(i - 1).OpenSwitch Then
                    Items(i).Top = Items(i - 1).Bottom + Items(i - 1).DetailInfo.Length * ContentSize
                Else
                    Items(i).Top = Items(i - 1).Bottom


                End If
                If Items(i).DetailInfo IsNot Nothing AndAlso Items(i).OpenSwitch Then
                    Items(i).DetailInfo(0).Top = Items(i).Bottom
                    For o As Integer = 1 To Items(i).DetailInfo.Length - 1
                        Items(i).DetailInfo(o).Top = Items(i).DetailInfo(o - 1).Bottom
                    Next
                End If
            Next
        End Sub

        Public Sub CloseMe()
            If Not Me.DetailInfo Is Nothing Then
                For i = 0 To Me.DetailInfo.Length - 1
                    Me.DetailInfo(i).Visible = False
                Next
                For i As Integer = Me.Index + 1 To Items.Length - 1
                    Items(i).MoveMe(-Me.DetailInfo.Length * ContentSize)
                Next
            End If
        End Sub

        Public Sub MoveMe(ByVal VMoveArg As Integer)
            For i As Integer = 0 To DetailInfo.Length - 1
                DetailInfo(i).Top += VMoveArg
            Next
            MyBase.Top += VMoveArg
        End Sub

        Protected Overrides Sub OnMouseEnter(ByVal e As System.EventArgs)
            MyBase.OnMouseEnter(e)
            MyBase.BackColor = Color.orange
        End Sub

        Protected Overrides Sub OnMouseLeave(ByVal e As System.EventArgs)
            MyBase.OnMouseLeave(e)


            If Not Me.OpenSwitch Then
                MyBase.BackColor = Color.GhostWhite
            End If
        End Sub

        Public Sub AddDetailInfo(ByVal theName As String, ByVal theKey As String)
            If Me.DetailInfo Is Nothing Then
                ReDim Me.DetailInfo(0)
                Me.DetailInfo(0) = New ContentItem
            Else
                ReDim Preserve Me.DetailInfo(Me.DetailInfo.Length)
                Me.DetailInfo(Me.DetailInfo.Length - 1) = New ContentItem
                Me.DetailInfo(Me.DetailInfo.Length - 1).Top = Me.DetailInfo(Me.DetailInfo.Length - 2).Bottom
            End If
            Me.DetailInfo(Me.DetailInfo.Length - 1).theName = theName
            Me.DetailInfo(Me.DetailInfo.Length - 1).theKey = theKey
            Me.DetailInfo(Me.DetailInfo.Length - 1).Index = Me.DetailInfo.Length - 1
            Me.DetailInfo(Me.DetailInfo.Length - 1).ParentIndex = Me.Index
            MyBase.Parent.Controls.Add(Me.DetailInfo(Me.DetailInfo.Length - 1))
        End Sub

        Class ContentItem
            Inherits Label
            WithEvents pb As PictureBox
            Public WithEvents lblNickName As Label
            Public WithEvents lblStatus As Label
            Public WithEvents lblSub As Label
            Property theName As String
            Property theKey As String
            Property mouseEnterColor As Color = Color.PaleTurquoise
            Property mouseLeaveColor As Color = Color.GhostWhite
            Public Index As Integer
            Public ParentIndex As Integer




            Protected Overrides Sub OnCreateControl()
                MyBase.OnCreateControl()
                MyBase.BackColor = Color.GhostWhite
                MyBase.Visible = False
                MyBase.Size = New Size(MyBase.Parent.Size.Width, ContentSize)
                MyBase.Font = New Font("微软雅黑", 8)
                pb = New PictureBox
                With pb
                    .SizeMode = PictureBoxSizeMode.StretchImage
                    .Image = My.Resources.face
                    .Size = New Size(ContentSize - 14, ContentSize - 14)
                    .Location = New Point(7, 7)
                    .BorderStyle = BorderStyle.FixedSingle
                End With

                lblNickName = New Label
                With lblNickName
                    .Text = "new lblMain"
                    '.Size = New Size(MyBase.Size.Width - ContentSize, 20)
                    .Location = New Point(ContentSize, 5)
                    .BackColor = Color.Transparent
                    .AutoSize = True
                    .Font = New Font("微软雅黑", 9)
                End With

                lblStatus = New Label
                With lblStatus
                    .Text = "new lblstatus"
                    '.Size = New Size(MyBase.Width - lblNickName.Right, 20)


                    .Location = New Point(lblNickName.ClientRectangle.Right, 4)
                    .Left = lblNickName.ClientRectangle.Right
                    .ForeColor = Color.Gray
                    .BackColor = Color.Transparent
                    .AutoSize = True
                    .Font = New Font("微软雅黑", 9)
                    .BringToFront()
                End With

                lblSub = New Label
                With lblSub
                    .Text = "new lblSub"
                    .Size = New Size(MyBase.Size.Width - ContentSize, 20)
                    .Location = New Point(ContentSize, 20)
                    .ForeColor = Color.Gray
                    .BackColor = Color.Transparent
                    .AutoSize = True
                    .Font = New Font("微软雅黑", 9)
                End With
                MyBase.Controls.Add(pb)
                MyBase.Controls.Add(lblNickName)
                MyBase.Controls.Add(lblStatus)
                MyBase.Controls.Add(lblSub)
            End Sub

            Public Sub SetStatusText(ByVal Text As String)
                lblStatus.Text = Text
                lblStatus.Left = lblNickName.Width + lblNickName.Left + 5
            End Sub
#Region "鼠标事件触发器"


            Protected Overrides Sub OnMouseUp(ByVal e As System.Windows.Forms.MouseEventArgs)
                MyBase.OnMouseUp(e)
                QQ好友列表控件.RaiseContentClick(ParentIndex, Me.Index)
            End Sub

            Private Sub lblMain_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblNickName.MouseUp
                QQ好友列表控件.RaiseContentClick(ParentIndex, Me.Index)
            End Sub

            Private Sub lblStatus_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblStatus.MouseUp
                QQ好友列表控件.RaiseContentClick(ParentIndex, Me.Index)
            End Sub

            Private Sub lblSub_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles lblSub.MouseUp
                QQ好友列表控件.RaiseContentClick(ParentIndex, Me.Index)
            End Sub

            Private Sub pb_MouseUp(ByVal sender As Object, ByVal e As System.Windows.Forms.MouseEventArgs) Handles pb.MouseUp
                QQ好友列表控件.RaiseContentClick(ParentIndex, Me.Index)
            End Sub
#End Region



下载地址http://download.csdn.net/detail/asdghosdf/3984308
[解决办法]
美女楼主
[解决办法]
顶,支持原创!
[解决办法]
支持,先占据有利地形。。
[解决办法]
支持,先占据有利地形。。
[解决办法]
感谢分享。是原创么?
[解决办法]
很漂亮
[解决办法]
厉害 很不错哦。。。。
[解决办法]
被题目骗了,我要签名的那个控件啊~
------解决方案--------------------


资源怎么没人下载啊。QQ签字式文本框控件
[解决办法]
嘿嘿看着不错顶下!!
[解决办法]
收藏了...不错哈...
[解决办法]
谢谢分享。。不过突然觉得用WPF应该挺好做的
[解决办法]
好像很漂亮的样子啊QQ签字式文本框控件
[解决办法]
nice。。 谢谢
[解决办法]
顶,支持原创! 

[解决办法]
不错不错...支持了...
有木有C#的版本....
我是懒人.哈哈...
[解决办法]
不错,支持原创
[解决办法]
不知道怎么用!
[解决办法]
QQ签名式文本框控件 呢?
[解决办法]
恩,写的真好  有登录控件吗?

热点排行