Commit 5bbfe64f HZH

字体文字

1 个父辈 6f4a1e6f
...@@ -66,6 +66,26 @@ namespace HZH_Controls.Controls ...@@ -66,6 +66,26 @@ namespace HZH_Controls.Controls
this.lbl.Image = value; this.lbl.Image = value;
} }
} }
private object imageFontIcons;
[DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)]
[Editor(typeof(ImagePropertyEditor), typeof(System.Drawing.Design.UITypeEditor))]
public object ImageFontIcons
{
get { return imageFontIcons; }
set
{
if (value == null || value is Image)
{
imageFontIcons = value;
if (value != null)
{
Image = (Image)value;
}
}
}
}
/// <summary> /// <summary>
/// 图片位置 /// 图片位置
/// </summary> /// </summary>
...@@ -96,7 +116,7 @@ namespace HZH_Controls.Controls ...@@ -96,7 +116,7 @@ namespace HZH_Controls.Controls
IsShowTips = false; IsShowTips = false;
base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102))))); base.BtnForeColor = ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(102)))), ((int)(((byte)(102)))), ((int)(((byte)(102)))));
base.BtnFont = new System.Drawing.Font("微软雅黑", 17F); base.BtnFont = new System.Drawing.Font("微软雅黑", 17F);
base.BtnText = " 自定义按钮"; base.BtnText = "自定义按钮";
} }
} }
} }
...@@ -249,26 +249,22 @@ namespace HZH_Controls.Controls ...@@ -249,26 +249,22 @@ namespace HZH_Controls.Controls
} }
} }
/// <summary> /// <summary>
/// The m fore color
/// </summary>
Color m_foreColor = Color.White;
/// <summary>
/// 获取或设置控件的前景色。 /// 获取或设置控件的前景色。
/// </summary> /// </summary>
/// <value>The color of the fore.</value> /// <value>The color of the fore.</value>
/// <PermissionSet> /// <PermissionSet>
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" /> /// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
/// </PermissionSet> /// </PermissionSet>
[Description("文字颜色"), Category("自定义")] [Description("文字颜色"), Category("自定义"), DesignerSerializationVisibility(DesignerSerializationVisibility.Visible),Localizable(true)]
public override Color ForeColor public override Color ForeColor
{ {
get get
{ {
return m_foreColor; return base.ForeColor;
} }
set set
{ {
m_foreColor = value; base.ForeColor = value;
Refresh(); Refresh();
} }
} }
...@@ -305,6 +301,7 @@ namespace HZH_Controls.Controls ...@@ -305,6 +301,7 @@ namespace HZH_Controls.Controls
this.SetStyle(ControlStyles.Selectable, true); this.SetStyle(ControlStyles.Selectable, true);
this.SetStyle(ControlStyles.SupportsTransparentBackColor, true); this.SetStyle(ControlStyles.SupportsTransparentBackColor, true);
this.SetStyle(ControlStyles.UserPaint, true); this.SetStyle(ControlStyles.UserPaint, true);
ForeColor = Color.White;
} }
/// <summary> /// <summary>
......
...@@ -262,6 +262,13 @@ ...@@ -262,6 +262,13 @@
<Compile Include="Controls\TrackBar\UCTrackBar.cs"> <Compile Include="Controls\TrackBar\UCTrackBar.cs">
<SubType>Component</SubType> <SubType>Component</SubType>
</Compile> </Compile>
<Compile Include="UIEditor\FrmSelectImage.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="UIEditor\FrmSelectImage.Designer.cs">
<DependentUpon>FrmSelectImage.cs</DependentUpon>
</Compile>
<Compile Include="UIEditor\ImagePropertyEditor.cs" />
<Compile Include="Controls\Wave\UCWaveChart.cs"> <Compile Include="Controls\Wave\UCWaveChart.cs">
<SubType>UserControl</SubType> <SubType>UserControl</SubType>
</Compile> </Compile>
...@@ -695,11 +702,12 @@ ...@@ -695,11 +702,12 @@
<Generator>ResXFileCodeGenerator</Generator> <Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Resources.Designer.cs</LastGenOutput> <LastGenOutput>Resources.Designer.cs</LastGenOutput>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="UIEditor\FrmSelectImage.resx">
<DependentUpon>FrmSelectImage.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<EmbeddedResource Include="IconFont\ElegantIcons.ttf"> <EmbeddedResource Include="IconFont\ElegantIcons.ttf" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<EmbeddedResource Include="HandInput\certificate"> <EmbeddedResource Include="HandInput\certificate">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
...@@ -724,9 +732,7 @@ ...@@ -724,9 +732,7 @@
<EmbeddedResource Include="HandInput\sgim_py.bin"> <EmbeddedResource Include="HandInput\sgim_py.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory> <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<EmbeddedResource Include="IconFont\FontAwesome.ttf"> <EmbeddedResource Include="IconFont\FontAwesome.ttf" />
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</EmbeddedResource>
<None Include="Resources\alarm.png" /> <None Include="Resources\alarm.png" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
......
// ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-11
//
// ***********************************************************************
// <copyright file="FontImages.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Drawing; using System.Drawing;
...@@ -15,29 +30,57 @@ namespace HZH_Controls ...@@ -15,29 +30,57 @@ namespace HZH_Controls
/// </summary> /// </summary>
public static class FontImages public static class FontImages
{ {
/// <summary>
/// The m font collection
/// </summary>
private static readonly PrivateFontCollection m_fontCollection = new PrivateFontCollection(); private static readonly PrivateFontCollection m_fontCollection = new PrivateFontCollection();
/// <summary>
/// The m fonts awesome
/// </summary>
private static readonly Dictionary<string, Font> m_fontsAwesome = new Dictionary<string, Font>(); private static readonly Dictionary<string, Font> m_fontsAwesome = new Dictionary<string, Font>();
/// <summary>
/// The m fonts elegant
/// </summary>
private static readonly Dictionary<string, Font> m_fontsElegant = new Dictionary<string, Font>(); private static readonly Dictionary<string, Font> m_fontsElegant = new Dictionary<string, Font>();
/// <summary>
/// The m cache maximum size
/// </summary>
private static Dictionary<int, float> m_cacheMaxSize = new Dictionary<int, float>(); private static Dictionary<int, float> m_cacheMaxSize = new Dictionary<int, float>();
/// <summary>
/// The minimum font size
/// </summary>
private const int MinFontSize = 8; private const int MinFontSize = 8;
/// <summary>
/// The maximum font size
/// </summary>
private const int MaxFontSize = 43; private const int MaxFontSize = 43;
/// <summary> /// <summary>
/// 构造函数 /// 构造函数
/// </summary> /// </summary>
/// <exception cref="FileNotFoundException">Font file not found</exception>
static FontImages() static FontImages()
{ {
string filenameAwesome = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "IconFont\\FontAwesome.ttf"); string strPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.ToLower().Replace("file:///", "");
string strDir = System.IO.Path.GetDirectoryName(strPath);
if (!File.Exists(filenameAwesome)) if (!Directory.Exists(Path.Combine(strDir, "IconFont")))
{ {
throw new FileNotFoundException("Font file not found", filenameAwesome); Directory.CreateDirectory(Path.Combine(strDir, "IconFont"));
}
string strFile = Path.Combine(strDir, "IconFont\\FontAwesome.ttf");
if (!File.Exists(strFile))
{
var fs = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("HZH_Controls.IconFont.FontAwesome.ttf");
FileStream sw = new FileStream(strFile, FileMode.Create, FileAccess.Write);
fs.CopyTo(sw);
sw.Close();
fs.Close();
} }
m_fontCollection.AddFontFile(filenameAwesome); m_fontCollection.AddFontFile(strFile);
float size = MinFontSize; float size = MinFontSize;
for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++) for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++)
...@@ -47,6 +90,10 @@ namespace HZH_Controls ...@@ -47,6 +90,10 @@ namespace HZH_Controls
} }
} }
/// <summary>
/// Gets the font awesome.
/// </summary>
/// <value>The font awesome.</value>
public static FontFamily FontAwesome public static FontFamily FontAwesome
{ {
get get
...@@ -62,6 +109,11 @@ namespace HZH_Controls ...@@ -62,6 +109,11 @@ namespace HZH_Controls
} }
} }
/// <summary>
/// Gets the elegant icons.
/// </summary>
/// <value>The elegant icons.</value>
/// <exception cref="FileNotFoundException">Font file not found</exception>
public static FontFamily ElegantIcons public static FontFamily ElegantIcons
{ {
get get
...@@ -72,12 +124,22 @@ namespace HZH_Controls ...@@ -72,12 +124,22 @@ namespace HZH_Controls
{ {
if (m_fontsElegant.Count <= 0) if (m_fontsElegant.Count <= 0)
{ {
string filenameElegant = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "IconFont\\ElegantIcons.ttf"); string strPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.ToLower().Replace("file:///", "");
if (!File.Exists(filenameElegant)) string strDir = System.IO.Path.GetDirectoryName(strPath);
if (!Directory.Exists(Path.Combine(strDir, "IconFont")))
{
Directory.CreateDirectory(Path.Combine(strDir, "IconFont"));
}
string strFile = Path.Combine(strDir, "IconFont\\ElegantIcons.ttf");
if (!File.Exists(strFile))
{ {
throw new FileNotFoundException("Font file not found", filenameElegant); var fs = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("HZH_Controls.IconFont.ElegantIcons.ttf");
FileStream sw = new FileStream(strFile, FileMode.Create, FileAccess.Write);
fs.CopyTo(sw);
sw.Close();
fs.Close();
} }
m_fontCollection.AddFontFile(filenameElegant); m_fontCollection.AddFontFile(strFile);
float size = MinFontSize; float size = MinFontSize;
for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++) for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++)
...@@ -119,6 +181,7 @@ namespace HZH_Controls ...@@ -119,6 +181,7 @@ namespace HZH_Controls
/// <param name="foreColor">前景色</param> /// <param name="foreColor">前景色</param>
/// <param name="backColor">背景色.</param> /// <param name="backColor">背景色.</param>
/// <returns>Bitmap.</returns> /// <returns>Bitmap.</returns>
/// <exception cref="FileNotFoundException">Font file not found</exception>
public static Bitmap GetImage(FontIcons iconText, int imageSize = 32, Color? foreColor = null, Color? backColor = null) public static Bitmap GetImage(FontIcons iconText, int imageSize = 32, Color? foreColor = null, Color? backColor = null)
{ {
Dictionary<string, Font> _fs; Dictionary<string, Font> _fs;
...@@ -132,12 +195,22 @@ namespace HZH_Controls ...@@ -132,12 +195,22 @@ namespace HZH_Controls
{ {
if (m_fontsElegant.Count <= 0) if (m_fontsElegant.Count <= 0)
{ {
string filenameElegant = System.IO.Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "IconFont\\ElegantIcons.ttf"); string strPath = System.Reflection.Assembly.GetExecutingAssembly().CodeBase.ToLower().Replace("file:///", "");
if (!File.Exists(filenameElegant)) string strDir = System.IO.Path.GetDirectoryName(strPath);
if (!Directory.Exists(Path.Combine(strDir, "IconFont")))
{ {
throw new FileNotFoundException("Font file not found", filenameElegant); Directory.CreateDirectory(Path.Combine(strDir, "IconFont"));
} }
m_fontCollection.AddFontFile(filenameElegant); string strFile = Path.Combine(strDir, "IconFont\\ElegantIcons.ttf");
if (!File.Exists(strFile))
{
var fs = System.Reflection.Assembly.GetExecutingAssembly().GetManifestResourceStream("HZH_Controls.IconFont.ElegantIcons.ttf");
FileStream sw = new FileStream(strFile, FileMode.Create, FileAccess.Write);
fs.CopyTo(sw);
sw.Close();
fs.Close();
}
m_fontCollection.AddFontFile(strFile);
float size = MinFontSize; float size = MinFontSize;
for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++) for (int i = 0; i <= (MaxFontSize - MinFontSize) * 2; i++)
...@@ -200,12 +273,26 @@ namespace HZH_Controls ...@@ -200,12 +273,26 @@ namespace HZH_Controls
return srcImage; return srcImage;
} }
/// <summary>
/// Gets the size of the icon.
/// </summary>
/// <param name="iconText">The icon text.</param>
/// <param name="graphics">The graphics.</param>
/// <param name="font">The font.</param>
/// <returns>Size.</returns>
private static Size GetIconSize(FontIcons iconText, Graphics graphics, Font font) private static Size GetIconSize(FontIcons iconText, Graphics graphics, Font font)
{ {
string text = char.ConvertFromUtf32((int)iconText); string text = char.ConvertFromUtf32((int)iconText);
return graphics.MeasureString(text, font).ToSize(); return graphics.MeasureString(text, font).ToSize();
} }
/// <summary>
/// Converts to icon.
/// </summary>
/// <param name="srcBitmap">The source bitmap.</param>
/// <param name="size">The size.</param>
/// <returns>Icon.</returns>
/// <exception cref="ArgumentNullException">srcBitmap</exception>
private static Icon ToIcon(Bitmap srcBitmap, int size) private static Icon ToIcon(Bitmap srcBitmap, int size)
{ {
if (srcBitmap == null) if (srcBitmap == null)
......
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
namespace HZH_Controls
{
public partial class FrmSelectImage : Form
{
public Image SelectImage { get; set; }
public FrmSelectImage()
{
try
{
InitializeComponent();
}
catch (Exception exc)
{
MessageBox.Show(exc.ToString(), "错误");
}
}
private void tabControlExt1_SelectedIndexChanged(object sender, EventArgs e)
{
if (tabControlExt1.SelectedIndex == 0)
this.ActiveControl = this.flowLayoutPanel1;
else
this.ActiveControl = this.flowLayoutPanel2;
}
private void FrmSelectImage_Load(object sender, EventArgs e)
{
string[] nameList = System.Enum.GetNames(typeof(HZH_Controls.FontIcons));
var lst = nameList.ToList();
lst.Sort();
foreach (var item in lst)
{
HZH_Controls.FontIcons icon = (HZH_Controls.FontIcons)Enum.Parse(typeof(HZH_Controls.FontIcons), item);
Label lbl = new Label();
lbl.AutoSize = false;
lbl.Size = new System.Drawing.Size(300, 35);
lbl.ForeColor = Color.FromArgb(255, 77, 59);
lbl.TextAlign = ContentAlignment.MiddleLeft;
lbl.Margin = new System.Windows.Forms.Padding(5);
lbl.DoubleClick += lbl_DoubleClick;
string s = char.ConvertFromUtf32((int)icon);
lbl.Text = " " + item;
lbl.Image = HZH_Controls.FontImages.GetImage(icon, 32, Color.FromArgb(255, 77, 59));
lbl.ImageAlign = ContentAlignment.MiddleLeft;
lbl.Font = new Font("微软雅黑", 12);
lbl.Tag = icon;
if (item.StartsWith("A_"))
{
flowLayoutPanel1.Controls.Add(lbl);
}
else
{
flowLayoutPanel2.Controls.Add(lbl);
}
}
this.ActiveControl = this.flowLayoutPanel1;
}
void lbl_DoubleClick(object sender, EventArgs e)
{
Label lbl = sender as Label;
HZH_Controls.FontIcons icon = (HZH_Controls.FontIcons)lbl.Tag;
int intSize = ucTextBoxEx1.InputText.ToInt();
if (intSize <= 0)
intSize = 32;
SelectImage = HZH_Controls.FontImages.GetImage(icon, intSize, txtForeColor.BackColor, txtBackcolor.BackColor == Color.White ? Color.Empty : txtBackcolor.BackColor);
this.DialogResult = System.Windows.Forms.DialogResult.OK;
this.Close();
}
private void textBox1_DoubleClick(object sender, EventArgs e)
{
TextBox txt = sender as TextBox;
ColorDialog ColorForm = new ColorDialog();
if (ColorForm.ShowDialog() == DialogResult.OK)
{
Color GetColor = ColorForm.Color;
txt.BackColor = GetColor;
txt.Text = GetColor.R + "," + GetColor.G + "," + GetColor.B;
}
}
}
}
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
</root>
\ No newline at end of file \ No newline at end of file
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Design;
using System.Linq;
using System.Text;
namespace HZH_Controls
{
public class ImagePropertyEditor : UITypeEditor
{
public override UITypeEditorEditStyle GetEditStyle(System.ComponentModel.ITypeDescriptorContext context)
{
//指定为模式窗体属性编辑器类型
return UITypeEditorEditStyle.Modal;
}
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value)
{
//打开属性编辑器修改数据
FrmSelectImage frm = new FrmSelectImage();
if (value == null || value is Image)
{
if (value != null)
frm.SelectImage = (Image)value;
if (frm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
return frm.SelectImage;
else
return value;
}
else
{
throw new Exception("这不是一个FontIcons类型的属性");
}
}
}
}
...@@ -177,10 +177,34 @@ ...@@ -177,10 +177,34 @@
</data> </data>
<data name="ucBtnImg1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ucBtnImg1.Image" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value> <value>
iVBORw0KGgoAAAANSUhEUgAAAA4AAAAYCAYAAADKx8xXAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8 iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADrwAAA68AZW8ckkAAABnSURBVDhPYyAV/IcCKJc48Pz5tf//AwLAGCpEGPw/cwau YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIrSURBVGhD7VjLbcMwDM0AWaAL9JBbrPTeCQIUtZFLNugG
iWiN6Jr+p6UR1jjYNc2cSQVNQD5UCjcY5JpAgCxNIICiEYRJScSDRzMoK0GlCINRzUAMzHJQKcIAlLWQ WSErdIYu0S06jF09mXJjVZYtUnJaQA94yEcyKVJPFJNNQUFBwYD2pXroXtVz21QXw7r61Hynz29dUyma
NUOFiQMIzQH/AUt/OaDjNm1jAAAAAElFTkSuQmCC +reAxZnFNuqra1QXIuYgKARKj98PfWbnFz3FtlYf7enpkcytB0gBGfctKpZmR3QiyHR+tM3+LMn6FCEr
cpEPWLzPeSpiV8lVeuDQ+ZymZpad6JrdliMbrtRQ1ch1Gpiy53EUojmcusKwn9V3CrmXgSsdW1nYu5dK
SqwMOoexrQ9H37wQk+1CbPasdPpn0T7stuY9S0rCs8Apm1Y6Rv8IhqTAkZK7k9GIzdqtQ7wfxqjviZUS
AjbGuBgtYoaOdC6jsXFgkVISdLAxW+5K59d4ra4Yj5aSpGtd6mhSOi6tlCLOlk0MC0sCwJxBOlrjCCDA
obajlfbZc7lCADwHqPHL7O/P9Eg8kDWfUUuMm3nQ/TjTM+zPgw5e3xN+2z+UHOLANo+lw/hxM5TWsA/M
YSOUISsdvPrG54igzfMBKckDmDDef4eflfrQTjhfQh2EvhNgR139473URAhtcU4iMUmaOW47LSUSR0uQ
Y+1dSJZ9i6U1OxW5d0sQuf+RsLTVKQu4JXMpsy7eInQ3SLjK4i2k9d8l7gMyvR5MX68dCy8y3RcdjmTy
PjAVKiIQUyKxcEmXmQumLdAHHfdGn90b4nu96KT1vaCgoKCg4H9js/kGhvlYiuzp+UMAAAAASUVORK5C
YII=
</value>
</data>
<data name="ucBtnImg1.ImageFontIcons" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>
iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8
YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAIrSURBVGhD7VjLbcMwDM0AWaAL9JBbrPTeCQIUtZFLNugG
WSErdIYu0S06jF09mXJjVZYtUnJaQA94yEcyKVJPFJNNQUFBwYD2pXroXtVz21QXw7r61Hynz29dUyma
+reAxZnFNuqra1QXIuYgKARKj98PfWbnFz3FtlYf7enpkcytB0gBGfctKpZmR3QiyHR+tM3+LMn6FCEr
cpEPWLzPeSpiV8lVeuDQ+ZymZpad6JrdliMbrtRQ1ch1Gpiy53EUojmcusKwn9V3CrmXgSsdW1nYu5dK
SqwMOoexrQ9H37wQk+1CbPasdPpn0T7stuY9S0rCs8Apm1Y6Rv8IhqTAkZK7k9GIzdqtQ7wfxqjviZUS
AjbGuBgtYoaOdC6jsXFgkVISdLAxW+5K59d4ra4Yj5aSpGtd6mhSOi6tlCLOlk0MC0sCwJxBOlrjCCDA
obajlfbZc7lCADwHqPHL7O/P9Eg8kDWfUUuMm3nQ/TjTM+zPgw5e3xN+2z+UHOLANo+lw/hxM5TWsA/M
YSOUISsdvPrG54igzfMBKckDmDDef4eflfrQTjhfQh2EvhNgR139473URAhtcU4iMUmaOW47LSUSR0uQ
Y+1dSJZ9i6U1OxW5d0sQuf+RsLTVKQu4JXMpsy7eInQ3SLjK4i2k9d8l7gMyvR5MX68dCy8y3RcdjmTy
PjAVKiIQUyKxcEmXmQumLdAHHfdGn90b4nu96KT1vaCgoKCg4H9js/kGhvlYiuzp+UMAAAAASUVORK5C
YII=
</value> </value>
</data> </data>
<data name="ucBtnFillet1.BtnImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64"> <data name="ucBtnFillet1.BtnImage" type="System.Drawing.Bitmap, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!