易截截图软件、单文件、免安装、纯绿色、仅160KB

用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++中的结构体对齐问题(内存对齐)

由于程序运行时占用的内存过大,所以想办法给程序瘦身。
在调试中发现结构体占用的size竟然和预想的不一样,原来……
看看下面讲的吧,肯定会不枉此看哦!
1,比如:
struct{
    short a1;
    short a2;
    short a3;
}A;
struct{
    ......

50个c/c++源代码网站

C/C++是最主要的编程语言。这里列出了50名优秀网站和网页清单,这些网站提供c/c++源代码。这份清单提供了源代码的链接以及它们的小说明。我已尽力包括最佳的C/C++源代码的网站。这不是一个完整的清单,您有建议可以联系我,我将欢迎您的建议,以进一步加强这方面的清单。 1、http://snippets.dzone.com/tag/c/ --数以千计 ......

c 选择结构1

/*用if多层嵌套实现a,b,c大小的六种排序情况a>b>c,a>c>b,c>a>b,c>b>a,b>c>a,b>a>c*/
#include<stdio.h>
void main()
{
  unsigned int a,b,c;
  printf("please input three numbers a,b,c:");
  scanf("%d%d%d",&a,&b,&c);
  if ......

C C++ 输出中文【转】


1. wprintf
Q : sizeof(wchar_t) = ?
A : 随编译器不同。(所以:在需要跨平台的时候尽量不用wchar_t) vc : sizeof(wchar_t) = 2;
Q: 在vc中,为什么直接使用wprintf(L"测试1234")会没有结果
A: 没有设置好locale,这样做
setlocale(LC_ALL ,
"
chs
"
);
wprintf(L
"
%s
"
,L
......
© 2009 ej38.com All Rights Reserved. 关于E健网联系我们 | 站点地图 | 赣ICP备09004571号