用Visual C#编写屏幕保护程序
Visual C#是微软公司推出的新一代程序开发语言,是微软.Net框架中的一个重要组成部分。屏幕保护程序是以scr为扩展名的标准Windows可执行程序。屏幕保护程序不仅可以延长显示器的使用寿命,还可以保护私人信息。本文向大家介绍一个.Net平台上用C#编写的一个动态文本及图形的屏幕保护程序。
一、具体实现步骤:
(1)在Visual Studio.Net下新建一个C#的Windows应用程序工程,不妨命名为screen_saver。
(2)现在我们来设计程序的主界面:
先将窗体的Name属性设置为screen、Text属性设置为空,BackColor属性设置为Black、Size属性设置为(800, 600)、 ControlBox、MaximizeBox、MinimizeBox、ShowInTaskbar属性设置均为false、FormBorderStyle属性设置为None。再往窗体上添加Label控件、PictureBox控件、Timer控件各一个。将Label控件的Name设置为word、Text属性设置为空;将PictureBox控件的Name设置为picture1、Image设置为一个预知图片;将Timer控件的Name设置为timerSaver、Enabled 属性设为true、Interval属性设为5。
(3)现在我们开始编写完整程序代码部分:
//导入使用到的名称空间
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
file://
namespace screen_saver
{
///
/// Form1 的摘要说明。
///
public class screen : System.Windows.Forms.Form
{
file://加入私有成员变量
private System.ComponentModel.IContainer components;
private int iSpeed = 2;
private string str="福建南纺股份公司计算机中心";
file://定义文本字体及大小
private System.Drawing.Font TextStringFont = new System.Drawing.Font ("宋体”, 10,System.Drawing.FontStyle.Bold);
private Color TextStringcolor =System.Drawing.Color.Yellow; file://文本字体颜色
private int iDistance;
private int ixStart= 0;
private int iyStart= 0;
private int speed;
private int x1,y1;
int width1,height1;
private System.Windows.Forms.Timer timerSaver; file://计时器控件
private System.Windows.Forms.PictureBox picture1; file://图形控件
private System.Windows.Forms.Label word; file://文本
相关文档:
C、传统 C++
#include <assert.h>
//设定插入点
#include <ctype.h>
//字符处理
#include <errno.h>
//定义错误码
#include <float.h>
//浮点数处理
#include <fstream.h>
//文件输入/输出
#include <iomanip.h> ......
// 摘自:Wikipedia.org
C语言的标准文文件要求了一个平台移植C语言的时候至少要实现的一些功能和封装的集合,称为“标准库”,标准库的声明头部通过预处理器命令#include进行引用。
在C89标准中:
01. <assert.h>
02. <ctype.h>
&nbs ......
1. 采用短变量。如bData,unsigned char。
2. 无符号变量。51不支持符号运算。
3. 避免使用浮点指针。浮点运算时要禁止中断。
4. &nb ......
本实例一套人事管理系统:开发工具为VFP9.0、SQL2000、EXCEL;使用了Adobe Photoshop平面设计软件,采用了SPT穿透技术,调用了API函数,实现了对系统时间的统一控制、对DNS的代码控制、对域名解析的应用,等等
晕,怎么上传,(包含源码未编译的)想要的给我发E-MAIL:zhao@tom.com ......