C#中Brush、Color、String相互轉換

1String轉換成Color

??????????? Color color = (Color)ColorConverter.ConvertFromString(string);

2String轉換成Brush

??????????? BrushConverter brushConverter = new BrushConverter();
??????????? Brush brush = (Brush)brushConverter.ConvertFromString(string);

3Color轉換成Brush

??????????? Brush brush = new SolidColorBrush(color));

4Brush轉換成Color有兩種方法:

1)先將Brush轉成string,再轉成Color

??????????? Color color= (Color)ColorConverter.ConvertFromString(brush.ToString());

2)將Brush轉成SolidColorBrush,再取Color

??????????? Color color= ((SolidColorBrush)CadColor.Background).Color;

轉載于:https://www.cnblogs.com/zwnet/archive/2012/06/27/2565777.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274744.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274744.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274744.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

實用 JavaScript 調試技巧

大家好,我是若川。持續組織了8個月源碼共讀活動,感興趣的可以點此加我微信 ruochuan12 參與,每周大家一起學習200行左右的源碼,共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

數據挖掘 點擊更多 界面_6(更多)技巧,可快速改善用戶界面

數據挖掘 點擊更多 界面重點 (Top highlight)Creating beautiful, usable, and efficient UIs takes time, with many design revisions along the way.創建漂亮,可用和高效的UI需要花費時間,并且在此過程中進行了許多設計修訂。 Making those constant…

簡單的ASP.NET無刷新分頁

1、新建一個分頁存儲過程: CREATE procedure [dbo].[P_Pager] (PageNumber int, PageSize int) as declare sql nvarchar(4000) set sql select top Convert(varchar, PageSize) * from T_Test where [type]1 and id not in (select top Convert(…

Koa在實際的業務場景中,路由如何做分割?【文末留言送書】

大家好,我是若川。文末留言送書,具體規則文末說明。另外為了鼓勵大家多寫源碼共讀筆記,我會在寫了5次及以上筆記的作者群里也抽獎送這本書。以后也會有更多福利傾斜。導讀:Koa是一個Node框架,在Node開源社區中&#xf…

設計模式_設計

設計模式Thanks for my colleague WanChing‘s help to prepare this sharing article. E-Commerce app collects plentiful products from various brands. Each brand has its brand signature colors and public image. This article introduces how we made a single page …

動態切換css

方法一&#xff1a;給link一個id&#xff0c;直接獲取該DOM操作href <link rel"stylesheet" id"stylelink" type"text/css"/> <a href"#" οnclickjavascript:document.getElementById("stylelink").href "…

使用 GTD 優化自己的工作和生活

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

模仿不再受寵若驚

If you haven’t heard of the Jio-Zoom plagiarism clash, you’re probably living under a rock (which may not be a bad idea given the state of the world right now). The turf war between Jio Meet and Zoom began when the Indian telecom giant ripped off the Chi…

一個計算機愛好者的不完整回憶(二十八)關于計算機書籍

我只在大學階段在圖書館看了很多計算機方面的書&#xff0c;無論已經老得都殘破了還是最新出版的。前兩天又看到論壇中有關于計算機書籍特別是國內人士編寫或翻譯的計算機書籍的評論的文章&#xff0c;譚浩強老先生又毫無懸念的被牽連了進來。也發表一下自己的一些觀點吧。   …

Vue2剝絲抽繭-響應式系統 系列

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

word文本樣式代碼樣式_使用文本樣式表達創建真相來源

word文本樣式代碼樣式As of After Effects 17.0, you can use expressions to edit text styles in After Effects. Here’s why this would transform your workflow:從After Effects 17.0開始&#xff0c;您可以使用表達式在After Effects中編輯文本樣式。 這就是這將改變您的…

mvn備忘

創建web工程 mvn archetype:generate -DgroupIdcom.malangmedia -DartifactIdautoDeployToJetty -DarchetypeArtifactIdmaven-archetype-webapp -Dversion1.0 添加jetty插件 <project xmlns"http://maven.apache.org/POM/4.0.0" xmlns:xsi"http://www.w3.or…

前端框架源碼解讀之Vite

前端工具鏈十年盤點&#xff1a;https://mp.weixin.qq.com/s/FBxVpcdVobgJ9rGxRC2zfgWebpack、Rollup 、Esbuild、Vite ?webpack: 基于 JavaScript 開發的前端打包構建框架&#xff0c;通過依賴收集&#xff0c;模塊解析&#xff0c;生成 chunk&#xff0c;最終輸出生成的打包…

hp-ux_UX中的格式塔-或-為什么設計師如此討厭間距

hp-uxI’ve been lucky so far in my design career to have worked with engineers that seem genuinely interested in learning about design. Perhaps, as mentioned in the title, it’s more about them trying to figure out why it matters so much to us that there i…

很多人都不知道,其實博客園給我們博客開了二級域名

如題。一直都在郵件簽名里寫自己的博客地址為&#xff1a; http://www.cnblogs.com/datacool&#xff1b;直到有天突然發現使用&#xff1a;http://datacool.cnblogs.com也可以訪問。不知道的趕緊測試&#xff0c;后者明顯要酷很多啊。該不是我是最后一個知道的吧&#xff0c;知…

JavaScript 數組新增 4 個非破壞性方法!

大家好&#xff0c;我是若川。持續組織了8個月源碼共讀活動&#xff0c;感興趣的可以點此加我微信 ruochuan12 參與&#xff0c;每周大家一起學習200行左右的源碼&#xff0c;共同進步。同時極力推薦訂閱我寫的《學習源碼整體架構系列》 包含20余篇源碼文章。歷史面試系列。另外…

自行車改裝電動車怎么樣_電動車聽起來應該是什么樣?

自行車改裝電動車怎么樣The sound of an all-electric car accelerating doesn’t have to sound like a standard combustion engine, It could sound like anything.全電動汽車加速的聲音不必聽起來像是標準的內燃機&#xff0c;它可以聽起來像任何東西。 These were the wor…

C++中的三種繼承public,protected,private(轉)

三種訪問權限 public:可以被任意實體訪問 protected:只允許子類及本類的成員函數訪問 private:只允許本類的成員函數訪問 三種繼承方式 public 繼承 protect 繼承 private 繼承 組合結果 基類中 繼承方式 子類中 public &#xff06; public繼承 > public public &#xff0…

如何碎片化時間學前端,了解前沿趨勢

我很開心在前端行業認識了一批優秀且樂于分享的朋友&#xff0c;他們的技術分享與職業觀點讓我獲益良多&#xff0c;推薦給大家一起關注。程序員成長指北Node.js 前端工程化 低代碼考拉小姐姐&#xff0c;一個有趣且樂于分享的人&#xff01;目前就職于某知名外企&#xff0c;負…

谷歌pay破解_Google Pay缺少Google聞名的一件事-UX案例研究

谷歌pay破解Disclaimer: The views expressed in the blog post is purely based on personal experience. It was not influenced by any external factor.When Google launched Tez (now Google Pay) in India during 2017, their primary goal was to design a simple payme…