| | |
| | | using System; |
| | | using System.Collections.Generic; |
| | | using System.Drawing; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using static System.Net.Mime.MediaTypeNames; |
| | | |
| | | namespace DPumpHydr.WinFrmUI.Volute |
| | | { |
| | | public class GlobalResource |
| | | { |
| | | public static string ResourcesPath = @"Data\MainForm\Icons"; |
| | | public static string tipTrailingIcon = "alert-square-rounded.png";//输入框前缀 标必须图片 |
| | | public static string tipLeadingIcon = "north-star.png";//输入框后缀 标警告图片 |
| | | |
| | | /// <summary> |
| | | /// 图片 |
| | | /// 输入框前缀 标必须图标 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static System.Drawing.Image GetTipTrailingIcon() |
| | | { |
| | | System.Drawing.Image image = null; |
| | | if (tipTrailingIcon != null) |
| | | { |
| | | image = GlobalResource.BuildImage(tipTrailingIcon); |
| | | } |
| | | return image; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 输入框后缀 标警告图标 |
| | | /// </summary> |
| | | /// <returns></returns> |
| | | public static System.Drawing.Image GetLeadingIcon() |
| | | { |
| | | System.Drawing.Image image = null; |
| | | if (tipLeadingIcon != null) |
| | | { |
| | | image = GlobalResource.BuildImage(tipLeadingIcon); |
| | | } |
| | | return image; |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 指定大小图片 |
| | | /// </summary> |
| | | /// <param name="path">文件夹路径(编译路径下的)</param> |
| | | /// <param name="filename">文件名</param> |
| | | /// <returns></returns> |
| | | public static System.Drawing.Image BuildImage( string filename,int size ) |
| | | public static System.Drawing.Image BuildImage( string filename,int widthsize ,int heightsize ) |
| | | { |
| | | var image = BuildImage( filename); |
| | | if (image == null) |
| | | return null; |
| | | if (size > 0) |
| | | if (widthsize > 0 && heightsize > 0) |
| | | { |
| | | System.Drawing.Image thumbnail = image.GetThumbnailImage(size, size, () => false, IntPtr.Zero); |
| | | System.Drawing.Image thumbnail = image.GetThumbnailImage(widthsize, heightsize, () => false, IntPtr.Zero); |
| | | return thumbnail; |
| | | } |
| | | else |
| | |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 路径、文件名拼接 |
| | | /// 原大小图片 |
| | | /// </summary> |
| | | /// <param name="path">路径</param> |
| | | /// <param name="filename">文件名</param> |