Search code examples
c#.netwinformsvisual-foxprofoxpro

Converting Visual FoxPro forms to C#.Net Forms


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?

Here is an example of my situation:

VFP Form Image

C#.Net Form Image


Solution

  • I think that the problem is the unit used to measure the font size: VFP and WinForm use different units.

    Unit Font MSDN

    If you choose Font -> Unit=Pixel this will fix your problem.

    Example

    The default for WinForm is Point.

    With default value (Point):

    Before

    With Pixel value:

    After