locked
Convert Delphi code into C#

    Question

  • Hi All Experts,

    I have the following codes written in delphi pascal. I need to translate it into c#. Please help. 
     // Contributor for a pixel
     TContributor = record
     pixel: integer; // Source pixel
     weight: single; // Pixel weight
     end;
    
     TContributorList = array[0..0] of TContributor;
     PContributorList = ^TContributorList;
    
     // List of source pixels contributing to a destination pixel
     TCList = record
     n: integer;
     p: PContributorList;
     end;
    
     TCListList = array[0..0] of TCList;
     PCListList = ^TCListList;
    
    procedure StretchProc(Src, Dst: TBitmap; fwidth: single); //using fwidth=3.0
    var
     xscale, yscale: single; // Zoom scale factors
     i, j, k: integer; // Loop variables
     Work: TBitmap;
     contrib: PCListList;
    
    .......
    
    
    Thank you very much,

    Cheers,
    CC

    This person has no signature.
    Saturday, May 15, 2010 11:08 PM

Answers

All replies

  • Hi,

    You might first try some tool that can convert Delphi code to c#, there are many we can get via searching.

    or you may figure out what the code do and code it in c#.

    Harry

     


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    • Marked as answer by Royal Oak Thursday, May 20, 2010 1:51 AM
    Wednesday, May 19, 2010 9:23 AM
  • If you have the delphi project files, try using this:

    http://www.netcoole.com/delphi2cs.htm

    It will also create a new vs project for you and supports vs 2005, 2008 and 2010!

    • Marked as answer by Royal Oak Thursday, May 20, 2010 1:55 AM
    Wednesday, May 19, 2010 9:40 AM
  • Hi,

    Harry is right. for example there is a coversion tool at http://www.netcoole.com/delphi2cs.htm (Migrates from Delphi to C#)

    Best regards,

    Yasser.


    WHAT'S NEW IN THE .NET FRAMEWORK 4:
    Article: Comparison of parallel and sequential computing in .NET Framework
    • Marked as answer by Royal Oak Thursday, May 20, 2010 1:55 AM
    Wednesday, May 19, 2010 9:42 AM
  • Most of the conversion tools from delphi to c# suck. Its probably better to do it by hand since its such a small snippet of code.
    My .NET Blog: http://michaelcrump.net
    Wednesday, May 19, 2010 4:46 PM
  • Hi Guys,

    I did try some tools, it give me all kind of errors such as

    "@ Unsupported property or method(A): 'ScanLine' "

    "@ Undeclared identifier(3): 'pf24bit'"

    "@ Unsupported function or procedure: 'GetMem'"

    I will try to tidy up by myself.

    Anyway, thank you for all your effort in helping me.

    Cheers


    This person has no signature.
    Thursday, May 20, 2010 1:55 AM
  • Good luck!


    Please remember to mark the replies as answers if they help and unmark them if they provide no help.
    Welcome to the All-In-One Code Framework! If you have any feedback, please tell us.
    Thursday, May 20, 2010 2:23 AM