【VB/.NET】Converting VB6 to VB.NET 【Part I】【之二】
来源:互联网 发布:js 仪表盘 编辑:程序博客网 时间:2024/05/23 13:03
第二部分
原文:
VB6 and ActiveX Controls
Most of the basic VB6 controls will be upgraded by the wizard without any issues, as will many advanced and third-party controls. Even complex ActiveX controls like the MSChart and third party controls are likely to convert with only minor changes in syntax. For instance, the MSChart control converts and mostly behaves like the original. The biggest difference is that the Axis is accessed as a property in VB6, but this is done by using an accessor in VB.NET. For example, in VB6 the XAxis maximum value is set by the statement:
MSChart1.Plot.Axis(VtChAxisIdY,0).ValueScale.Maximum = 370
In VB.NET, it is set by the statement:
MSChart1.Plot.get_Axis(VtChAxisIdY,0).ValueScale.Maximum = 370;
As far as I can tell, this is the only property of MSChart that is treated with this minor difference. The wizard will automatically create a wrapper for any ActiveX controls used in the project. You can also create a wrapper for any ActiveX control you want to use in a .NET program by simply right-clicking on the toolbox, selecting add/remove items, and then choosing the ActiveX control from the COM tab of the Dialog Box. This task can also be accomplished by running the TlbImp.exe utility that comes with the free .NET SDK. One small difference: an "upgraded" ActiveX control is referred to by its original name when referenced in the program, but an ActiveX control added to a new .NET project gets an "ax" prefix. For instance, when upgraded from a VB6 project, MSChart stays MSChart; when added to a .NET project, it becomes axMSChart.
While complex components and ActiveX controls are moved to .NET via the use of wrappers, basic VB6 controls are upgraded to (replaced by) VB.NET controls.
译文
VB6及其Active控件
在VB6中XAxis最大值通过如下的语句来设置:
MSChart1.Plot.Axis(VtChAxisIdY,0).ValueScale.Maximum = 370
同时,在VB.NET中,应该这样做:
MSChart1.Plot.get_Axis(VtChAxisIdY,0).ValueScale.Maximum = 370
正如我所说的,这就是MSChart上唯一一个关于我所说的微小差别的属性。我们的向导会为项目中使用过的AX控件自动创建一个包装类。同样你也可以自己创建一个包装类(为任何你想要在一个.NET程序中使用的AX控件),通过这样的方法:右击工具箱(ToolBox)->选择“添加/移除项目(Add/Remove items)”->从COM选项卡对话框中选择AX控件。这个任务你也可以通过使用.NET SDK附带的Tlbimp.exe实用工具来完成。同时又这么一个小区别:通过“升级”的来的AX控件使用原来的名字被引用,但是作为一个AX控件被添加进一个.NET新项目会被冠之以"ax"作为前缀。例如,当从VB6项目升级后,NSChart使用MSChart的名字,然而被添加进.NET项目的变成了axMSChart。
虽然复杂的组件和AX控件通过类包装移植到.NET,但是基本的VB6控件以替换的形式来升级。
- 【VB/.NET】Converting VB6 to VB.NET 【Part I】【之二】
- 【VB/.NET】Converting VB6 to VB.NET 【Part I】【之一】
- 【VB/.NET】Converting VB6 to VB.NET 【Part I】【之三】
- 【VB/.NET】Converting VB6 to VB.NET 【Part I】【之四】
- 【VB/.NET】Converting VB6 to VB.NET 【Part II】【之二】
- 【VB/.NET】Converting VB6 to VB.NET 【Part II】【之一】
- 【VB/.NET】Converting VB6 to VB.NET 【Part II】【之三】
- 【VB/.NET】Converting VB6 to VB.NET 【Part II】【之四】
- 【VB/.NET】Converting VB6 to VB.NET
- 【VB/.NET】Converting VB6 to .NET 【Part III】【之一】
- strConv vbUnicode vb6 to vb.net
- StrConv vbFromUnicode vb6 to vb.net
- vb6 轉 vb.net
- VB.NET与VB6.0
- VB6 to VB.Net 几个转换速查
- VB6 to VB.Net 几个转换速查
- VB6 to VB.Net 几个转换速查
- VB.NET与VB6.0的区别二
- 对HashMap的两种遍历方法
- jQuery Frontier Calendar简介
- 通过service和handler实现Notification在后台打开activity
- XMOVE3.0手持终端——软件介绍(二):在2KB内存的单片机上实现的彩屏GUI控件库
- JAVA开源项目
- 【VB/.NET】Converting VB6 to VB.NET 【Part I】【之二】
- Inside the Linux Packet Filter
- python笔记之eclipse开发环境搭建
- ImageFeatures
- 腾讯编程马拉松复赛第三场 1 & 2 & 5
- 好久没有更新博客了
- Hibernate中openSession 和 getCurrentSession
- 6种变态的 hello world 写法
- javaBean和Servlet的区别