请利用所学的桌面应用开发知识,仿照完成一个类似IOS拨号功能的小软件,功能要求如下所示:
1.该软件包含一个拨号主窗体,设置窗体大小:470 * 760。
2.设置拨号窗体为:无边框窗体。
3.设置拨号窗体的起始显示位置为:屏幕中心。
4.设置拨号窗体始终显示在其它窗体之上。
5.设置拨号窗体的背景颜色,各Label字体及颜色如上图所示。(特殊说明:若考试电脑上没有微软雅黑Light字体,可用其它字体替代)
6.利用Timer控件,编写代码,实现正在呼叫随着时间的推移,显示“正在呼叫”, “正在呼叫.”, “正在呼叫…”, “正在呼叫…”通过省略号的变化,营造拨打电话的动态效果。
7.设置挂断控件的Cursor光标为Hand。
8.当用户点击挂断的时候,关闭主窗体,退出程序。
源代码:
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 dialup
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
{
this.BackColor = Color.FromArgb(68,57,63);
label6.ForeColor = Color.FromArgb(112,112,112);
}
private void pictureBox4_Click(object sender, EventArgs e)
{
this.Close();
}
public static int num = -1;
private void timer1_Tick(object sender, EventArgs e)
{
if(num<3)
{
num++;
}
string[] str = new string[] {
"正在呼叫", "正在呼叫.", "正在呼叫..", "正在呼叫..." };
label2.Text = str[num];
if (num==3)
{
num = -1;
}
}
private void timer2_Tick(object sender, EventArgs e)
{
this.TopMost = false;
this.BringToFront();
this.TopMost = true;
}
}
}
运行结果:
博主是一只小白,第一次发布文章,质量可能不行,希望多多谅解