我无法以某种方式找到使用Bunifu UI在文本框上放置水印或占位符的属性。我需要它用于凭证文本框。我找到了一个源代码,它只适用于普通文本框,但不适用于Bunifu Textbox。
这是我的代码:
TblChecks::with('person')->get()->groupBy('person.category');
这是我发现的原始代码:
Imports System.Runtime.InteropServices
Public Class Login
Private Sub Login_Load(sender As Object, e As EventArgs) Handles MyBase.Load
Me.CenterToParent()
BunifuTextbox2._TextBox.PasswordChar = "*"
SetCueText(BunifuTextbox1, "Username")
SetCueText(BunifuTextbox2, "Password")
End Sub
Private Sub BunifuTextbox1_OnTextChange(sender As Object, e As EventArgs) Handles BunifuTextbox1.OnTextChange
End Sub
End Class
Public Module CueBannerText
<DllImport("user32.dll", CharSet:=CharSet.Auto)> _
Private Function SendMessage(ByVal hWnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, <MarshalAs(UnmanagedType.LPWStr)> ByVal lParam As String) As Int32
End Function
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As IntPtr, ByVal hWnd2 As IntPtr, ByVal lpsz1 As String, ByVal lpsz2 As String) As IntPtr
Private Const EM_SETCUEBANNER As Integer = &H1501
Public Sub SetCueText(cntrl As Control, text As String)
If TypeOf cntrl Is Bunifu.Framework.UI.BunifuDropdown Then
Dim Edit_hWnd As IntPtr = FindWindowEx(cntrl.Handle, IntPtr.Zero, "Edit", Nothing)
If Not Edit_hWnd = IntPtr.Zero Then
SendMessage(Edit_hWnd, EM_SETCUEBANNER, 0, text)
End If
ElseIf TypeOf cntrl Is Bunifu.Framework.UI.BunifuTextbox Then
SendMessage(cntrl.Handle, EM_SETCUEBANNER, 0, text)
End If
End Sub
End Module
答案 0 :(得分:1)
如上所述,BunifuTextBox
包含常规的WinForms文本框。您找到的代码是为这样的文本框设计的,因此您只需为{{1>}的 基础文本框 设置提示横幅:
BunifuTextBox
(这使用您找到的原始SetCueText(BunifuTextbox1._TextBox, "Username")
代码)