小男孩‘自慰网亚洲一区二区,亚洲一级在线播放毛片,亚洲中文字幕av每天更新,黄aⅴ永久免费无码,91成人午夜在线精品,色网站免费在线观看,亚洲欧洲wwwww在线观看

分享

C# 修改配置文件進(jìn)行窗體logo切換

 ontheroad96j47 2021-11-08

01

前言:題外的話

      大家可能發(fā)現(xiàn)這個(gè)號(hào)現(xiàn)在原創(chuàng)越來(lái)越少了,其實(shí)小編并沒有放棄持續(xù)更新,只是把一手原創(chuàng)放到了 【dotnet編程大全】這個(gè)號(hào)了,那個(gè)號(hào)目前原創(chuàng)主要更新的是wpf mvvm方面的知識(shí),框架用的Caliburn.Micro,關(guān)于這個(gè)框架介紹,不了解的自行百度。有興趣學(xué)習(xí)的可以關(guān)注:

相關(guān)經(jīng)典原創(chuàng)文章鏈接:點(diǎn)擊可以查看原文

C# WPF框架Caliburn.Micro快速搭建

C# WPF框架Caliburn.Micro入門實(shí)例1

C# WPF MVVM項(xiàng)目實(shí)戰(zhàn)(進(jìn)階①)

C# WPF MVVM項(xiàng)目實(shí)戰(zhàn)(進(jìn)階②)

C# WPF項(xiàng)目實(shí)戰(zhàn)

C# WPF mvvm模式下combobox綁定(list<enum>、Dictionary<int,string>)

C# WPF MVVM模式下在主窗體顯示子窗體并獲取結(jié)果

C# WPF Caliburn.Micro框架下利用Mef加載其它項(xiàng)目界面

C# WPF文本框TextEdit不以科學(xué)計(jì)數(shù)法顯示

C# 通過正則表達(dá)式來(lái)限制控件輸入有效性

C# datagridview、datagrid、GridControl增加行號(hào)

C# =>符號(hào)的使用

C# 無(wú)意間寫了一段線程死鎖的代碼

C# 看懂這100+行代碼,你就真正入門了(經(jīng)典)

C# WPF項(xiàng)目實(shí)戰(zhàn)(經(jīng)典)

WPF 如何修改button圓角(經(jīng)典)

WPF XAML 為項(xiàng)目設(shè)置全局樣式

02


主窗體

String title = LogoConfig.GetLogoConfig("Title"); if(title.Length>0) { this.Text = title; panelCaption.Text = title; }
String logoImage = LogoConfig.GetLogoConfig("Logo"); if (logoImage.Length > 0) { logoImage = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "image\\" + logoImage); Image logo = Image.FromFile(logoImage); pictureLogo.Image = logo; }
logoImage = LogoConfig.GetLogoConfig("Image"); if (logoImage.Length > 0) { logoImage = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "image\\" + logoImage); Image brand = Image.FromFile(logoImage); pictureBrand.Image = brand; }

03


類文件

using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;
namespace EvenTHZSystem{ class LogoConfig { static Dictionary<string, string> logoconfigmap = new Dictionary<string, string>(); static bool bInitialized = false; public static string GetLogoConfig(string key) {
if (!bInitialized) { try { String logoConfig = Path.Combine(AppDomain.CurrentDomain.BaseDirectory + "image\\logo.config");
using (StreamReader reader = new StreamReader(logoConfig)) { while (!reader.EndOfStream) { String line = reader.ReadLine(); string[] kv = line.Split('='); if (kv != null) { logoconfigmap.Add(kv[0], kv[1]); } } }
} catch { } bInitialized = true; }
string value = ""; try { value = logoconfigmap[key]; } catch { } return value; } }}

配置文件:

    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶 評(píng)論公約

    類似文章 更多