在一个lable里面再放一个lable,后一个lable不要边框,resize=true,透明的。将后一个lable放到前一个lable的中间位置(垂直方向)

解决方案 »

  1.   

    我的方法比较笨,就是用两个Label来做,一个做背景,一个做前景,然后根据前景Label的高度来计算他在背景Label中的相对位置!
      

  2.   

    我是想用一个可垂直对中的label来建一个ActiveX控件。用你们的方法好像效率低了一点。还有其他高效一点的解决方案么?
      

  3.   

    Private Sub Command1_Click()
    Dim i As Integer
    Dim g As String
    For i = 1 To Len(Text1.Text)
     g = Mid(Text1.Text, i, 1)
     Label1.Caption = Label1.Caption & g & vbCrLf
    Next i
    End Sub
      

  4.   

    最高效的方法:
    放弃Label控件
    计算好坐标
    直接在窗体hDC上画出来如果硬要用Label的话
    只有用两个Label 或 用vbCrLf换行
      

  5.   

    自己写用户控件 。
    例如在用户控件中添加以下属性代码:
    public proprety let caption(byval New_Caption as string)
        m_strCaption=New_Caption  '保存属性值
        
        usercontrol.cls    '清除控件显示内容
        
        '垂直居中
        usercontrol.currenty=(usercontrol.height-usercontrol.textheight(New_Caption))/2
        
        '水平居中
        usercontrol.currentx=(usercontrol.width-usercontrol.textwidth(New_Caption))/2    usercontrol.print New_Caption '显示文本
    end property
    同理可以做出左对齐,右对齐,上对齐,下对齐的样式。自己研究吧
      

  6.   

    CityBird(鹰扬九州)的方法就是最好的方法,利用这种方法还可以实现别的效果。