707 lines
26 KiB
C#
707 lines
26 KiB
C#
/******************************
|
|
* 说明:自定义图片控件(数据库存放图片地址)
|
|
* 创建人:龚宇超
|
|
* 创建日期:2017-08-07
|
|
* 修改人:
|
|
* 修改日期:
|
|
* 修改备注:
|
|
* 版本:1.0.0.0
|
|
******************************/
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
using System.Drawing;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Windows.Forms;
|
|
using System.IO;
|
|
using System.Reflection;
|
|
using DevExpress.XtraEditors.Controls;
|
|
using DevExpress.XtraEditors;
|
|
using Lskj.Util;
|
|
using Lskj.Business.Impl;
|
|
using Lskj.Control.Model;
|
|
using System.Threading;
|
|
using Lskj.Business;
|
|
using System.Net;
|
|
using Lskj.Model;
|
|
|
|
namespace Lskj.Control
|
|
{
|
|
/// <summary>
|
|
/// 自定义图片控件
|
|
/// </summary>
|
|
public partial class LabelImageEdit : BaseUserControl
|
|
{
|
|
private bool _isInit = true;
|
|
/// <summary>
|
|
/// 当前图片路径
|
|
/// </summary>
|
|
public string CurrentImagePath = string.Empty;
|
|
/// <summary>
|
|
/// 图片控件
|
|
/// </summary>
|
|
public PictureEdit TextEdit { get { return imgFile; } }
|
|
|
|
//public event UnionEventHander UnionEvent;
|
|
public event UploadEventHander UploadEvent;
|
|
public event DeleteEventHander DeleteEvent;
|
|
|
|
/// <summary>
|
|
/// 关联回调事件
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void UnionEventHander(object sender);
|
|
/// <summary>
|
|
/// 上传回调事件
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void UploadEventHander(object sender);
|
|
/// <summary>
|
|
/// 删除回调事件
|
|
/// </summary>
|
|
/// <param name="sender">The sender.</param>
|
|
public delegate void DeleteEventHander(object sender);
|
|
/// <summary>
|
|
/// 配置的文件地址
|
|
/// </summary>
|
|
public string DownloadUrl;
|
|
|
|
public LabelImageEdit()
|
|
{
|
|
InitializeComponent();
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:设置控件显示文本</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="text">显示Lebel文本</param>
|
|
public override string LabelText
|
|
{
|
|
get
|
|
{
|
|
return this.lblText.Text;
|
|
}
|
|
set
|
|
{
|
|
this.lblText.Text = value;
|
|
if (FontSize > 0)
|
|
{
|
|
this.plLeft.Dock = DockStyle.Left;
|
|
this.plLeft.AutoSize = false;
|
|
this.lblText.AutoSize = false;
|
|
this.lblText.Dock = System.Windows.Forms.DockStyle.Fill;
|
|
this.lblText.Location = new System.Drawing.Point(0, 0);
|
|
this.lblText.TextAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
|
this.plLeft.Width = value.Length * GetCharWidth();
|
|
|
|
GetCharWidthMultilingual(this.lblText, this.lblText.Text, this.plLeft);
|
|
}
|
|
else
|
|
{
|
|
this.plLeft.Width = this.lblText.Width + PaddingLeft;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 字体大小
|
|
/// </summary>
|
|
/// <value>The size of the control.</value>
|
|
public override float FontSize
|
|
{
|
|
get
|
|
{
|
|
return base.FontSize;
|
|
}
|
|
set
|
|
{
|
|
base.FontSize = value;
|
|
if (value > 0)
|
|
{
|
|
this.lblText.Font = new Font(this.lblText.Font.FontFamily, value);
|
|
this.TextEdit.Font = new Font(this.TextEdit.Font.FontFamily, value);
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:是否为空</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-06 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if this instance is empty; otherwise, <c>false</c>.</returns>
|
|
/// <value>The is empty.</value>
|
|
public override bool IsEmpty()
|
|
{
|
|
return base.Model != null && base.Model.IsEmpty && this.imgFile.Image == null;
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:图片是否改变</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-11-08 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <returns><c>true</c> if this instance is update; otherwise, <c>false</c>.</returns>
|
|
public override bool IsUpdate()
|
|
{
|
|
return false;
|
|
}
|
|
/// <summary>
|
|
/// 只读文本颜色
|
|
/// </summary>
|
|
/// <value>The color of the read only label.</value>
|
|
public override bool ReadOnly
|
|
{
|
|
get
|
|
{
|
|
return base.ReadOnly;
|
|
}
|
|
set
|
|
{
|
|
base.ReadOnly = value;
|
|
this.imgFile.Properties.ReadOnly = value;
|
|
this.lblText.ForeColor = value ? base.ReadOnlyLabelForceColor : Required ? base.RequiredLabelForceColor : base.DefaultLabelForceColor;
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// 必填文本颜色
|
|
/// </summary>
|
|
/// <value>The color of the required label.</value>
|
|
public override bool Required
|
|
{
|
|
get
|
|
{
|
|
return base.Required;
|
|
}
|
|
set
|
|
{
|
|
base.Required = value;
|
|
if (value)
|
|
{
|
|
this.lblText.ForeColor = base.RequiredLabelForceColor;
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:加载图片(先检测本地,不存在则从服务器下载)</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2018-02-27 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="fileId">The file value.</param>
|
|
public void LoadImage(string fileId, bool isInit = true)
|
|
{
|
|
try
|
|
{
|
|
if (string.IsNullOrWhiteSpace(fileId)) this.DownloadUrl = "";
|
|
|
|
// fieldValue:对应附件表fileId
|
|
if (!string.IsNullOrEmpty(fileId))
|
|
{
|
|
this._isInit = isInit;
|
|
|
|
string relativePath = BaseModuleImpl.GetFileServerPath(fileId);
|
|
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, relativePath });
|
|
string localPath = tempPath.Replace(Path.GetFileName(tempPath), "");
|
|
|
|
// 检查目录是否存在
|
|
if (!Directory.Exists(localPath))
|
|
Directory.CreateDirectory(localPath);
|
|
|
|
if (File.Exists(tempPath))
|
|
{
|
|
// 本地加载
|
|
this.TextEdit.Image = new Bitmap(File.OpenRead(tempPath));
|
|
}
|
|
else
|
|
{
|
|
// 服务器下载
|
|
string filePath = Path.Combine(SystemInfo.Instance.ServerAttachPath, relativePath);
|
|
AttachHelper.DownLoadFile(this.Handle, filePath);
|
|
}
|
|
this.CurrentImagePath = tempPath;
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
try
|
|
{
|
|
if (!string.IsNullOrEmpty(fileId))
|
|
{
|
|
this._isInit = isInit;
|
|
string downUrl = fileId;
|
|
if (!downUrl.StartsWith("http"))
|
|
{
|
|
string OAUrl = !string.IsNullOrEmpty(SystemInfo.Instance.OAUrl) && SystemInfo.Instance.OAUrl.EndsWith("/") ? SystemInfo.Instance.OAUrl : SystemInfo.Instance.OAUrl + "/";
|
|
downUrl = OAUrl + downUrl;
|
|
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, "LabelImageEditFileLoad"+ Guid.NewGuid().ToString().Replace("-", "") + ".jpg" });
|
|
HttpWebRequest request = (HttpWebRequest)WebRequest.Create(downUrl);
|
|
request.Method = "GET";
|
|
WebResponse response = request.GetResponse();
|
|
Stream stream = new FileStream(tempPath, FileMode.Create, FileAccess.ReadWrite);
|
|
byte[] bArr = new byte[1024];
|
|
int size = response.GetResponseStream().Read(bArr, 0, (int)bArr.Length);
|
|
while (size > 0)
|
|
{
|
|
stream.Write(bArr, 0, size);
|
|
size = response.GetResponseStream().Read(bArr, 0, (int)bArr.Length);
|
|
}
|
|
stream.Close();
|
|
response.GetResponseStream().Close();
|
|
response.Close();
|
|
|
|
Image image = null;
|
|
bool isImage = true;
|
|
try
|
|
{
|
|
image = Image.FromFile(tempPath);
|
|
}
|
|
catch (Exception)
|
|
{
|
|
isImage = false;
|
|
}
|
|
if (image != null && isImage)
|
|
{
|
|
this.TextEdit.Image = image;
|
|
//this.TextEdit.Image.Dispose();
|
|
}
|
|
else
|
|
{
|
|
this.TextEdit.Image = global::Lskj.Control.Properties.Resources.file;
|
|
}
|
|
this.CurrentImagePath = tempPath;
|
|
DownloadUrl = downUrl;
|
|
}
|
|
}
|
|
}
|
|
catch (Exception e)
|
|
{
|
|
|
|
}
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存图片到本地</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="prefix">图片前缀</param>
|
|
/// <returns>返回存放的地址</returns>
|
|
public string SaveImageToLocal(string prefix)
|
|
{
|
|
try
|
|
{
|
|
Image img = this.imgFile.Image;
|
|
if (img != null)
|
|
{
|
|
string fileName = prefix + "_" + Guid.NewGuid().ToString().Replace("-", "") + ".jpg";
|
|
string tempPath = Path.Combine(new string[] { PubUtil.ImageDownloadPath, fileName });
|
|
|
|
this.CurrentImagePath = tempPath;
|
|
// 不存在创建目录
|
|
if (!Directory.Exists(Path.Combine(new string[] { PubUtil.ImageDownloadPath })))
|
|
{
|
|
Directory.CreateDirectory(Path.Combine(PubUtil.ImageDownloadPath));
|
|
}
|
|
if (!File.Exists(tempPath))
|
|
{
|
|
Bitmap bitmap = new Bitmap(img);
|
|
bitmap.Save(tempPath);
|
|
}
|
|
|
|
return (File.Exists(tempPath)) ? tempPath : string.Empty;
|
|
}
|
|
}
|
|
catch (Exception)
|
|
{
|
|
}
|
|
return string.Empty;
|
|
}
|
|
|
|
#region 右键菜单事件
|
|
|
|
/// <summary>
|
|
/// 预览图片
|
|
/// </summary>
|
|
/// <param name="sender"></param>
|
|
/// <param name="e"></param>
|
|
private void tsmi_Preview_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
string url = string.Format(this.DownloadUrl, ERPInfo.Instance.UserName, ERPInfo.Instance.Password, "", "0");
|
|
if (string.IsNullOrWhiteSpace(url)) return;
|
|
// 固定传入参数(窗口标题、操作员ID、操作员名称、权限、模版编号)
|
|
string[] defaultArgs = string.Format(ModuleArgs.DefaultArgs, "预览", ERPInfo.Instance.UserId, ERPInfo.Instance.UserName, "2", "").Split('~');
|
|
string[] menuArgs = new string[] { "", "", url };
|
|
string[] args = defaultArgs.Concat(menuArgs).ToArray();
|
|
IForm form = FormHelper.LoadDllForm("Lskj.PubBrower.dll", args);
|
|
DialogResult result = form.SubForm.ShowDialog();
|
|
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
|
|
/// <summary>
|
|
/// <para>说明:剪切图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_cut_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.CurrentImagePath = string.Empty;
|
|
InvokeMenuMethod(getMenu(imgFile), "OnClickedCut");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:拷贝图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_copy_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
InvokeMenuMethod(getMenu(imgFile), "OnClickedCopy");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:粘贴图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_paste_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.CurrentImagePath = string.Empty;
|
|
InvokeMenuMethod(getMenu(imgFile), "OnClickedPaste");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:删除图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_delete_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
this.CurrentImagePath = string.Empty;
|
|
InvokeMenuMethod(getMenu(imgFile), "OnClickedDelete");
|
|
if (DeleteEvent != null)
|
|
{
|
|
DeleteEvent(this);
|
|
}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:加载图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_load_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
if (UploadEvent != null)
|
|
{
|
|
UploadEvent(this);
|
|
}
|
|
//InvokeMenuMethod(getMenu(imgFile), "OnClickedLoad");
|
|
//OpenFileDialog openFileDialog = new OpenFileDialog();
|
|
//if (openFileDialog.ShowDialog() == DialogResult.OK)
|
|
//{
|
|
// if (!string.IsNullOrEmpty(openFileDialog.FileName))
|
|
// {
|
|
// Image image = null;
|
|
// bool isImage = true;
|
|
// try
|
|
// {
|
|
// image = Image.FromFile(openFileDialog.FileName);
|
|
// }
|
|
// catch (Exception)
|
|
// {
|
|
// isImage = false;
|
|
// }
|
|
// if (image != null && isImage)
|
|
// {
|
|
// this.imgFile.Image = image;
|
|
// }
|
|
// else
|
|
// {
|
|
// this.imgFile.Image = global::Lskj.Control.Properties.Resources.file;
|
|
// }
|
|
// this.CurrentImagePath = openFileDialog.FileName;
|
|
// }
|
|
// else
|
|
// {
|
|
// this.CurrentImagePath = string.Empty;
|
|
// }
|
|
//}
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:保存图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
private void tsmi_save_Click(object sender, EventArgs e)
|
|
{
|
|
try
|
|
{
|
|
InvokeMenuMethod(getMenu(imgFile), "OnClickedSave");
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:关联其他图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
//private void tsmi_union_Click(object sender, EventArgs e)
|
|
//{
|
|
// try
|
|
// {
|
|
// if (UnionEvent != null)
|
|
// {
|
|
// UnionEvent(this);
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
// MessageUtil.Show(Message, ex.Message);
|
|
// }
|
|
|
|
//}
|
|
/// <summary>
|
|
/// <para>说明:上传图片</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
|
|
//private void tsmi_upload_Click(object sender, EventArgs e)
|
|
//{
|
|
// try
|
|
// {
|
|
// if (UploadEvent != null)
|
|
// {
|
|
// UploadEvent(this);
|
|
// }
|
|
// }
|
|
// catch (Exception ex)
|
|
// {
|
|
// string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
// MessageUtil.Show(Message, ex.Message);
|
|
// }
|
|
//}
|
|
#endregion
|
|
|
|
#region 其它事件
|
|
/// <summary>
|
|
/// <para>说明:打开右键菜单之前</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="CancelEventArgs"/> instance containing the event data.</param>
|
|
protected void cmsMenu_Opening(object sender, CancelEventArgs e)
|
|
{
|
|
try
|
|
{
|
|
bool isImage = imgFile.Image == null;
|
|
|
|
tsmi_cut.Enabled = !isImage;
|
|
tsmi_copy.Enabled = !isImage;
|
|
|
|
tsmi_delete.Enabled = !isImage;
|
|
//tsmi_save.Enabled = !isImage;
|
|
|
|
tsmi_load.Enabled = true;
|
|
//tsmi_union.Enabled = true;
|
|
|
|
//tsmi_upload.Enabled = !isImage;
|
|
//tsmi_paste.Enabled = ClipboardHelper.ContainsImage();
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
MessageUtil.Show(Message, ex.Message);
|
|
}
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:打开大图查看</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="sender">The source of the event.</param>
|
|
/// <param name="e">The <see cref="MouseEventArgs"/> instance containing the event data.</param>
|
|
protected void imgFile_MouseDoubleClick(object sender, MouseEventArgs e)
|
|
{
|
|
//FrmImageDialog imageDialog = new FrmImageDialog();
|
|
//imageDialog.ImageSource = this.ImgFile.Image;
|
|
//imageDialog.ShowDialog();
|
|
}
|
|
#endregion
|
|
|
|
#region 扩展PictureEdit
|
|
/// <summary>
|
|
/// <para>说明:执行右键菜单方法</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="menu">The menu.</param>
|
|
/// <param name="name">The name.</param>
|
|
private void InvokeMenuMethod(PictureMenu menu, string name)
|
|
{
|
|
MethodInfo mi = typeof(PictureMenu).GetMethod(name, BindingFlags.NonPublic | BindingFlags.Instance);
|
|
if (mi != null && menu != null)
|
|
mi.Invoke(menu, new object[] { menu, new EventArgs() });
|
|
}
|
|
/// <summary>
|
|
/// <para>说明:获取右键菜单</para>
|
|
/// <para>创建人:龚宇超</para>
|
|
/// <para>创建日期:2017-08-07 </para>
|
|
/// <para>修改人:</para>
|
|
/// <para>修改日期:</para>
|
|
/// <para>修改备注:</para>
|
|
/// <para>版本:1.0</para>
|
|
/// </summary>
|
|
/// <param name="edit">The edit.</param>
|
|
/// <returns>PictureMenu.</returns>
|
|
///
|
|
private PictureMenu getMenu(PictureEdit edit)
|
|
{
|
|
PropertyInfo pi = typeof(PictureEdit).GetProperty("Menu", BindingFlags.NonPublic | BindingFlags.Instance);
|
|
if (pi != null)
|
|
return pi.GetValue(edit, null) as PictureMenu;
|
|
return null;
|
|
}
|
|
#endregion
|
|
|
|
|
|
}
|
|
}
|