你能帮助使用这个C#样本的VB版本吗? [英] Can you help with a VB version of this C# sample

查看:97
本文介绍了你能帮助使用这个C#样本的VB版本吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是我正在谈论的c#示例..来自这篇文章:

使用WPF在Internet浏览器中嵌入.NET WinForms应用程序



请帮帮我..我需要知道这段代码的Visual Basic对应物



This is the c# sample i'm talking about.. it's from this article:
Embedding a .NET WinForms Application in an Internet Browser Using WPF

Please help me.. i need to know the Visual Basic counterpart of this code

using System.Windows.Controls;
using System.Windows.Forms.Integration;
using Fibonacci;

namespace WPFHost
{
    /// <summary>
    /// Interaction logic for Page1.xaml
    /// </summary>
    public partial class Page1 : Page
    {
        private readonly MainForm mainForm = new MainForm();

        public Page1()
        {
            InitializeComponent();

            //Create a Windows Forms Host to host a form
            WindowsFormsHost windowsFormsHost = new WindowsFormsHost();
            
            stackPanel.Width = mainForm.Width;
            stackPanel.Height = mainForm.Height;
            windowsFormsHost.Width = mainForm.Width;
            windowsFormsHost.Height = mainForm.Height;
          
            mainForm.TopLevel = false;

            windowsFormsHost.Child = mainForm;

            stackPanel.Children.Add(windowsFormsHost);
        }
    }
}





我尝试了什么:



这是我迄今为止所做的工作..





What I have tried:

This is so far what i've worked for..

Imports System.Windows.Controls
Imports System.Windows.Forms.Integration
Imports webtry2

Namespace WPFHost


    Partial Public Class Page1
        Inherits Page

        'Dim mainForm As webtry2.Form1
        Private ReadOnly mainForm As webtry2.Form1 = New Form1

        Public Sub New()
            'InitializeComponent()
            Dim windowsFormsHost As WindowsFormsHost = New WindowsFormsHost()
            Dim stackPanel As StackPanel = New StackPanel
            stackPanel.Width = mainForm.Width
            stackPanel.Height = mainForm.Height
            windowsFormsHost.Width = mainForm.Width
            windowsFormsHost.Height = mainForm.Height
            mainForm.TopLevel = False
            windowsFormsHost.Child = mainForm
            stackPanel.Children.Add(windowsFormsHost)
        End Sub
    End Class

End Namespace







我希望得到回应。谢谢!




Im hoping for response. Thank you!

推荐答案

页面底部的文章使用WPF在Internet浏览器中嵌入.NET WinForms应用程序 [ ^ ]有一个论坛,用于向文章作者发布问题和评论。



在这里发帖依赖于他们只是在恰当的时刻出现 - 不太可能。
At the bottom of the page for article Embedding a .NET WinForms Application in an Internet Browser Using WPF[^] there is a forum for posting questions and comments to the author of the article.

Posting it here is relying on them just dropping by at the right moment - unlikely.


这篇关于你能帮助使用这个C#样本的VB版本吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆