怎样让Label标签里的字体垂直对中 在一个lable里面再放一个lable,后一个lable不要边框,resize=true,透明的。将后一个lable放到前一个lable的中间位置(垂直方向) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 我的方法比较笨,就是用两个Label来做,一个做背景,一个做前景,然后根据前景Label的高度来计算他在背景Label中的相对位置! 我是想用一个可垂直对中的label来建一个ActiveX控件。用你们的方法好像效率低了一点。还有其他高效一点的解决方案么? Private Sub Command1_Click()Dim i As IntegerDim g As StringFor i = 1 To Len(Text1.Text) g = Mid(Text1.Text, i, 1) Label1.Caption = Label1.Caption & g & vbCrLfNext iEnd Sub 最高效的方法:放弃Label控件计算好坐标直接在窗体hDC上画出来如果硬要用Label的话只有用两个Label 或 用vbCrLf换行 自己写用户控件 。例如在用户控件中添加以下属性代码: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同理可以做出左对齐,右对齐,上对齐,下对齐的样式。自己研究吧 CityBird(鹰扬九州)的方法就是最好的方法,利用这种方法还可以实现别的效果。 如何登录一个论坛并发帖 自定义对象可以作为函数的可选参数吗? excel中用vb编辑隐藏功能的问题?? 在form上指定位置写字???在线等待,来者有分,信誉之上! 软件的试用版该如何做? 多表打印 用excel绘制表格 up有分. …………………………感谢uguess(uguess)! datareport报表问题 masked text box 怎样使用? 散分:终于张个一个三角。高兴! 初学者的困惑 me函数
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
放弃Label控件
计算好坐标
直接在窗体hDC上画出来如果硬要用Label的话
只有用两个Label 或 用vbCrLf换行
例如在用户控件中添加以下属性代码:
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
同理可以做出左对齐,右对齐,上对齐,下对齐的样式。自己研究吧