C# Can';t在WPF中将System.windows.Controls.Image隐式转换为System.windows.form.control
我对WPF完全陌生。我正在将应用程序从windows窗体应用程序转换为WPF应用程序。windows窗体应用程序工作正常。我必须创建一个用于渲染图像的设备。为此,我使用了以下代码。 //定义渲染控件C# Can';t在WPF中将System.windows.Controls.Image隐式转换为System.windows.form.control,c#,wpf,C#,Wpf,我对WPF完全陌生。我正在将应用程序从windows窗体应用程序转换为WPF应用程序。windows窗体应用程序工作正常。我必须创建一个用于渲染图像的设备。为此,我使用了以下代码。 //定义渲染控件 private System.Windows.Forms.Control renderControl; //get and set rendercontrol public System.Windows.Forms.Control RenderControl { get {
private System.Windows.Forms.Control renderControl;
//get and set rendercontrol
public System.Windows.Forms.Control RenderControl
{
get { return renderControl; }
set { renderControl = value; }
}
//PresentParameters
pp = new PresentParameters();
pp.Windowed = true;
pp.SwapEffect = SwapEffect.Discard;
device = new Microsoft.DirectX.Direct3D.Device(0, Microsoft.DirectX.Direct3D.DeviceType.Hardware, renderControl, CreateFlags.SoftwareVertexProcessing, pp);
我导入这个类并使用WPF图像作为renderControl。但它生成的错误不能隐式地从windows.Controls.Image转换为windows.Forms.Control。我怎样才能转化?是否有其他方式来呈现或创建设备?WPF控件与Windows窗体控件不兼容或不可互换。在WPF中承载Direct3D曲面的最佳方法是使用