// COPYRIGHT (C) Tom. ALL RIGHTS RESERVED.
// THE AntdUI PROJECT IS AN WINFORM LIBRARY LICENSED UNDER THE Apache-2.0 License.
// LICENSED UNDER THE Apache License, VERSION 2.0 (THE "License")
// YOU MAY NOT USE THIS FILE EXCEPT IN COMPLIANCE WITH THE License.
// YOU MAY OBTAIN A COPY OF THE LICENSE AT
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING, SOFTWARE
// DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
// SEE THE LICENSE FOR THE SPECIFIC LANGUAGE GOVERNING PERMISSIONS AND
// LIMITATIONS UNDER THE License.
// GITEE: https://gitee.com/antdui/AntdUI
// GITHUB: https://github.com/AntdUI/AntdUI
// CSDN: https://blog.csdn.net/v_132
// QQ: 17379620
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Windows.Forms;
namespace AntdUI
{
///
/// Preview 图片预览
///
/// 图片预览框。
public static class Preview
{
///
/// Preview 图片预览
///
/// 配置
public static Form? open(this Config config)
{
if (config.Form.IsHandleCreated)
{
if (config.Form.InvokeRequired)
{
Form? frm2 = null;
config.Form.Invoke(new Action(() =>
{
frm2 = open(config);
}));
return frm2;
}
var frm = new LayeredFormPreview(config);
frm.Show(config.Form);
return frm;
}
return null;
}
///
/// 配置
///
public class Config
{
///
/// Preview 配置
///
/// 所属窗口
/// 图片
public Config(Form form, Image bmp) : this(form, new Image[] { bmp }) { }
///
/// Preview 配置
///
/// 所属窗口
/// 多个图片
public Config(Form form, IList bmps)
{
Form = form;
Content = bmps;
ContentCount = bmps.Count;
}
///
/// Preview 配置
///
/// 所属窗口
/// 数据
/// 回调
public Config(Form form, IList