WPf以win形式控制 [英] WPf controls in win forms
问题描述
我需要知道如何在Windows窗体中使用控件wpf。我需要在wpf中做一个滚动条并在windows窗体中使用。
有人帮助我。请
< blockquote>
你需要在你的winform中添加一个元素主机,然后你可以在其中加入wpf控件。
会有一些引用添加到你的项目中。
我情不自禁地认为你需要的不仅仅是滚动条本身不会做太多。
/ *将托管我们的WPF控件的容器,我们使用
*设置它的子属性* /
ElementHost host = new ElementHost()
{
BackColor = Color.Transparent ,
Child = animationLayer,
Dock = DockStyle.Fill,
};
/ *现在将ElementHost添加到我们的控件集合中
*通常为* /
Controls.Add(host);
https://mutelight.org/how-to-host-a-wpf-control-in-a-winforms-application
不要只粘贴上面的代码 - 阅读链接页面。
Hi, I need Know How use controls wpf in windows forms. I need do a scrollbar in wpf and use in the windows forms.
Someone help me.please.
You need to add an elementhost to your winform and then you can put wpf controls in that.
There will be some references to add to your project.
I can't help but think you'll need rather more than a scrollbar on it's own isn't going to do very much.
/* container that will host our WPF control, we set it using * the Child property */ ElementHost host = new ElementHost() { BackColor = Color.Transparent, Child = animationLayer, Dock = DockStyle.Fill, }; /* now add the ElementHost to our controls collection * normally */ Controls.Add(host);https://mutelight.org/how-to-host-a-wpf-control-in-a-winforms-application
Don't just paste the code above - read the linked page.
这篇关于WPf以win形式控制的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!