I later discovered it was an issue originating from the general DPI settings of my windows form application because of working on a machine with a higher DPI setting (125% in mycase).
I fixed it by making the following changes to the form that starts the application;
- Go the the Forms designer, then select your Form (by clicking at its title bar)
- Press F4 to open the Properties window,
- then locate the AutoScaleMode property
- Change it from Font (default) to Dpi.
Then In the program.cs, I modified the code to look as below
namespace myApplication
{
static class Program
{
[STAThread]
static void Main()
{
// ***this line is added***
if (Environment.OSVersion.Version.Major >= 6)
SetProcessDPIAware();
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm());
}
// ***also dllimport of that function***
[System.Runtime.InteropServices.DllImport("user32.dll")]
private static extern bool SetProcessDPIAware();
}
}
Credit: Stack overflow page with details is here