首页 ┆ 网站地图 ┆ 在线留言 ┆ 游戏资讯 ┆ 资源下载 ┆ 端午节祝福 ┆ 迅雷在线影视
设为首页
加入收藏
联系我们
高级搜索
您当前的位置: 主页>NET专区>.NET2.0>asp.net改变VS2005中屏保,实现字幕滚动和字体消隐技术
asp.net改变VS2005中屏保,实现字幕滚动和字体消隐技术
来源: 发布时间:2007-10-31 发布人: 浏览: 人次   字体: [ ]  
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace test
{
    
public partial class Form1 : Form
    
{
        
public Form1()
        
{
            InitializeComponent();
        }

        
private int textAlpha = 0;
        
        
private int textAlphaDelta = 4;
        
private int textAlphaMax = 251;
       
        
        
private void Form1_Paint(object sender, PaintEventArgs e)
        
{
            
// 更改图形设置以绘制清晰的文本
            e.Graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
            e.Graphics.TextRenderingHint 
= System.Drawing.Text.TextRenderingHint.ClearTypeGridFit;

            
// 确定位于文本上方和下方的
            
// 线条的位置
            float lineLeftX = Size.Width / 4;
            
float lineRightX = 3 * Size.Width / 4;
            
int lineVerticalBuffer = Size.Height / 50;
            
float lineTopY = Location.Y + lineVerticalBuffer;
            
float lineBottomY = Location.Y + Size.Height - lineVerticalBuffer;



            
// 绘制文章的文本
            using (StringFormat textFormat = new StringFormat(StringFormatFlags.LineLimit))
            
{
                textFormat.Alignment 
= StringAlignment.Near;
                textFormat.LineAlignment 
= StringAlignment.Near;
                textFormat.Trimming 
= StringTrimming.EllipsisWord;
                
int textVerticalBuffer = 4 * lineVerticalBuffer;
                
//Rectangle textRect = new Rectangle(Location.X, Location.Y + textVerticalBuffer, Size.Width, Size.Height - (2 * textVerticalBuffer));
                Rectangle textRect = new Rectangle(Location.X, textAlpha, Size.Width, Size.Height - (2 * textVerticalBuffer));
                
using (Brush textBrush = new SolidBrush(Color.FromArgb(textAlpha, ForeColor)))
                
{
                    e.Graphics.DrawString(
"IT知道网itwis.com - 打造主流程序开发、网络应用、资源共享、电脑技术资讯站"this.Font, textBrush, textRect, textFormat);
                }

            }

        }


        
private void timer1_Tick(object sender, EventArgs e)
        
{

            
// 更改要绘制的文本的 alpha 值
            
// 逐步增加值,直至达到 textAlphaMax,然后再逐步减小值
            
// 当值重新为零时移动到下一文章
            textAlpha += textAlphaDelta;
            
if (textAlpha >= textAlphaMax)
            
{
                textAlphaDelta 
*= -1;
            }

            
else if (textAlpha <= 0)
            
{
                
// FadingComplete(this, new EventArgs());
                textAlpha = 0;
                textAlphaDelta 
*= -1;
            }

            
//label1.Text = textAlpha.ToString();
            
//label1.Refresh();
            this.Refresh();
        }


        
private void Form1_Load(object sender, EventArgs e)
        
{
            
this.Height = 300;
            
this.Width = 600;
        }

        
    }

}

相 关 文 章   发布商链接
·实用小知识:contentEditable小解用...
·VS2005利用Excel组件操作Excel全攻略
·ASP.NET2.0连接ORACLE实例代码
·asp.net 2.0揭秘GetDataIten和Eval方...
·asp.net(C#)弹出窗口返回值并刷新主...
·gridview空数据源时仍显示表头和提示
·asp.net2.0回发或回调参数无效问题的...
·asp.net url 映射技术改变网址
·使用放在App_Code中类的静态成员应该...
·Asp.net页面传递参数的几种方法对比...
 §最新评论:(评论内容只代表网友观点,与本站立场无关!)
网名: 验证码:  【所有评论】【↑返回顶部
评 分: 12 345
评论内容:(不能超过500字,请自觉遵守互联网相关政策法规。[按 Ctrl+Enter 可直接提交]
注意:请勿在本站发布政治话题、色情及违反法律的内容。
IT知道网 声明:刊登此文章是为了传递更多信息,文章内容仅供参考,转载请注明出处。
推 荐 文 章
·实例讲解在.net2.0中对config
·包含32种常见的用户输入验证...
·asp.net不使用服务器控件的情
·如何更改单个aspx页面的编码...
·实例讲解如何设置gridview的...
·asp.NET 2.0中引发CSS失效问...
·GridView通过模板列实现第一...
·VS2005利用TreeView控件和递...
·DataView对象获取数据行相应...
·GridView中固定列的两种方法
·为GridView控件添加分页导航...
·Net2.0中使用母版页及其母版...
·实例解决GridView中弹出对话...
·Gridview控件字段内容过长的...
·图解ASP.NET下AJAX安装(VS20...
热 门 文 章
·asp.net(C#)弹出窗口返回值并...
·VS2005利用Excel组件操作Exce...
·AJAX实现无刷新适时显示gridV...
·gridview表头固定并实现打印...
·Js获取radiobuttonlist选中值...
·gridview绑定数据显示的各种...
·ASP.NET中“无法加载 DLL 找...
·asp.net2.0回发或回调参数无...
·asp.net文件下载防止乱码出现...
·实现gridview内容打印功能的...
·图解ASP.NET下AJAX安装(VS20...
·ASP.NET多个用户控件回车提交...
·实例解决GridView中弹出对话...
·gridview空数据源时仍显示表...
·asp.net中GridView每个单元格...
网站首页 - 关于本站 - 加入收藏 - 网站地图 - 友情连接 - 在线留言 - 联系我们 - 返回顶部
Copyright © 2007 IT知道网.[冀ICP备07026896号]. All Rights Reserved .