一.效果图
二.简单谈谈实现思路
应该说实现方法还是很简单的,就是错位绘制而已.当然,这种效果没有完全体现出字体的立体效果,只是一种错位模仿,在对字体的边框进行描边后,又移动了一下绘制的坐标来体现阴影.感兴趣的朋友应该很容易实现.这里就不多说了.
三.部分源代码
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Data;
using System.Text;
using System.Windows.Forms;
namespace JCSControlLibary.AutoSetDocument
{
public partial class JcsBorderLabel : Label
{
private float borderSize = 1;//边框宽度
private Color borderColor = Color.White;//边框颜色
private SizeF drawningSize;
private bool isShowShadow = false;//是否显示阴影
#region Constructor
public JcsBorderLabel()
{
}
#endregion
#region Control Events
protected override void OnFontChanged(EventArgs e)
{
base.OnFontChanged(e);
this.Invalidate();
}
protected override void OnTextAlignChanged(EventArgs e)
{
base.OnTextAlignChanged(e);
this.Invalidate();
}
protected override void OnTextChanged(EventArgs e)
{
base.OnTextChanged(e);
}
protected override void OnForeColorChanged(EventArgs e)
{
base.OnForeColorChanged(e);
this.Invalidate();

这篇博客展示了如何通过错位绘制和描边技术实现简单的立体字体效果,虽然不是真正的三维立体,但能制造出阴影效果,适合对图形编程感兴趣的读者实践。
最低0.47元/天 解锁文章
1370

被折叠的 条评论
为什么被折叠?



