The Borland engineer is working hard! First, you have to sigh with such a sentence! I watched a Delphi8 introduction, so I put it down (may be pirated, but I won't use commercial use!), I make 5 years of Delphi, starting with .NET after 3 to 6, 6. 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 contains Control, let the control contain TControl? Delphi8 installation, discover a WinForms Controls import tool in the program menu, wow, try it! Turned a simple control, a button written, no problem, work is very good! Let's take a look at how to do: TimprulerPanel = Class (TNetControlWrapper)
private function GetRulerPanel: Hose.WinForm.RulerPanel; protected procedure InitControlData; override; procedure HookNetEvents (AControl: System.Windows.Forms.Control); override; procedure UnhookNetEvents (AControl: System.Windows.Forms.Control); override; public property RulerPanel: hose.winform.rulerpanel Read GethRuler;
(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!