- Trang chủ »
- Code , SoftDesign »
- Chỉnh sửa thông báo DevExpress (XtraMessageBox)
Đăng bởi : Nông Ngọc Hoài
6/17/2014
thuvienwinform - Mình rất là không thích những đoạn mà xen lấn tiếng anh, tiếng việt. Điển hình là các thông báo. Mặc định các nút đề là tiếng anh(OK, Yes, No, Cancel,...) chúng ta nên việt hóa toàn bộ. Vừa dễ dàng cho người sử dụng, vừa có được giao diện đẹp.
Công việc này khá đơn giản. Tạo 1 lớp (class) là xong!
Chú ý: cần thêm DevExpress.Data; và DevExpress.XtraEditors; (Add Reference)
using System; using System.Collections.Generic; using System.Linq; using System.Text; using DevExpress.XtraEditors.Controls; using DevExpress.Utils.Localization; namespace ThuVienWinform.ThongBaoDevExpress { //https://documentation.devexpress.com/#WindowsForms/CustomDocument1866 public class TuyChinhDevExpress : Localizer { public string Abort { set; get; } public string Cancel { set; get; } public string Ignore { set; get; } public string No { set; get; } public string Ok { set; get; } public string Retry { set; get; } public string Yes { set; get; } public TuyChinhDevExpress(string abort, string cancel, string ignore, string no, string ok, string retry, string yes) { this.Abort = abort; this.Cancel = cancel; this.Ignore = ignore; this.No = no; this.Ok = ok; this.Retry = retry; this.Yes = yes; } public override string GetLocalizedString(StringId id) { if (id == StringId.XtraMessageBoxAbortButtonText) return this.Abort; if (id == StringId.XtraMessageBoxCancelButtonText) return this.Cancel; if (id == StringId.XtraMessageBoxIgnoreButtonText) return this.Ignore; if (id == StringId.XtraMessageBoxNoButtonText) return this.No; if (id == StringId.XtraMessageBoxOkButtonText) return this.Ok; if (id == StringId.XtraMessageBoxRetryButtonText) return this.Retry; if (id == StringId.XtraMessageBoxYesButtonText) return this.Yes; return base.GetLocalizedString(id); } } }
Sử dụng:
Khai báo đoạn này trong sự kiện nạp (Form_load), hay trong tệp Program.cs đều được:
Chú ý: using DevExpress.XtraEditors.Controls;
Localizer.Active = new TuyChinhDevExpress("&Hủy bỏ", "&Hủy", "&Chấp nhận", "&Xác nhận", "&Được", "&Thử lại", "&Được");
Vậy là xong rồi!
Xem thêm :
Code,
SoftDesign
- Mời sử dụng Tool Import dữ liệu lên Wocommerce siêu tốc
- Mời tải về phần mềm tăng tương tác YouTube chỉ với 14k/tháng
- Bất đồng bộ với Entity Framework, tại sao không?
- Mời dùng thử phần mềm chuyển định dạng font chữ CF3
- Chú ý khi sử dụng ProgressBar
- Đóng gói phần mềm - Đặt tất cả thư viện liên kết động (DLL) vào 1 thư mục
- Tạo mã kích hoạt cho phần mềm
- Lấy IP của máy, địa chỉ IP và tên các máy trọng mạng nội bộ (LAN)
- Lỗi "operation is not valid due to the current state of the object"
- Gửi dữ liệu qua mạng với ThuVienWinform.Mang.GuiDuLieuNoiBo
- Các yêu cầu đóng gói phần mềm (có hoặc không có cơ sở dữ liệu)
- Chỉnh sửa thông báo DevExpress (XtraMessageBox)
- Thêm nút lên GridView của DevExpress bằng HyperLinkEdit
- Thêm thuộc tính, sự kiện cho các điểu khiển trong winform
- [SOFTWARE DESIGN] Thiết kế phần mềm theo mô hình 3 lớp Layer