MinimumWindow Size : Form Style « GUI Windows Form « C# / C Sharp






MinimumWindow Size

 


using System;
using System.Drawing;
using System.Windows.Forms;
   
class HowdyWorldFullFit: Form
{
     public static void Main()
     {
          Application.Run(new HowdyWorldFullFit());
     }
     public HowdyWorldFullFit()
     {
          ResizeRedraw = true; 
          MinimumSize = SystemInformation.MinimumWindowSize + new Size(0,1);
     }
     protected override void OnPaint(PaintEventArgs pea)
     {
          DoPage(pea.Graphics, ForeColor,ClientSize.Width, ClientSize.Height);
     }     
     protected void DoPage(Graphics grfx, Color clr, int cx, int cy)
     {
          Font  font  = new Font("Times New Roman", 10, FontStyle.Italic);
          SizeF sizef = grfx.MeasureString(Text, font);
          float fScaleHorz = cx / sizef.Width;
          float fScaleVert = cy / sizef.Height;
   
          grfx.ScaleTransform(fScaleHorz, fScaleVert);
   
          grfx.DrawString(Text, font, new SolidBrush(clr), 0, 0);
     }
}

 








Related examples in the same category

1.Self Placing Window (save form window related information to Registry)
2.Non-resizable formNon-resizable form
3.BorderLess WindowBorderLess Window
4.AutoScroll WindowAutoScroll Window
5.Not in TaskBarNot in TaskBar