实现RadioButton自动换行

  

 

  '如果一行显示不完,则多行显示
    Private Sub rbKey0TextReload(ByVal rbKey0 As RadioButton)
        Dim textSize As Size = TextRenderer.MeasureText(rbKey0.Text, rbKeyA.Font) '文字的大小
        Dim radiobuttonSize As Size = rbKey0.Size '选框的大小
        Dim hang As Integer = 0 '要显示几行
        hang = textSize.Width \ radiobuttonSize.Width
        If textSize.Width Mod radiobuttonSize.Width > 0 Then
            hang = hang + 1
        End If
        rbKey0.Size = New Size(radiobuttonSize.Width, hang * 21)
    End Sub

posted @ 2010-06-05 13:14  扬中源  阅读(1148)  评论(0编辑  收藏  举报