Converting Visual FoxPro forms to C#.Net Forms RRS feed

  • Question

  • I am creating hundreds of C#.NET forms by reading the VFP source and writing the C#.net by hand currently

    The VFP form properties height, width, top, and bottom of all objects are identical to the C#.Net form properties. The font is identical (exception "MS Sans Serif" is changed to "Microsoft Sans Serif" and the font size is the same.

    The spacing and size of the objects are different. Enough to make a mess when the objects(labels, textboxes) are close together on the VFP side.

    I noticed that these lines in the C#.Net Designer help space things around a bit

    this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
    this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;

    Any suggestions on how to make the new .Net form as identical as possible?

    • Moved by CoolDadTx Thursday, May 24, 2018 9:11 PM Winforms related
    • Moved by Stanly Fan Tuesday, May 29, 2018 6:52 AM VFP related
    Thursday, May 24, 2018 6:08 PM

All replies

  • Hi,

    >>The spacing and size of the objects are different. Enough to make a mess when the objects(labels, textboxes) are close together on the VFP side.

    What is your real problem about this?

    You can manually adjust the position and size of the controls with mouse, also you can do it with code:

        textBox1.Location = new Point(int, int);
        textBox1.Size = new Size(int, int);
    If you do not want to change them one by one, maybe try to set the AutoScaleMode property of your form to Dpi instead of Font:

    Then change some code in the Program.cs:

    class Program
        static void Main()
            if (Environment.OSVersion.Version.Major >= 6)
            Application.Run(new Form1());
        private static extern bool SetProcessDPIAware();
    Best Regards,


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Friday, May 25, 2018 2:48 AM
  • @Frankie, why did you move this post to Off-Topic Posts? I believe that it had initially been moved, correctly, to the WinForms forum. The question is *not* about VFP, it's about how to make a Window Form look as close as possible to a VFP form. But it *is* about Windows Forms!!!

    Your reply looked pretty good and I wonder if the OP, @Auios, has tried it?

    At any rate, if you thought it belonged somewhere other than the Windows Forms forum, it should at least been the VFP forum. Which can be found here: https://social.msdn.microsoft.com/Forums/en-US/home?forum=visualfoxprogeneral 

    But, I think that someone should move it back to the Windows Forms forum!

    Just my 2 cents ...

    ~~Bonnie DeWitt [C# MVP]


    Tuesday, May 29, 2018 1:43 PM