当前位置:网站首页>C application interface development foundation - form control (5) - grouping control
C application interface development foundation - form control (5) - grouping control
2022-07-05 19:28:00 【DXB2021】
Group class control
Grouped controls have containers (Panel) Control 、 Group box (GroupBox) Control 、 tab (TabControl) Controls, etc. .
Container controls
Container controls are controlled by System.Windows.Forms.Panel Class provides the . This control is equivalent to a container , The main function is to put other controls together on a panel , Make these controls easier to manage .
Programming , To make a “ Download Explorer ”.
The development steps are as follows :
1、 First, in the Form1 Add three... To the form Button Control , And modify the Text attribute ; Then add one more Panel Control , And add the Size Property is set to “307,181”.
2、 Then create three new forms , , respectively, by Regular.cs General form 、Download.cs Download forms and Appearance.cs Appearance form , And add corresponding controls for the three forms . We need to pay attention to , After the new form is completed , They also need to be Size Property is set to “307,181”.
Right click , Select Rename .
3、 Last in Form1.cs In file , Add three Button The control of Click event .
Before code
After code :
The code is as follows :
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 WindowsFormsApp1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
Regular myRegular=new Regular();
myRegular.TopLevel = false;
this.panel1.Controls.Add(myRegular);
myRegular.FormBorderStyle= FormBorderStyle.None;
myRegular.BringToFront();
myRegular.Show();
}
private void button2_Click(object sender, EventArgs e)
{
Download myDownload = new Download();
myDownload.TopLevel = false;
this.panel1.Controls.Add(myDownload);
myDownload.FormBorderStyle = FormBorderStyle.None;
myDownload.BringToFront();
myDownload.Show();
}
private void button3_Click(object sender, EventArgs e)
{
Appearance myAppearance = new Appearance();
myAppearance.TopLevel = false;
this.panel1.Controls.Add(myAppearance);
myAppearance.FormBorderStyle = FormBorderStyle.None;
myAppearance.BringToFront();
myAppearance.Show();
}
}
}
The operation results are as follows :
Click on , No response , Run failed .
Three windows redesigned :
Run again :
Group box control
The grouping box control is composed of System.Windows.Forms.GroupBox Class provides the , The function is to provide recognizable grouping for other controls , Multiple single choices can be realized on the same page RadioButton Control . Usually , Use the grouping box to subdivide the form by function .
Tab controls
A tab control is a tab control , In practice It is often used in programming , The function of this control is to combine related components into a series of tab pages .
1、 Add and remove TabControl Control
2、 Add and remove tabs programmatically .
边栏推荐
- CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
- 不愧是大佬,字节大牛耗时八个月又一力作
- Vagrant2.2.6 supports virtualbox6.1
- Shell编程基础(第8篇:分支语句-case in)
- HAC cluster modifying administrator user password
- Explain in detail the functions and underlying implementation logic of the groups sets statement in SQL
- acm入门day1
- 618“低调”谢幕,百秋尚美如何携手品牌跨越“不确定时代”?
- 集合
- [FAQ] summary of common causes and solutions of Huawei account service error 907135701
猜你喜欢
随机推荐
HAC集群修改管理员用户密码
不愧是大佬,字节大牛耗时八个月又一力作
Cf:b. almost Terry matrix [symmetry + finding rules + structure + I am structural garbage]
PG basics -- Logical Structure Management (user and permission management)
Debezium系列之:解析默认值字符集
微波雷达感应模块技术,实时智能检测人体存在,静止微小动静感知
What are general items
IBM has laid off 40 + year-old employees in a large area. Mastering these ten search skills will improve your work efficiency ten times
Go deep into the underlying C source code and explain the core design principles of redis
基于FPGA的超声波测距
14、用户、组和权限(14)
Interviewer: what is the difference between redis expiration deletion strategy and memory obsolescence strategy?
【obs】libobs-winrt :CreateDispatcherQueueController
Summer Challenge database Xueba notes, quick review of exams / interviews~
vagrant2.2.6支持virtualbox6.1版本
CF: B. almost Ternary Matrix [symétrie + règles de recherche + Construction + I am Construction Waste]
什么是面上项目
#夏日挑战赛#数据库学霸笔记,考试/面试快速复习~
在线协作产品哪家强?微软 Loop 、Notion、FlowUs
Pandora IOT development board learning (HAL Library) - Experiment 8 timer interrupt experiment (learning notes)