- [VB.NET] Lấy địa chỉ Bios Serial Number trên Winform
- [C#] Giới thiệu và sử dụng thư viện AutoMapper
- [DEVEXPRESS] Hướng dẫn Custom Summary in Footer trong Gridview C#
- [C#] Dependency Injection in Winform
- [SQLSERVER] Hướng dẫn tìm kiếm nâng cao trên sql
- [C#] Hướng dẫn sử dụng SetTimeOut trên Winform like Javascript
- [DATABASE] In cây thông noel bằng sqlserver
- [C#] Hướng dẫn fix lỗi hiển thị UTF-8 khi sử dụng WebClient Download String
- [DATABASE] Hướng dẫn mã hóa và giải mã sử dụng thuật toán AES 256 trên sqlserver
- [DATABASE] Base64 Encode and Decode trong Sqlserver
- [C#] Vì Mẹ anh bắt phải Fake địa chỉ MacAddress
- [C#] Hướng dẫn xuất dữ liệu từ DataGridview ra file Excel
- [C#] Hướng dẫn khởi động lại chương trình ứng dụng winform
- [C#] Sự khác nhau giữa String.IsNullOrEmpty và String.IsNullOrWhiteSpace
- [C#] Hướng dẫn đọc file hình ảnh định dạng WEBP và chuyển đổi WebP sang JPG
- [C#] Kiểm tra phiên bản Microsoft Office đang sử dụng trên máy tính
- [C#] Hướng dẫn chuyển đổi tập tin hình ảnh XPS sang Bitmap
- [C#] Giới thiệu Component WebView2 của Microsoft
- [C#] Hướng dẫn lưu tất cả hình ảnh từ File Excel vào thư mục window
- [DATABASE] Hướng dẫn import và export hình ảnh image từ Sqlserver
[DEVEXPRESS] Hướng dẫn tạo splash screen Overlay Loading Winform
Xin chào các bạn, bài viết hôm nay mình sẽ hướng dẫn tiếp các bạn cách tạo Overlay Loading (splash screen) trên Devexpress C#.
Khi các bạn thực hiện một công việc gì đó, mà thời gian xử lý hơi lâu một tí, các bạn có thể show loading lên, để cho người dùng biết là hệ thống đang xử lý.
Trong bài này, mình sẽ ví dụ cho các bạn trên công cụ GridControl của Devexpress.
Ví dụ: khi grid control của các bạn đang load dữ liệu thì các bạn có thể show Overlay Loading này ra, và đóng lại nó khi dữ liệu đã load xong.
Dưới đây là hình ảnh demo ứng dụng Overlay Loading Devexpress C#:
Source code C#:
using DevExpress.XtraSplashScreen;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace OverlayLoading
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void btn_show_Click(object sender, EventArgs e)
{
bool useFadeIn = false;
bool useFadeOut = false;
Color backColor = Color.Black;
Color foreColor = Color.Black;
double opacity = 0.5;
Image waitImage = Image.FromFile("loading.png");
OverlayWindowOptions options = new OverlayWindowOptions(
useFadeIn,
useFadeOut,
backColor,
foreColor,
opacity,
waitImage);
handle = ShowProgressPanel(options);
}
IOverlaySplashScreenHandle ShowProgressPanel(OverlayWindowOptions option)
{
return SplashScreenManager.ShowOverlayForm(panel1, option);
}
void CloseProgressPanel(IOverlaySplashScreenHandle handle)
{
if (handle != null)
SplashScreenManager.CloseOverlayForm(handle);
}
IOverlaySplashScreenHandle handle = null;
private void btn_hide_Click(object sender, EventArgs e)
{
CloseProgressPanel(handle);
}
}
}
HAVE FUN :)