[Turn] in C # to display text with artistic effects tab control

C # achieve artistic effects with text label control

2009-09-28 from: CS programmer window
  • Summary: C # achieve the label control borders, relief, plate effect display text, you can change the color and text width Border achieve brilliant text display.

.NET comes with the Label control displays a text is very simple, only a change text color, font, with a long time feel tired. So I realized that display text with artistic effects tab control ArtTextLabel , in this control, I realized the only 3 kinds of effects, in fact, there are many other effects are achievable, we can try. Let's look at these 3 shots kinds of effects:

ArtTextLabelDemo.png

Achieve these effects is very simple, it is a little to change the starting coordinates to draw text, draw on it a few times, respectively, have a look at the effect of three different rendering code:

1,  border.

 
           
None.gif private void RenderBordText(Graphics g, PointF point)
ExpandedBlockStart.gifContractedBlock.gif
... {
InBlock.gif
using (Brush brush = new SolidBrush(_borderColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif
for (int i = 1; i <= _borderSize; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X
- i,
InBlock.gif point.Y);
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X,
InBlock.gif point.Y
- i);
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X
+ i,
InBlock.gif point.Y);
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X,
InBlock.gif point.Y
+ i);
ExpandedSubBlockEnd.gif }

ExpandedSubBlockEnd.gif }

InBlock.gif
InBlock.gif
using (Brush brush = new SolidBrush(base.ForeColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text, base.Font, brush, point);
ExpandedSubBlockEnd.gif }

ExpandedBlockEnd.gif }

2,  relief.

 
           
None.gif private void RenderRelievoText(Graphics g, PointF point)
ExpandedBlockStart.gifContractedBlock.gif
... {
InBlock.gif
using (Brush brush = new SolidBrush(_borderColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif
for (int i = 1; i <= _borderSize; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X
+ i,
InBlock.gif point.Y);
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X,
InBlock.gif point.Y
+ i);
ExpandedSubBlockEnd.gif }

ExpandedSubBlockEnd.gif }

InBlock.gif
InBlock.gif
using (Brush brush = new SolidBrush(base.ForeColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text, base.Font, brush, point);
ExpandedSubBlockEnd.gif }

ExpandedBlockEnd.gif }

3、  印版。

 
           
None.gif private void RenderFormeText(Graphics g, PointF point)
ExpandedBlockStart.gifContractedBlock.gif
... {
InBlock.gif
using (Brush brush = new SolidBrush(_borderColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif
for (int i = 1; i <= _borderSize; i++)
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text,
InBlock.gif
base.Font,
InBlock.gif brush,
InBlock.gif point.X
- i,
InBlock.gif point.Y
+ i);
ExpandedSubBlockEnd.gif }

ExpandedSubBlockEnd.gif }

InBlock.gif
InBlock.gif
using (Brush brush = new SolidBrush(base.ForeColor))
ExpandedSubBlockStart.gifContractedSubBlock.gif
...{
InBlock.gif g.DrawString(
InBlock.gif
base.Text, base.Font, brush, point);
ExpandedSubBlockEnd.gif }

ExpandedBlockEnd.gif }

statement:

This article belongs to the author and CS window programmers of all, welcome to reprint, must retain the copyright information, and given the original connection in the apparent position of the article page, otherwise the right to pursue legal responsibilities.

Author: Starts_2000

Source: CS window programmers of http://www.csharpwin.com .

You can use free or modify the source code provided, but please keep the copyright information in the source code, please see:

CS programmer window open source license http://www.csharpwin.com/csol.html .

Reproduced in: https: //www.cnblogs.com/AsionTang/archive/2010/05/22/1741488.html

Guess you like

Origin blog.csdn.net/weixin_33701294/article/details/93270754