TheDeveloperBlog.com

Home | Contact Us

C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML

<< Back to C-SHARP

Panel, Windows Forms (Create Group of Controls)

Use Panel in Windows Forms to organize controls in a group.
Panel creates a group of controls. This control provides a simple frame for putting sub-controls inside. These sub-controls include buttons and text boxes. It further provides an optional border and ways to change its visibility.
To start, please open your Visual Studio Windows Forms project and open the Toolbox, where you can then double-click on the Panel icon. Next, try right-clicking on the Panel in the form and selecting Properties.

Also: You might want to change the BorderStyle, which you can set to Fixed3D to make the Panel look like the example screenshot.

Sub-controls in Panel. The entire point of the Panel is to provide a visual and logical grouping for controls. To add some controls to the Panel, drag them to the inner part of the Panel in Visual Studio.

And: When the controls are inside the Panel, they will be affected by the Enabled property of the Panel and the Visible property.

Note: In the example, we added two Button controls to the inside of the Panel control.

Borders. The default Panel does not have a visible border. This is ideal for some programs. But for others, using the Fixed3D or FixedSingle border style is more appropriate. This may also look better.

Review: As you may know from other controls, FixedSingle is a single dark line while the Fixed3D style is an inset, shaded border.

Enabled. What happens when you set the Enabled property of the Panel to False? All of the enclosed controls in the Panel, such as buttons or text boxes, will become inactive and grayed out. They cannot be used by the mouse or the keyboard.

And: Instead of dealing with many text boxes or buttons separately, you can change many controls' states at once with the Panel this way.

Setting Visible property. Also, the Visible property of the Panel affects all the enclosed controls. So if you set the Visible property to False, you will hide all of the sub-controls inside the Panel as well as the Panel itself.
Summary. The Panel control is a container or grouping mechanism in Windows Forms, and can be used both for visual and logical organization. With its border options, you can visually organize your program's sub-controls.

And: With its ability to affect the state of all its enclosed controls, you can reduce your program's logical complexity.

© TheDeveloperBlog.com
Home
The Dev Codes

Related Links:


Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf