- 5
- 0
- 约1.82万字
- 约 18页
- 2017-05-15 发布于贵州
- 举报
windows序设计实验代码
5(1)使用菜单及上下文菜单设置窗体颜色
(2)使用Timer控件及状态栏控件实现在状态栏中显示当前时间及鼠标移动时的坐标位置。
-------------------------------5.1实验代码-----------------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace _5
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void redToolStripMenuItem1_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red;
}
private void redToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Red;
}
private void greenToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Green;
}
private void yellowToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Yellow;
}
private void blackToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Black;
}
private void pinkToolStripMenuItem_Click(object sender, EventArgs e)
{
this.BackColor = Color.Pink;
}
private void Form1_Load(object sender, EventArgs e)
{
groupBox1.Left = -1;
groupBox1.Width = this.Width + 100;
groupBox1.Height = this.Height + 100;
}
}
}
---------------------------------------5.2 实验代码-------------------------
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(obje
原创力文档

文档评论(0)