Hi !
I created a windows control with one password property. I would like that the password appear as "*" when typed in property window.
I tryed to create a TypeEditor for the password property and overrides the paintValue method, but this doesn't work. I have to problems in result : The "*" appears as a graphical element, not text, and the password still appears in clear text.
I don't know if I'm using the correct approach for this problem, can someone help ?
Thanks !
Public Class EditorSenha
Inherits System.Drawing.Design.UITypeEditor
Public Overloads Overrides Function GetEditStyle(ByVal context As System.ComponentModel.ITypeDescriptorContext) As System.Drawing.Design.UITypeEditorEditStyle
GetEditStyle = System.Drawing.Design.UITypeEditorEditStyle.None
End Function
Public Overloads Overrides Function GetPaintValueSupported(ByVal context As System.ComponentModel.ITypeDescriptorContext) As Boolean
Return (True)
End Function
Public Overloads Overrides Sub PaintValue(ByVal e As System.Drawing.Design.PaintValueEventArgs)
Dim o As Object = e.Value
Dim b As Brush = New SolidBrush(Color.Red)
Dim f As Font = New Font("Times New Roman", 10)
Dim g As Graphics = e.Graphics
g.DrawString("*****", f, b, e.Bounds.X, e.Bounds.Y)
End Sub
End Class
-----------------------
<Id>tZQxpQfLfU2bP2HEvv67rQ==</Id
Rami Saad - 09 May 2004 12:50 GMT
Hello,
Why don't you just use a normal text box, then sets its password character
property to the character you want? Such as the following:
textBox1.PasswordChar="*";
This will automatically make your text box act as password text box, with
the character you entered as property.
Hope this solves your problem.
Regards,
Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC
Rami Saad - 11 May 2004 11:57 GMT
Hello,
Why don't you just use a normal text box, then sets its password character
property to the character you want? Such as the following:
textBox1.PasswordChar="*";
This will automatically make your text box act as password text box, with
the character you entered as property.
Hope this solves your problem.
Regards,
Rami Saad
MEA Developer Support Center
ITworx on behalf of Microsoft EMEA GTSC