c绘制艺术字的方法 1文档格式.docx

上传人:b****6 文档编号:19521215 上传时间:2023-01-07 格式:DOCX 页数:9 大小:81.98KB
下载 相关 举报
c绘制艺术字的方法 1文档格式.docx_第1页
第1页 / 共9页
c绘制艺术字的方法 1文档格式.docx_第2页
第2页 / 共9页
c绘制艺术字的方法 1文档格式.docx_第3页
第3页 / 共9页
c绘制艺术字的方法 1文档格式.docx_第4页
第4页 / 共9页
c绘制艺术字的方法 1文档格式.docx_第5页
第5页 / 共9页
点击查看更多>>
下载资源
资源描述

c绘制艺术字的方法 1文档格式.docx

《c绘制艺术字的方法 1文档格式.docx》由会员分享,可在线阅读,更多相关《c绘制艺术字的方法 1文档格式.docx(9页珍藏版)》请在冰豆网上搜索。

c绘制艺术字的方法 1文档格式.docx

g.SmoothingMode=SmoothingMode.AntiAlias;

FontnewFont=newFont("

TimesNewRoman"

48);

Matrixmatrix=newMatrix();

//投射

matrix.Shear(-1.5f,0.0f);

//缩放

matrix.Scale(1,0.5f);

//平移

matrix.Translate(130,88);

//对绘图平面实施坐标变换、、

g.Transform=matrix;

SolidBrushgrayBrush=newSolidBrush(Color.Gray);

SolidBrushcolorBrush=newSolidBrush(Color.BlueViolet);

stringtext="

博客园"

;

//绘制阴影

g.DrawString(text,newFont,grayBrush,newPointF(0,30));

g.ResetTransform();

//绘制前景

g.DrawString(text,newFont,colorBrush,newPointF(0,30));

}

二.浮雕效果

浮雕文字实现

//浮雕文字

BrushbackBrush=Brushes.Black;

BrushforeBrush=Brushes.White;

Fontfont=newFont("

宋体"

Convert.ToInt16(40),FontStyle.Regular);

SizeFsize=g.MeasureString(text,font);

SingleposX=(this.Width-Convert.ToInt16(size.Width))/2;

SingleposY=(this.Height-Convert.ToInt16(size.Height))/2;

g.DrawString(text,font,backBrush,posX+1,posY+1);

g.DrawString(text,font,foreBrush,posX,posY);

三.印版效果

印版文字实现

//印版文字

inti=0;

BrushforeBrush=Brushes.Violet;

System.Convert.ToInt16(40),FontStyle.Regular);

g.Clear(Color.White);

SingleposY=(this.Height-Convert.ToInt16(size.Height))/3;

while(i<

Convert.ToInt16(20))

g.DrawString(text,font,backBrush,posX-i,posY+i);

i=i+1;

}

四.倒影效果

倒影文字实现

//倒影文字

BrushbackBrush=Brushes.Gray;

BrushforeBrush=Brushes.Black;

幼圆"

intposX=(this.Width-Convert.ToInt16(size.Width))/2;

intposY=(this.Height-Convert.ToInt16(size.Height))/2;

g.TranslateTransform(posX,posY);

intascent=font.FontFamily.GetCellAscent(font.Style);

intspacing=font.FontFamily.GetLineSpacing(font.Style);

intlineHeight=System.Convert.ToInt16(font.GetHeight(g));

intheight=lineHeight*ascent/spacing;

GraphicsStatestate=g.Save();

g.ScaleTransform(1,-1.0F);

g.DrawString(text,font,backBrush,0,-height);

g.Restore(state);

g.DrawString(text,font,foreBrush,0,-height);

五.阴影效果

阴影文字实现

//阴影文字

BrushshadowBrush=Brushes.Gray;

SingleposX=(this.Width-Convert.ToInt16(size.Width))/4;

g.DrawString(text,font,shadowBrush,posX+Convert.ToInt16(20),posY+Convert.ToInt16(20));

六.纹理效果

线理效果实现

//使用图像填充文字线条

TextureBrushbrush=newTextureBrush(Image.FromFile(Application.StartupPath+"

\\myPicture.jpg"

));

Graphicsg=e.Graphics;

g.DrawString("

newFont("

隶书"

60),brush,newPointF(0,0));

七.倾斜效果

倾斜效果实现

BrushforeBrush=Brushes.Blue;

Matrixtransform=g.Transform;

//右倾斜文字

//floatshearX=-0.230F;

//左倾斜文字

floatshearX=0.550F;

floatshearY=0.10F;

transform.Shear(shearX,shearY);

g.Transform=transform;

g.DrawString(text,font,foreBrush,0,0);

八.渐变色效果

渐变色效果实现

//渐变色文字

Stringtext="

博客园"

BrushShadowBrush=Brushes.Gray;

BrushForeBrush=Brushes.Black;

//g.Clear(Color.White);

PointFpoint=newPointF(0,0);

RectangleFrectangle=newRectangleF(point,size);

Brushbrush=newLinearGradientBrush(rectangle,Color.Red,Color.Green,LinearGradientMode.Horizontal);

intwidth=(this.Width-Convert.ToInt16(size.Width))/2;

intheight=(this.Height-Convert.ToInt16(size.Height))/2;

g.DrawString(text,font,brush,width,height);

九.旋转效果

旋转效果实现

//旋转显示文字

g.SmoothingMode=System.Drawing.Drawing2D.SmoothingMode.AntiAlias;

for(inti=0;

i<

=360;

i+=10)

//平移Graphics对象到窗体中心

g.TranslateTransform(this.Width/2,this.Height/2);

//设置Graphics对象的输出角度

g.RotateTransform(i);

//设置文字填充颜色

Brushbrush=Brushes.DarkViolet;

.bokeyuan"

LucidaConsole"

11f),brush,0,0);

//恢复全局变换矩阵

十...........

后记:

还有很多,原理都相当简单,绘制字体图关键要熟悉三个常用绘图类

Brush,Font,Graphics;

这里用到的主要方法是Graphics类的DrowString.

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 经管营销 > 生产经营管理

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1