关于VB2010怎么样 textbox或者richtextbox背景设置为透明(或者插入图片)的问题

kadgai 2014-05-23 11:27:39
关于VB2010怎么样 textbox或者richtextbox背景设置为透明(或者插入图片)的问题
...全文
493 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
kadgai 2014-05-28
  • 打赏
  • 举报
回复
2L:下面是照你的方式写出来的,在点击label的时候出现的效果还是出现文本的颜色,还有一点就是label只能显示本页面不能拉伸(滚动条动能)所以显示的效果不是很好,请问有没有其他不省事的方法,WPF我还没接触
Public Class Form3

    Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Label1.BackColor = Color.Transparent
        Label1.BorderStyle = 1
        Label1.Text = ""
        TextBox1.Visible = False
        TextBox1.Text = ""
    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.Close()
    End Sub

    Private Sub Label1_Click1(ByVal sender As Object, ByVal e As System.EventArgs) Handles Label1.Click
        TextBox1.Visible = True
        TextBox1.Focus()
    End Sub

    Private Sub TextBox1_LostFocus(ByVal sender As Object, ByVal e As System.EventArgs) Handles TextBox1.LostFocus
        Label1.Text = TextBox1.Text
        TextBox1.Visible = False
    End Sub
End Class
kadgai 2014-05-28
  • 打赏
  • 举报
回复
引用 2 楼 of123 的回复:
最省事的做法:将 TextBox 叠放在 Label 上
Option Explicit

Private Sub Form_Load()
    Label1.BackStyle = 0
    Label1.BorderStyle = 1
    Label1.Caption = ""
    Text1.Visible = False
    Text1.Text = ""
End Sub

Private Sub Label1_Click()
    Text1.Visible = True
    Text1.SetFocus
End Sub

Private Sub Text1_LostFocus()
    Label1.Caption = Text1.Text
    Text1.Visible = False
End Sub
我用的是VB2010,你说这种方法我在网上见到过。 不过现在已经找到透明的方法了,出现了另外一个问题 文本出现滚动条之后只要滚动信息就会模糊
kadgai 2014-05-23
  • 打赏
  • 举报
回复
控件本身不支持透明,哪怎样才可以变成透明呢?请教各位高人
of123 2014-05-23
  • 打赏
  • 举报
回复
最省事的做法:将 TextBox 叠放在 Label 上
Option Explicit

Private Sub Form_Load()
    Label1.BackStyle = 0
    Label1.BorderStyle = 1
    Label1.Caption = ""
    Text1.Visible = False
    Text1.Text = ""
End Sub

Private Sub Label1_Click()
    Text1.Visible = True
    Text1.SetFocus
End Sub

Private Sub Text1_LostFocus()
    Label1.Caption = Text1.Text
    Text1.Visible = False
End Sub

1,453

社区成员

发帖
与我相关
我的任务
社区描述
VB 控件
社区管理员
  • 控件
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧