Commit 106d0ff0 刘韬

1

1 个父辈 477bf116
正在显示 44 个修改的文件 包含 146 行增加62 行删除
此文件类型无法预览
......@@ -183,6 +183,12 @@ namespace Asa.FaceControl
iconGrayBmp = ImageConvert.ToDisabledGray(_iconBmp, 0);
CalcSize();
Refresh();
if (_iconBmp != null)
{
System.IntPtr iconHandle = _iconBmp.GetHicon();
System.Drawing.Icon icon = System.Drawing.Icon.FromHandle(iconHandle);
base.Icon = icon;
}
}
}
......
......@@ -118,7 +118,7 @@ namespace Asa.FaceControl
{
base.DrawEnabled(g);
if (_bmp != null)
if (_bmp != null && _bmp.PixelFormat!= System.Drawing.Imaging.PixelFormat.DontCare)
{
RectangleF destRect = new RectangleF(Offset.X, Offset.Y, _bmp.Width * zoom / 100f, _bmp.Height * zoom / 100f);
RectangleF srcRect = new RectangleF(0, 0, _bmp.Width, _bmp.Height);
......
......@@ -9,9 +9,10 @@
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>Asa.FaceControl</RootNamespace>
<AssemblyName>Asa.Face.Control</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>false</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
......
......@@ -51,6 +51,7 @@ namespace Asa.FaceControl
this.BtnOK.BorderWidth = 2;
this.BtnOK.Font = new System.Drawing.Font("宋体", 12F);
this.BtnOK.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnOK.HoldPress = false;
this.BtnOK.Location = new System.Drawing.Point(251, 270);
this.BtnOK.Name = "BtnOK";
this.BtnOK.Padding = new System.Windows.Forms.Padding(3);
......@@ -67,6 +68,7 @@ namespace Asa.FaceControl
this.BtnCancel.BorderWidth = 2;
this.BtnCancel.Font = new System.Drawing.Font("宋体", 12F);
this.BtnCancel.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.BtnCancel.HoldPress = false;
this.BtnCancel.Location = new System.Drawing.Point(347, 270);
this.BtnCancel.Name = "BtnCancel";
this.BtnCancel.Padding = new System.Windows.Forms.Padding(3);
......@@ -83,7 +85,6 @@ namespace Asa.FaceControl
this.faceTextBox1.BorderStyle = Asa.FaceControl.ControlShape.Rectangle;
this.faceTextBox1.BorderWidth = 2;
this.faceTextBox1.Font = new System.Drawing.Font("宋体", 12F);
this.faceTextBox1.ForeColor = System.Drawing.Color.FromArgb(((int)(((byte)(230)))), ((int)(((byte)(230)))), ((int)(((byte)(230)))));
this.faceTextBox1.Location = new System.Drawing.Point(11, 159);
this.faceTextBox1.MaxLength = 32767;
this.faceTextBox1.Name = "faceTextBox1";
......@@ -124,6 +125,7 @@ namespace Asa.FaceControl
this.Controls.Add(this.BtnOK);
this.Controls.Add(this.BtnCancel);
this.Controls.Add(this.ctlClose);
this.Icon = null;
this.Location = new System.Drawing.Point(0, 0);
this.Name = "FaceInputBox";
this.Text = "FaceInputBox";
......
......@@ -117,6 +117,7 @@ namespace Asa.FaceControl
this.Controls.Add(this.BtnTwo);
this.Controls.Add(this.BtnThree);
this.Controls.Add(this.ctlClose);
this.Icon = null;
this.Location = new System.Drawing.Point(0, 0);
this.Name = "FaceMessageBox";
this.Text = "FaceFormDialog";
......
......@@ -4,6 +4,7 @@ using System.Windows.Forms;
using System.Collections.Generic;
using System.Drawing;
using System.Diagnostics;
using System.Text.RegularExpressions;
namespace Asa.FaceControl
{
......@@ -65,13 +66,16 @@ namespace Asa.FaceControl
/// </summary>
/// <param name="key"></param>
/// <returns></returns>
public static string Dialog(string key)
public static string Dialog(string key,string defaulttxt="")
{
if (nameIndex == -1) return "";
if (dialogText.TryGetValue(key, out string value))
return value;
else
return "";
{
SetNoLangXML("Dialog", key, defaulttxt);
return defaulttxt;
}
}
/// <summary>
......@@ -172,7 +176,10 @@ namespace Asa.FaceControl
if (node.Name == "Dialog")
{
foreach (XmlNode tt in node.ChildNodes)
dialogText.Add(tt.Name, tt.InnerText);
{
if (!dialogText.ContainsKey(tt.Name))
dialogText.Add(tt.Name, tt.InnerText);
}
}
else
{
......@@ -183,6 +190,9 @@ namespace Asa.FaceControl
//if (node.Attributes["Tag"] != null) lang.FormLang.Tag = node.Attributes["Tag"].Value;
foreach (XmlNode tt in node.ChildNodes)
{
if (tt.NodeType != XmlNodeType.Element)
continue;
ClsLangText ll = new()
{
Name = tt.Name
......@@ -215,12 +225,49 @@ namespace Asa.FaceControl
cc.Font = langForm[langIndex].ControlLang[idx].Font;
//cc.Tag = langForm[langIndex].ControlLang[idx].Tag;
}
else {
if (!string.IsNullOrWhiteSpace(cc.Text) && HasChinese(cc.Text))
{
if (cc.Tag == null || cc.Tag.ToString() != "not")
{
SetNoLangXML(langForm[langIndex].FormLang.Name, cc.Name, cc.Text);
}
}
}
if (cc.HasChildren)
SetLang(langIndex, cc);
}
}
static void SetNoLangXML(string formname,string controlname,string text) {
xmlDoc.Load(filePath[nameIndex]);
XmlNode root = xmlDoc.LastChild;
var n=root.SelectSingleNode(formname);
if (n.SelectSingleNode(controlname) != null)
return;
var cc = xmlDoc.CreateComment("原文:"+text);
var ln = xmlDoc.CreateElement(controlname);
if (formname == "Dialog") {
ln.InnerText = text;
}
else
{
ln.SetAttribute("Text", text);
ln.SetAttribute("Font", "微软雅黑,12,,");
}
n.AppendChild(cc);
n.AppendChild(ln);
xmlDoc.Save(filePath[nameIndex]);
}
static bool HasChinese(string txt)
{
//for (int i = 0; i < txt.Length; i++)
//{
if (Regex.IsMatch(txt.ToString(), @"[\u4E00-\u9FA5]+"))
return true;
//}
return false;
}
/// <summary>
/// 转换字体
/// </summary>
......
......@@ -19,7 +19,7 @@ namespace Asa.FaceControl {
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "16.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resource1 {
......
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
<?xml version="1.0" encoding="utf-8" ?>
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
</startup>
</configuration>
\ No newline at end of file
</configuration>
......@@ -45,7 +45,7 @@ namespace Test
this.faceButton1.Padding = new System.Windows.Forms.Padding(3);
this.faceButton1.Size = new System.Drawing.Size(162, 76);
this.faceButton1.TabIndex = 3;
this.faceButton1.Text = "faceButton1";
this.faceButton1.Text = "按钮1";
this.faceButton1.Click += new System.EventHandler(this.faceButton1_Click);
//
// faceButton2
......@@ -70,6 +70,7 @@ namespace Test
this.ClientSize = new System.Drawing.Size(713, 470);
this.Controls.Add(this.faceButton2);
this.Controls.Add(this.faceButton1);
this.Icon = null;
this.Name = "Form1";
this.Text = "Form1";
this.Load += new System.EventHandler(this.Form1_Load);
......
using System;
using Asa.FaceControl;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
......@@ -18,10 +19,12 @@ namespace Test
public Form1()
{
InitializeComponent();
Language.SetLanguage(this);
}
private void Form1_Load(object sender, EventArgs e)
{
this.Icon = new Bitmap("d:\\s72f60ab3-d7df-49ca-b885-842787e8fd72.jpg");
}
private void faceButton1_Click(object sender, EventArgs e)
......
......@@ -14,6 +14,8 @@ namespace Test
[STAThread]
static void Main()
{
Asa.FaceControl.Language.LoadPath("Language");
Asa.FaceControl.Language.LoadLanguage("简体中文");
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new Form1());
......
//------------------------------------------------------------------------------
// <auto-generated>
// 此代码由工具生成。
// 运行时版本: 4.0.30319.42000
// 运行时版本:4.0.30319.42000
//
// 对此文件的更改可能导致不正确的行为,如果
// 重新生成代码,则所做更改将丢失。
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
namespace Test.Properties {
using System;
/// <summary>
/// 强类型资源类,用于查找本地化字符串等。
/// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary>
// 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// 若要添加或除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "4.0.0.0")]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources
{
internal class Resources {
private static global::System.Resources.ResourceManager resourceMan;
private static global::System.Globalization.CultureInfo resourceCulture;
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
internal Resources()
{
internal Resources() {
}
/// <summary>
/// 返回此类使用的缓存 ResourceManager 实例。
/// 返回此类使用的缓存 ResourceManager 实例。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Resources.ResourceManager ResourceManager
{
get
{
if ((resourceMan == null))
{
internal static global::System.Resources.ResourceManager ResourceManager {
get {
if (object.ReferenceEquals(resourceMan, null)) {
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Test.Properties.Resources", typeof(Resources).Assembly);
resourceMan = temp;
}
return resourceMan;
}
}
/// <summary>
/// 重写当前线程的 CurrentUICulture 属性,对
/// 使用此强类型资源类的所有资源查找执行重写。
/// </summary>
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture
{
get
{
internal static global::System.Globalization.CultureInfo Culture {
get {
return resourceCulture;
}
set
{
set {
resourceCulture = value;
}
}
......
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
// 此代码由工具生成。
// 运行时版本:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// 对此文件的更改可能会导致不正确的行为,并且如果
// 重新生成代码,这些更改将会丢失。
// </auto-generated>
//------------------------------------------------------------------------------
namespace Test.Properties
{
namespace Test.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "11.0.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase
{
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.5.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
public static Settings Default
{
get
{
public static Settings Default {
get {
return defaultInstance;
}
}
......
......@@ -8,10 +8,11 @@
<OutputType>WinExe</OutputType>
<RootNamespace>Test</RootNamespace>
<AssemblyName>Test</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<TargetFrameworkVersion>v4.6.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
......@@ -65,6 +66,7 @@
<Compile Include="Properties\Resources.Designer.cs">
<AutoGen>True</AutoGen>
<DependentUpon>Resources.resx</DependentUpon>
<DesignTime>True</DesignTime>
</Compile>
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
......
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.6.2", FrameworkDisplayName = ".NET Framework 4.6.2")]
// <autogenerated />
using System;
using System.Reflection;
[assembly: global::System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
425ec005916d6d76b5941830798bc3b56a3757ae
5aade1c3509099d93cbc894c45cd02e153e78ffd
......@@ -24,3 +24,16 @@ C:\Neotel\Program\FaceControl\Test\obj\Debug\Test.csproj.CopyComplete
C:\Neotel\Program\FaceControl\Test\obj\Debug\Test.exe
C:\Neotel\Program\FaceControl\Test\obj\Debug\Test.pdb
C:\Neotel\Program\FaceControl\Test\obj\Debug\Test.csproj.AssemblyReference.cache
D:\rick\vs\FaceControl\Test\bin\Debug\Test.exe.config
D:\rick\vs\FaceControl\Test\bin\Debug\Test.exe
D:\rick\vs\FaceControl\Test\bin\Debug\Test.pdb
D:\rick\vs\FaceControl\Test\bin\Debug\Asa.Face.Control.dll
D:\rick\vs\FaceControl\Test\bin\Debug\Asa.Face.Control.pdb
D:\rick\vs\FaceControl\Test\obj\Debug\Test.csproj.AssemblyReference.cache
D:\rick\vs\FaceControl\Test\obj\Debug\Test.Form1.resources
D:\rick\vs\FaceControl\Test\obj\Debug\Test.Properties.Resources.resources
D:\rick\vs\FaceControl\Test\obj\Debug\Test.csproj.GenerateResource.cache
D:\rick\vs\FaceControl\Test\obj\Debug\Test.csproj.CoreCompileInputs.cache
D:\rick\vs\FaceControl\Test\obj\Debug\Test.csproj.CopyComplete
D:\rick\vs\FaceControl\Test\obj\Debug\Test.exe
D:\rick\vs\FaceControl\Test\obj\Debug\Test.pdb
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!