欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

WPF中引入WindowsForms控件的方法

 更新時間:2016年07月05日 11:24:29   作者:kagula  
這篇文章主要介紹了WPF中引入WindowsForms控件的方法,結(jié)合實(shí)例形式分析了在WPF中調(diào)用Windows Forms控件的具體步驟與相關(guān)實(shí)現(xiàn)技巧,需要的朋友可以參考下

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

環(huán)境:

[1]WindowsXP with SP3

[2]VS2008 with SP1

正文:

Step1:在現(xiàn)有工程中引入Windows Forms

鼠標(biāo)右鍵[References]->選擇[Add Reference]->[.NET]標(biāo)簽頁

加入[WindowsFormsIntegration]和[System.Windows.Forms]兩項(xiàng)

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;

更多關(guān)于C#相關(guān)內(nèi)容感興趣的讀者可查看本站專題:《C#窗體操作技巧匯總》、《C#常見控件用法教程》、《WinForm控件用法總結(jié)》、《C#程序設(shè)計(jì)之線程使用技巧總結(jié)》、《C#操作Excel技巧總結(jié)》、《C#中XML文件操作技巧匯總》、《C#數(shù)據(jù)結(jié)構(gòu)與算法教程》、《C#數(shù)組操作技巧總結(jié)》及《C#面向?qū)ο蟪绦蛟O(shè)計(jì)入門教程

希望本文所述對大家C#程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論