NEWS

[DEVEXPRESS] Tutorial Hide and Show TextBox Password C#

[DEVEXPRESS] Tutorial Hide and Show TextBox Password C#
Đăng bởi: Thảo Meo - Lượt xem: 4000 09:36:47, 31/10/2022DEVEXPRESS   In bài viết

Xin chào các bạn, bài viết hôm nay mình sẻ tiếp tục hướng dẫn các bạn cách ẩn và hiển thị mật khẩu trên TextBox Devexpress C#.

[DEVEXPRESS] Tutorial Hide and Show Password Textbox C#

Dưới đây, là giao diện demo ứng dụng:

hide_show_password

Các bước thực hiện các bạn có thể theo dõi ở video step by step:

Ở project này, chúng ta sẻ sử dụng control ButtonEdit trên Devexpress ra để sử dụng:

Và chúng ta viết sự kiện ở Event Button_Press.

Hai tấm hình icon để hiển thị password, các bạn có thể sử dụng ImageCollection để đưa chúng vào từ thư viện hình ảnh Devexpress.

Full source code C#:

namespace WindowsFormsApp1
{
    public partial class XtraForm2 : DevExpress.XtraEditors.XtraForm
    {
        public XtraForm2()
        {
            InitializeComponent();
        }

        private void buttonEdit1_ButtonPressed(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            var tagAction = buttonEdit1.Tag.ToString();
            if (tagAction == "hide")
            {
                buttonEdit1.Properties.Buttons[0].ImageOptions.Image = imageCollection1.Images[1]; // image hide
                buttonEdit1.Tag = "show";
                buttonEdit1.Properties.UseSystemPasswordChar = false;
            }
            else {
                buttonEdit1.Properties.Buttons[0].ImageOptions.Image = imageCollection1.Images[0]; // image show
                buttonEdit1.Tag = "hide";
                buttonEdit1.Properties.UseSystemPasswordChar = true;
            }
        }
    }
}

Thanks for watching!

DOWNLOAD SOURCE

THÔNG TIN TÁC GIẢ

BÀI VIẾT LIÊN QUAN

[DEVEXPRESS] Tutorial Hide and Show TextBox Password C#
Đăng bởi: Thảo Meo - Lượt xem: 4000 09:36:47, 31/10/2022DEVEXPRESS   In bài viết

CÁC BÀI CÙNG CHỦ ĐỀ

Đọc tiếp
.