国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > C# > 正文

WPF中引入WindowsForms控件的方法

2019-10-29 21:24:47
字體:
來源:轉載
供稿:網友

本文實例講述了WPF中引入WindowsForms控件的方法。分享給大家供大家參考,具體如下:

環境:

[1]WindowsXP with SP3

[2]VS2008 with SP1

正文:

Step1:在現有工程中引入Windows Forms

鼠標右鍵[References]->選擇[Add Reference]->[.NET]標簽頁

加入[WindowsFormsIntegration]和[System.Windows.Forms]兩項

Step2:在XAML文件里加入

[S2-1]加入namespace引用:

xmlns:wf="clr-namespace:System.Windows.Forms;assembly=System.Windows.Forms"xmlns:wfi="clr-namespace:System.Windows.Forms.Integration;assembly=WindowsFormsIntegration"

[S2-2]加入Windows Forms控件

<wfi:WindowsFormsHost Name="winFormsContainer" Grid.Row="2" Margin="0,5,0,0"> <wf:ListView x:Name="listView1" Margin="0,2,0,0" Name="listView1"/></wfi:WindowsFormsHost>

Step3:在CS代碼里面操作WindowsForms控件

Icon icon = new Icon(@"driver.ico");System.Windows.Forms.ImageList imageList2 = new System.Windows.Forms.ImageList();imageList2.Images.Add(icon);listView1.SmallImageList = imageList2;

希望本文所述對大家C#程序設計有所幫助。


注:相關教程知識閱讀請移步到c#教程頻道。
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 南投市| 三亚市| 平远县| 上饶市| 三门峡市| 德江县| 重庆市| 利川市| 丹巴县| 万盛区| 会理县| 宜州市| 三门峡市| 五常市| 义乌市| 绵竹市| 玉屏| 四平市| 弋阳县| 嘉善县| 岱山县| 察雅县| 长阳| 四川省| 丘北县| 古蔺县| 营口市| 祁连县| 曲靖市| 万全县| 大英县| 军事| 安化县| 宁陕县| 平顺县| 汕尾市| 万安县| 盈江县| 渝北区| 修武县| 扶余县|