using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Windows.Forms; namespace DynamischeForm { public partial class Form1 : Form { public Form1() { InitializeComponent(); } enum Resolution { Mini, Midi, Maxi } private void buttonStart_Click(object sender, EventArgs e) { string text = "123 45678 90 abcd efghijk lmnop qrst uvw xyz 123 45678 90 abcd efghijk lmnop qrst uvw xyz 123 45678 90 abcd efghijk lmnop qrst uvw xyz\n2\n3"; //SetResolution(Resolution.Maxi); this.WindowState = FormWindowState.Normal; this.Size = new System.Drawing.Size(1024,768); labelDyn.Width = this.Width - 33; labelDyn.Height = this.Height - 78; labelDyn.Text = text; labelDyn.Refresh(); } private void buttonChangeResolution_Click(object sender, EventArgs e) { this.Size = new Size(1024, 768); } private void SetResolution(Resolution resolution) { switch (resolution) { case Resolution.Mini: //this.Width = 480; //this.Height = 360; this.Size = new Size(480, 360); break; case Resolution.Midi: //this.Width = 640; //this.Height = 480; this.Size = new Size(640, 480); break; case Resolution.Maxi: //this.Width = 1024; //this.Height = 768; this.Size = new Size(1024, 768); break; default: //this.Width = 480; //this.Height = 360; this.Size = new Size(480, 360); break; } } } }