Home > Software engineering >  How about VB2010 textbox or richtextbox set the background to transparent (or insert picture)
How about VB2010 textbox or richtextbox set the background to transparent (or insert picture)

Time:10-08

How about VB2010 textbox or richtextbox set the background to transparent (or insert picture)

CodePudding user response:

Control itself does not support transparent, which how to just can become transparent? Consult everybody down

CodePudding user response:

The most convenient approach: TextBox stacked on the 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

CodePudding user response:

refer to the second floor of123 response:
is the most convenient approach: TextBox stacked on the 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

I am using VB2010, you said this method I saw on the net,
But it has been found the transparent method, another problems
After the text appears the scroll bar just scrolling information will blur

CodePudding user response:

2 l: here is the way you write, when click the label effect is the color of the text, and is the label can display this page can't stretch (kinetic scroll bar) so the display effect is not very good, is there anyone there is any other method of save trouble, I haven't contact with WPF
 Public Class Form3 

Private Sub Form3_Load (ByVal sender As System. Object, ByVal e the 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 the As System. EventArgs) Handles for. Click
Me. The Close ()
End Sub

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

Private Sub TextBox1_LostFocus (ByVal sender As Object, ByVal e the As System. EventArgs) Handles TextBox1. LostFocus
Label1. Text=TextBox1. Text
TextBox1. Visible=False
End Sub
End the Class
  • Related