zettelkasten/OneNoteExport/Technik/Programieren/VisualStudio/05_Autosize Button.md
2023-08-17 19:32:37 +02:00

2.5 KiB

Autosize Button

Mittwoch, 31. Januar 2018

20:32

 

 

Aus einem Video auf Youtube :

Automatic Resizing of Buttons in Windows Forms using C# _ Part1

 

Videowebinhalt mit Titel: Automatic Resizing of Buttons in Windows Forms using C# \_ Part1{width="5.0in" height="2.8125in"}

 

 

 

Computergenerierter Alternativtext: \@dynami uttonResize dynamicButt0nReSize.FOrm1 ventÅrgs e) • resizeControl(Rectangle originalContrc - usin using using using using using using using using System; System. Collections . Generic ; System. Componentmodel ; System. Data; System. Drawing; System. Linq; System. Text; System. Threading. Tasks; System. Eindows. For•s ; - namespace dynamicButtonResize public partial class private private private private private private Rectangle Rectangle Rectangle Rectangie Rectdngle cr-rrl textBox10rigina1Rect; button10riginaIRect; button20rigina1Rect; button30rigina1Rect; button40rigina1Rect; public Forml() Initiali zeCo•ponent ( ) ; private void Forml Load(object Sender, --- this. Size; textBox10rigina1Rect button10riginalRect button20rigina1Rect button30riginalRect button40rigina1Rect • --- new Recra031e(textBox1.Location.X, textBox1.Location.Y, textBox1 .Width, textBox1.Height); neu X, buttonl. Location.Y, buttonl. Width, button1.Height); Rectaagle(button2.Location.X, button2. Location.Y, button2.Width, button2. Height); neu RectancLc(button3.Location. X, button3. Location.Y, button3.Width, button3. Height); neu Rectang2e(button4.Location.X, button4. Location.Y, button4.Width, button4.Height); {width="13.40625in" height="9.09375in"}

 

Erfasster Bildschirmausschnitt: 31.01.2018 20:33

 

 

 

Computergenerierter Alternativtext: private void resizeChi1drenContr01s() res i zeControl ( , resizeControl (button10riginalRect, resizeControl (button20riginalRect, resi zeControl (button30r Rect resizeControl (button40riginalRect, textBox1) ; buttonl ) ; button2) ; button3) ; button4) ; private void resizeContr01(Rectanelcl originalContr01Rect, Icntrc . control) float xRatio float yRatio int newX = (int)(origina1Contr01Rect.X • xRatio); int newy - (int)(originalContr01Rect.Y • yRatio); int ne\*idth = (int) (originalContr01Rect.Width xRatio); int needeight = • yRatio); control.Location = neu cint(newX, newY); contr01.Size = new newHeight); private void sender, ventArgr, e) resizeChildrenContr015 ( ) ; {width="8.916666666666666in" height="7.625in"}

 

Erfasster Bildschirmausschnitt: 31.01.2018 20:34