NEWS

[DEVEXPRESS] Hướng dẫn tạo splash screen Overlay Loading Winform

[DEVEXPRESS] Hướng dẫn tạo splash screen Overlay Loading Winform
Đăng bởi: Thảo Meo - Lượt xem: 9582 10:48:33, 03/11/2018C#   In bài viết

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#:

overlay_loading

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 :)

DOWNLOAD SOURCE

THÔNG TIN TÁC GIẢ

BÀI VIẾT LIÊN QUAN

[DEVEXPRESS] Hướng dẫn tạo splash screen Overlay Loading Winform
Đăng bởi: Thảo Meo - Lượt xem: 9582 10:48:33, 03/11/2018C#   In bài viết

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

Đọc tiếp
.