当前位置:网站首页>C form application of C (27)
C form application of C (27)
2022-07-06 03:47:00 【camellias_】
Start today C# forms .
( One ): First create a form application
file -> newly build -> project
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-wHGHwNkS-1655864419857)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/7fe6b42e1adc41228fb7efd1e0289bc6~tplv-k3u1fbpfcp-zoom-1.image "1554793114874675.png")]](/img/64/65d86970b5ac761066394dac6558c1.png)
( Two ): Buttons and labels in forms (button/label)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-ts3axSL3-1655864419868)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/c5d943cc21164e918bb5713463a32b67~tplv-k3u1fbpfcp-zoom-1.image "1554793122613600.png")]](/img/9b/cf2f7477a4446129f8345b12b0691b.png)
Click toolbox , Fix it on the screen .
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-p6XTJ5ao-1655864419872)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/bc6c96f2073248deac0fd872aedd6af8~tplv-k3u1fbpfcp-zoom-1.image "1554793129996027.png")]](/img/61/c9897aca98d09a9e63c39a09e50238.png)
When setting button and label properties , Remember to modify it NAME attribute And Text attribute
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-jrPk7XbA-1655864419873)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/99f5666fb803484793264baf4fb4828a~tplv-k3u1fbpfcp-zoom-1.image "1554793138626962.png")]](/img/c9/3724e9bfdbc842377add30c626083c.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-wuFk2YTX-1655864419874)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/319ce4ac9a4d448ea3522bb59f0ef8c3~tplv-k3u1fbpfcp-zoom-1.image "1554793143716022.png")]](/img/a7/27b71ef87ef7638aac287cf03b322d.png)
/**
* Method of event
*/
private void MyButton_Click(object sender, EventArgs e)
{
// Dialogue window display
MessageBox.Show("HELLO My first form ");
}
/**
* How to label
*/
private void label1_Click(object sender, EventArgs e)
{
}
private void button1_Click(object sender, EventArgs e)
{
// The attribute of this object is equal to
answer_label.Text = " answer : The eight trigrams of yin and Yang , Opposites attract ";
}
( 3、 ... and ): Hyperlink label (linklabel)
1:Linkcolor: The default color of hyperlinks .:
2:Activelinkcolor: The color of the hyperlink when it is clicked
3:Visitedlinkcolor: The color of hyperlinks that have been visited .
4:Linkbehavior: Hyperlink underline style
5: event :
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-v427mZxg-1655864419875)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/4d4a10f3e6014d13932e7427b786de4d~tplv-k3u1fbpfcp-zoom-1.image "1554793170294796.png")]](/img/bf/5751b21eb83b3d4a5647fd392eeae2.png)
/**
* Hyperlink event
*/
private void linkLabel1_LinkClicked(object sender, LinkLabelLinkClickedEventArgs e)
{
// Set the link color after clicking
oneLink.LinkVisited = true;
// open C disc (@ Is output as is )
System.Diagnostics.Process.Start(@"C:/");
}
private void linkLabel1_LinkClicked_1(object sender, LinkLabelLinkClickedEventArgs e)
{
// Set the link color after clicking
linkTwo.LinkVisited = true;
// Open the web page
System.Diagnostics.Process.Start("chrome","https://guanchao.site");
}
private void Form1_Load(object sender, EventArgs e)
{
}
private void linkLabel1_LinkClicked_2(object sender, LinkLabelLinkClickedEventArgs e)
{
// Set the link color after clicking
linkTwo.LinkVisited = true;
// Open application
System.Diagnostics.Process.Start("Notepad");
}
( Four ): The text box (textbox)
1: attribute
multiline: Controls whether text can span lines .
AcceptsReturn: Whether the multiline edit control allows the input of carriage return .
AcceptsTab: Whether the multiline edit control allows input Tab key .
ReadOnly: read-only
ScrollBars: For multiline controls , Show scroll bar or not .
TabIndex: Confirm that the secondary control applies Tab Indexes
PasswordChar: Display password characters
AcceptsButton: Pressing enter is equal to pressing OK ( Form event )
2: event
Textchange event : amount to javascript Medium Change event .
3: Method
Clear: Clear everything in the text box
Copy: Copy the selection
Cut: Cut the selected content
Paste: Replace the selected text with the cut text
ResetText: take text Property is reset to the default value
Redo: Repeat the previous operation
Redo: Undo last action
private void but_Click(object sender, EventArgs e)
{
string ques_str = quesBox.Text;
string pass_str = passBox.Text;
if (ques_str == "gc" && pass_str == "123456")
{
MessageBox.Show(" Successful operation ");
}
else {
MessageBox.Show(" Wrong password ");
}
}
( Four ): Radio button (RadioButton)
1: attribute :
Checked: Whether the radio button has been selected .
C# Radio button in NAME Attributes do not need to be the same
// Define a variable to store gender
public string sex;
// Choose male , Assign a value to the tag
private void boy_radio_CheckedChanged(object sender, EventArgs e)
{
sex = " male ";
}
// Choose women , Assign a value to the tag
private void gr_radio_CheckedChanged(object sender, EventArgs e)
{
sex = " Woman ";
}
// Click the confirm button to leave the event
private void button1_Click_1(object sender, EventArgs e)
{
if (boy_radio.Checked == false && gr_radio.Checked == false)
{
MessageBox.Show(" Please choose gender ");
}
else {
MessageBox.Show(" Your difference is :"+sex);
}
}
( 5、 ... and ): Check box (CheckBox)
1: attribute :
Checked: Whether the check button is selected .
CheckState: Component state ( Three states );
Check boxes are similar to radio boxes , There is no example here , Refer to the radio box .
( 6、 ... and ): Digital input box (NumericUpDown)
1: attribute
Increment: Click the plus sign behind once to increase the number
MiniMum: Input box minimum
MaxMum: Input box maximum
Value: The default value is
2: event
ValueChanged: Default event ( Value change )
public int num;
private void numericUpDown1_ValueChanged(object sender, EventArgs e)
{
num = Convert.ToInt32(numUpOne.Text);
Font ff = new Font(" In black ", num);
label4.Font = ff;
}
private void num_button_Click(object sender, EventArgs e)
{
int nums = num + 1;
MessageBox.Show(" The number you entered is " + nums);
}
( 7、 ... and ): Group box (GroupBox)
This is nothing , It is a partition function .
Put the functional partitions of each part .
[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-iEh41uFh-1655864539618)(https://p3-juejin.byteimg.com/tos-cn-i-k3u1fbpfcp/8286432aab1e40a78f5d5d874df51090~tplv-k3u1fbpfcp-zoom-1.image#pic_center)]
There are good suggestions , Please enter your comments below
Welcome to personal blog
https://guanchao.site
Welcome to the applet :

边栏推荐
- 施努卡:什么是视觉定位系统 视觉系统如何定位
- Schnuka: what is visual positioning system and how to position it
- Pytorch基础——(2)张量(tensor)的数学运算
- C#(三十)之C#comboBox ListView treeView
- 数据分析——seaborn可视化(笔记自用)
- Cf603e pastoral oddities [CDQ divide and conquer, revocable and search set]
- Remote Sensing Image Super-resolution and Object Detection: Benchmark and State of the Art
- SAP ALV cell level set color
- C#(二十八)之C#鼠标事件、键盘事件
- C#(三十一)之自定义事件
猜你喜欢

在 .NET 6 中使用 Startup.cs 更简洁的方法
![[Massey] Massey font format and typesetting requirements](/img/27/6b641551d6d8699683972f40f3b8e5.jpg)
[Massey] Massey font format and typesetting requirements

【按键消抖】基于FPGA的按键消抖模块开发
![[analysis of variance] single factor analysis and multi factor analysis](/img/92/5337d0ef6e487d1af2f56cb3a3268a.jpg)
[analysis of variance] single factor analysis and multi factor analysis

Blue Bridge Cup - Castle formula

记录一下逆向任务管理器的过程

C language -- structs, unions, enumerations, and custom types

遥感图像超分辨率论文推荐

MADDPG的pythorch实现——(1)OpenAI MADDPG环境配置

After five years of testing in byte, I was ruthlessly dismissed in July, hoping to wake up my brother who was paddling
随机推荐
KS003基于JSP和Servlet实现的商城系统
Flask learning and project practice 8: introduction and use of cookies and sessions
C language judgment, ternary operation and switch statement usage
C#(三十)之C#comboBox ListView treeView
2.2 STM32 GPIO操作
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
Blue style mall website footer code
1.16 - check code
Exness foreign exchange: the governor of the Bank of Canada said that the interest rate hike would be more moderate, and the United States and Canada fell slightly to maintain range volatility
【Qt5】Qt QWidget立刻出现并消失
2. GPIO related operations
Differential GPS RTK thousand search
Failure causes and optimization methods of LTE CSFB
3.1 rtthread 串口设备(V1)详解
[001] [stm32] how to download STM32 original factory data
[practice] mathematics in lottery
Indicator system of KQI and KPI
User perceived monitoring experience
施努卡:什么是视觉定位系统 视觉系统如何定位
Factors affecting user perception