C# winfrom简单的题目
来源:互联网 发布:淘宝加盟商 编辑:程序博客网 时间:2024/06/14 09:51
1.编写程序在窗体上放置1个Text Box控件和4个Button控件。分别按下这4个按钮,可以把文本框的背景色分别设置为红色、蓝色、黑色和绿色。
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 Colors{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void Redbutton_Click(object sender, EventArgs e) { Redbutton.BackColor = textBox1.BackColor = Color.Red; Redbutton.ForeColor = Color.White; } private void Bluebutton_Click(object sender, EventArgs e) { Bluebutton.BackColor = textBox1.BackColor = Color.Blue; Bluebutton.ForeColor = Color.White; } private void Blackbutton_Click(object sender, EventArgs e) { Blackbutton.BackColor = textBox1.BackColor = Color.Black; Blackbutton.ForeColor = Color.White; } private void Greenbutton_Click(object sender, EventArgs e) { Greenbutton.BackColor = textBox1.BackColor = Color.Green; Greenbutton.ForeColor = Color.White; } }}
2.在窗体上放置4个排成矩形的按钮,每个按钮的标题都是Push Me!。当用户单击其中一个按钮时,此按钮便会消失,其它3个依然存在。
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 BadButton{ public partial class Form1 : Form { public Form1() { InitializeComponent(); } private void PushMebutton_Click(object sender, EventArgs e) { PushMebutton.BackColor = Color.Transparent; PushMebutton.FlatStyle = FlatStyle.Flat; PushMebutton.FlatAppearance.BorderSize = 0; PushMebutton.Text = " "; } private void PushMebutton4_Click(object sender, EventArgs e) { PushMebutton4.BackColor = Color.Transparent; PushMebutton4.FlatStyle = FlatStyle.Flat; PushMebutton4.FlatAppearance.BorderSize = 0; PushMebutton4.Text = " "; } private void PushMebutton2_Click(object sender, EventArgs e) { PushMebutton2.BackColor = Color.Transparent; PushMebutton2.FlatStyle = FlatStyle.Flat; PushMebutton2.FlatAppearance.BorderSize = 0; PushMebutton2.Text = " "; } private void PushMebutton3_Click(object sender, EventArgs e) { PushMebutton3.BackColor = Color.Transparent; PushMebutton3.FlatStyle = FlatStyle.Flat; PushMebutton3.FlatAppearance.BorderSize = 0; PushMebutton3.Text = " "; } }}
0 0
- C# winfrom简单的题目
- C# winfrom软件的稳定性
- Winfrom编写简单的计算器
- C# WinFrom SplitContainer和UserControl组成简单的类似于web系统的框架页
- C#简单的面试题目(二)
- C#简单的面试题目(一)
- C#简单的面试题目(四)
- C#简单的面试题目(三)
- C#简单的面试题目(五)
- C#简单的面试题目(一)
- C#简单的面试题目(二)
- C#简单的面试题目(三)
- C#简单的面试题目(四)
- C#简单的面试题目(五)
- C#简单的面试题目(六)
- C#,一些C#的简单题目
- 取消窗体的关闭[C# WinFrom]
- C# Winfrom 默认输入法的设置
- 文本分析--基于gensim的文本主题模型分析
- Unity3D说明文档翻译-Lighting Overview
- c#调用外部dll详解
- 推荐一个php在线测试地址
- Java基本类型与引用类型 以及 Java内存知识整理
- C# winfrom简单的题目
- 回调函数
- 使用css伪元素的一些遐想
- ubuntu与win7在局域网下共享文件
- Cenos7_Install_Mysql5.7
- CSDN日报20170411
- 全息电话会议开源项目LiveScan3D-Hololens
- PAT乙级(Basic Level)真题 数素数(素数筛法)
- c++基础 类的设计