From ae45d123c2ee907fd40f7db86f2aac2b21f976b6 Mon Sep 17 00:00:00 2001 From: lixiaojun <1287241240@qq.com> Date: 星期四, 14 十一月 2024 17:16:21 +0800 Subject: [PATCH] 增加监测点 --- WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/02-GeneralProject/GenerateXhsProjectFileWizardPage.cs | 57 ++++++++++++++++++++++++++++++++++++++++++++++----------- 1 files changed, 46 insertions(+), 11 deletions(-) diff --git a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/02-GeneralProject/GenerateXhsProjectFileWizardPage.cs b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/02-GeneralProject/GenerateXhsProjectFileWizardPage.cs index 1f67950..67641c2 100644 --- a/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/02-GeneralProject/GenerateXhsProjectFileWizardPage.cs +++ b/WinFrmUI/HStation.WinFrmUI.Xhs.Core/02-project/04-dlg/02-GeneralProject/GenerateXhsProjectFileWizardPage.cs @@ -17,6 +17,17 @@ private bool _importResult = false;//瀵煎叆缁撴灉 private ImportXhsProjectFileViewModel _vm = null;//鎿嶄綔瀵硅薄 + private class ListItemWithColor + { + public string Text { get; set; } + public Color Color { get; set; } + + public override string ToString() + { + return null; + } + } + /// <summary> /// /// </summary> @@ -25,17 +36,22 @@ _vm = vm; _isInitialize = false; _importResult = false; - _importResult = await ImportXhsProjectFileHelper.Import(vm, (msg) => - { - this.listBoxControl1.Items.Add(msg); - }, (max, current) => - { - this.progressBarControl1.Properties.Maximum = max; - this.progressBarControl1.Position = current; - //鏇夸唬鏂规 - // this.progressBarControl1.Properties.Step = current; - // this.progressBarControl1.PerformStep(); - }); + _importResult = await ImportXhsProjectFileHelper.Import(vm, (msg, color) => + { + ListItemWithColor itemWithColor = new ListItemWithColor + { + Text = msg, + Color = color + }; + this.listBoxControl1.Items.Add(itemWithColor); + }, (max, current) => + { + this.progressBarControl1.Properties.Maximum = max; + this.progressBarControl1.Position = current; + //鏇夸唬鏂规 + // this.progressBarControl1.Properties.Step = current; + // this.progressBarControl1.PerformStep(); + }); if (!_importResult) { this.progressBarControl1.Position = 0; @@ -139,5 +155,24 @@ { return false; } + + private void listBoxControl1_DrawItem(object sender, DevExpress.XtraEditors.ListBoxDrawItemEventArgs e) + { + // 鑾峰彇褰撳墠椤圭洰鐨勭储寮� + int index = e.Index; + + // 妫�鏌ユ槸鍚︽槸鏈夋晥鐨勯」鐩储寮� + if (index >= 0) + { + // 鑾峰彇褰撳墠椤圭洰 + ListItemWithColor item = (ListItemWithColor)listBoxControl1.Items[index]; + + // 璁剧疆瀛椾綋鍜岄鑹� + Font font = new Font("Arial", 15); + Brush brush = new SolidBrush(item.Color); + // 缁樺埗鏂囨湰 + e.Graphics.DrawString(item.Text, font, brush, e.Bounds); + } + } } } \ No newline at end of file -- Gitblit v1.9.3