1
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -163,10 +163,11 @@ namespace CleanMachineHMI.Utils
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="form">窗体对象</param>
|
/// <param name="form">窗体对象</param>
|
||||||
/// <param name="languageCode">语言编码</param>
|
/// <param name="languageCode">语言编码</param>
|
||||||
public static void SetFormControlText(this ContainerControl form)
|
public static void SetFormControlText(this Control form)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
Control[] tmpC = form.Controls.Find("label2", true);
|
||||||
foreach (Control item in form.Controls)
|
foreach (Control item in form.Controls)
|
||||||
{
|
{
|
||||||
var key = form.Name + "|" + item.Name;
|
var key = form.Name + "|" + item.Name;
|
||||||
@@ -176,16 +177,13 @@ namespace CleanMachineHMI.Utils
|
|||||||
}
|
}
|
||||||
if (item is KryptonGroupBox)
|
if (item is KryptonGroupBox)
|
||||||
{
|
{
|
||||||
//Console.Write("模块名称"+ ((KryptonGroupBox)tmpC[0]).Values.Heading);
|
|
||||||
//Console.Write("\r\n");
|
|
||||||
|
|
||||||
((KryptonGroupBox)item).Values.Heading = GlobalHelper.ThemeLanguage[key];
|
((KryptonGroupBox)item).Values.Heading = GlobalHelper.ThemeLanguage[key];
|
||||||
|
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
//Console.Write("控件名称:"+ tmpC[0].Name+ ":控件中文名:" + tmpC[0].Text);
|
item.Text = GlobalHelper.ThemeLanguage[key];
|
||||||
//Console.Write("\r\n");
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -203,15 +201,17 @@ namespace CleanMachineHMI.Utils
|
|||||||
/// <param name="languageCode"></param>
|
/// <param name="languageCode"></param>
|
||||||
public static void SetDataViewColumnText(this DataGridView dataGrid, string formName, string languageCode)
|
public static void SetDataViewColumnText(this DataGridView dataGrid, string formName, string languageCode)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
foreach (DataGridViewColumn item in dataGrid.Columns)
|
||||||
var sql = $@"SELECT * FROM SYS_LANGUAGE_CONTROL
|
{
|
||||||
WHERE USED_FLAG = 1 AND DEL_FLAG = 0
|
var key = formName + "|" + item.Name;
|
||||||
AND FORM_CODE='{formName}' AND LANGUAGE_CODE='{languageCode}' AND CONTROL_TYPE ='DataSource'";
|
if (!GlobalHelper.ThemeLanguage.ContainsKey(key))
|
||||||
DataTable dt = LeadDbHelperSQLite.Query(sql).Tables[0];
|
{
|
||||||
ErgodicColumnsText(dataGrid, dt);
|
continue;
|
||||||
|
}
|
||||||
|
item.HeaderText=GlobalHelper.ThemeLanguage[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -249,7 +249,6 @@ namespace CleanMachineHMI.Utils
|
|||||||
|
|
||||||
public static List<string> GetComBoboxItemArr(this Control form, string code, string controlType)
|
public static List<string> GetComBoboxItemArr(this Control form, string code, string controlType)
|
||||||
{
|
{
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var key = form.Name + "|" + code;
|
var key = form.Name + "|" + code;
|
||||||
@@ -269,26 +268,6 @@ namespace CleanMachineHMI.Utils
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 遍历数据视图控件
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="dataGrid"></param>
|
|
||||||
/// <param name="dataTable"></param>
|
|
||||||
private static void ErgodicColumnsText(DataGridView dataGrid, DataTable dataTable)
|
|
||||||
{
|
|
||||||
for (int k = 0; k < dataGrid.Columns.Count; k++)
|
|
||||||
{
|
|
||||||
for (int i = 0; i < dataTable.Rows.Count; i++)
|
|
||||||
{
|
|
||||||
if (dataGrid.Columns[k].Name == dataTable.Rows[i]["CONTROL_CODE"].ToString())
|
|
||||||
{
|
|
||||||
dataGrid.Columns[k].HeaderText = dataTable.Rows[i]["CONTROL_NAME"].ToString();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ThemeLanguage
|
public class ThemeLanguage
|
||||||
|
|||||||
Reference in New Issue
Block a user