是否有可能以显示其中WinForms应用程序SilverLight的忙闲指示? [英] Is it possible to show SilverLight busy indicator inside Winforms application?
问题描述
目前我使用的是简单的图片框
与 GIF文件
内,不知道这是可能的,如果是的话这是什么2选项之间的差异
这是我在这个时刻用图片框
:
pictureBox1.BringToFront();
pictureBox1.Dock = DockStyle.None;
pictureBox1.Visible =真;
您可以尝试主机内的WinForms的SilverLight 。
虽然Silverlight是打算在Web浏览器中使用,WPF更加的本机的桌面和WPF确实有simimar的 BusyIndicator控件,它是从的 codePLEX扩展WPF工具包。
首先定义一个WPF用户控件 MyBusyIndicator
。
<用户控件X:类=Stackoverflow.MyBusyIndicator
的xmlns =http://schemas.microsoft.com/winfx/2006/xaml/$p$psentation
的xmlns:X =http://schemas.microsoft.com/winfx/2006/xaml
的xmlns:MC =http://schemas.openxmlformats.org/markup-compatibility/2006
的xmlns:D =http://schemas.microsoft.com/ex$p$pssion/blend/2008
的xmlns:xctk =CLR的命名空间:Xceed.Wpf.Toolkit;装配= Xceed.Wpf.Toolkit
MC:可忽略=D
D:DesignHeight =300D:DesignWidth =300>
<电网>
< xctk:BusyIndicator控件IsBusy =真/>
< /网格>
< /用户控件>
然后就可以使用的ElementHost
,首先添加的ElementHost
从窗体的设计器宿主在winform该用户控件,并在表的构造
公共部分类MyForm的:表
{
公共MyForm的()
{
的InitializeComponent();
this.elementHost1.Child =新Stackoverflow.MyBusyIndicator();
}
}
的区别:
在 BusyIndicator控件
带有一些属性,让你自定义的指标,它增加了对SL或WPF的依赖。随着图片框
所有你需要做的是preparing GIF动画。有许多工具生成GIF动画。
Currently i am using a simple PictureBox
with GIF file
inside and wonder if this is possible and if it does what the differences between this 2 options
This is what i have at this moment using PictureBox
:
pictureBox1.BringToFront();
pictureBox1.Dock = DockStyle.None;
pictureBox1.Visible = true;
You can try hosting SilverLight inside Winforms.
While SilverLight is intended to be used in a web browser, WPF is more native to desktop, and WPF does have a simimar BusyIndicator, it is downloadable from CodePlex-Extended WPF Toolkit.
First define a WPF user control MyBusyIndicator
.
<UserControl x:Class="Stackoverflow.MyBusyIndicator"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:xctk="clr-namespace:Xceed.Wpf.Toolkit;assembly=Xceed.Wpf.Toolkit"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<Grid>
<xctk:BusyIndicator IsBusy="True" />
</Grid>
</UserControl>
Then you can host this user control in Winform using an ElementHost
, first you add the ElementHost
from Form's designer, and in Form's constructor
public partial class MyForm : Form
{
public MyForm ()
{
InitializeComponent();
this.elementHost1.Child = new Stackoverflow.MyBusyIndicator();
}
}
The differences:
While BusyIndicator
comes with some properties to let you customize the indicator, it adds a dependency on SL or WPF. With PictureBox
all you need to do is preparing animated GIFs. There are many tools for generating animated GIFs.
这篇关于是否有可能以显示其中WinForms应用程序SilverLight的忙闲指示?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!