Delphi8 for .NET VCL class library

zhaozj2021-02-16  57

Two days ago, I saw a introduction of Delphi8, so I put it down (may be pirated, but I won't use commercial use!), I have made 5 years of Delphi, from 3 to 6, 6 I will start with .NET in the future. I had a C # Builder before, and I looked at it.

Some time I heard that Borland To launch "Super" VCL Framework, I am interested, because I always feel that Microsoft will not really launch the for Linux Framework, then Mono is even more far away (it is estimated that MS will spend some Money to collect him ).

After loading Delphi8, started with C # Builder almost (same starting interface style, now I still don't solve that black gray design, what to indicate?) Compatible with .NET controls, explore it! I saw a VCL Forms engineering, but it was still stupid. Net controls, the door didn't!

Fortunately, the VCL class library is open source (with MS for a while, such habits are gone), just know what happened! VCL's control is written down from system.componentmodel.component, and no wonder is incompatible with .NET controls. Just take TForm example, it is from: system.componentmodel.component -> tComponent -> TControl -> TwinControl -> TscrollingwinControl -> Tcustomform all the way, of course, and system.windows.forms.control .NET control is not all the way TControl and Control are brought together. However, it is also good to look from the class library, and their components are still compatible, and they are not necessarily!

Take a look at the VCL source written by the Borland engineer, it seems that the sentence begins, so hard! It is fully compatible with the previous Delphi source code, but also supports .NET, you can't use the API, use compilation, use compilation, use the system.runtime.interopservices.Marshal! I don't know if I can cross the platform, I'm estimated on what Linux, this borland engineer has to "good hard". Write again, anyway, we are stronger than MS, what is afraid!

After half a day, the controls on both sides can not intermise, how to intermise? How to make TControl contain control, let Control contain TControl?

After Delphi8 is installed, there is a WinForms Controls import tool in the program menu, wow, hurry! Turned a simple control, a button written, no problem, work is very good! Let's take a look at how to get it:

TimprulerPanel = Class (TNETControlWrapper)

Private

Function GethRulerPanel: hose.winform.rulerpanel;

protected

Procedure initcontrolData; override;

Procedure hooknetEvents (acontrol: system.windows.forms.control); override; procedure unhatvents (acontrol: system.windows.forms.control); override;

public

Property rulerpanel: hose.winform.rulerpane w g g et;

(I deleted unnecessary parts)

When the .NET calls the ActiveX control, when the .NET calls the ActiveX control, DOTNET will automatically generate a packaging class, just like Timprulerpanel above, only the COM object's packaging class is inherited from Axhost, here The packaging is inherited from TNetControlWrapper and the technique is very similar. Axhose can be obtained directly from getocx or a COM control, it is "a family", which is naturally convenient. I want to use the VCL control to pack the VCL control into. Net is not difficult.

But in the conversion of other complicated controls, there will be some problems, even if there is a wonderful mistake, I will strengthen research, introduce you to everyone in the later article and its solution.

I don't recommend using Delphi for .NET, but now I highly recommend it. I use the old version of Delphi's comrades. You can reserve some of the projects of Delphi, program habits, but also gradually transition to .NET, powerful features of the .NET class library, is really fish and bear's paws can be complicated, but the current interface control is slightly less than a bit.

In addition, Delphi8 has some other small progress than the old version of Delphi, such as categories that cannot be verified when compiling, etc., now you can wait.

In general, Delphi8 is still very worthwhile to use .NET development tools. I only watched a small party, there is any paradox, I hope everyone should point out and forgive, I will continue to learn progress!

ACAI Comments:

No need to expect VCL and then reproduce brilliant on .NET, Borland is clear, you should also clear, just like Li Wei, "put Delphi7 well, this is the last Win32 version" (it seems to be said There will be updates, such as 7.1, etc., but the big version update will not have, only in the maintenance phase), and also developing the brothers of the Win32 program, buy this Lao Li's "Inside VCL", nothing to study the VCL Let go. I want to enter the .NET's world, then it is lightly installed, and I will forget Delphi. Never remember: as long as MS does not fall, .NET's FCL is the biggest most popular and most fundamental class library under .NET, you don't expect Borland to bring anything from a baby to fed Delphi's programmer - - If you still think that the VCL can ignore the Win32 API, you can ignore the FCL if you learn vcl.net, then I don't say it.

There is no need to use the so-called "VCL form" program to transition to .NET, "winform Application" is a standard .NET class library program, and the so-called "vcl form application" is just Borland to make so-called "upgrade maintenance "The scorpion, Li Weidu believes that the current VCL.NET is just a transition program, and Danny Thrope is also in the .NET class library by MS to develop that borland can focus the force in the design of the class library design. "True powerful Delphi" (I don't know if Ide is important or class), everyone knows that this version of Delphi development time is only only 6 months, so now "VCL form Application" control is less poor, that is Because the development group can't be done, it is difficult to say, then, learn .net, primary is learning .NET Framework, not vcl.net! ! Even from the perspective of the tool, the current delphi.net is also a chicken rib, which is really a constant semi-finished product, can you really do a project? ? From the perspective of learning, it should not be used, .NET Framework is not like the previous Win32API, the difficulty of learning has been greatly reduced, and it is even more imaginable to engage in .NET development and not familiar with .NET's FCL, therefore, Still learning C #! VS.NET should be more stable, enough to be used to do real projects, and discrete the current C # Builder and Delphi.net, how many people really dare to do project? ?

So, if you really still make a so-called "Delphi" fan, try to choose the "Windows Form" program, otherwise, or always learn Framework.

转载请注明原文地址:https://www.9cbs.com/read-22673.html

New Post(0)