Home > Net >  The label image to draw two times
The label image to draw two times

Time:10-17

I need to display a GIF dynamic figure, add in the label, but because the display size of the problem, I built a control labelEX, rewrite the following this code in on paint
Protected override void OnPaint (PaintEventArgs PE)
{
Base. The OnPaint (PE);
PE. Graphics. DrawImage (this Image, 0, 0, enclosing Width, enclosing Height);
}

But in this case, figure will show two times, but, if you don't build a new controls, only in the program to add
PE. Graphics. DrawImage (this Image, 0, 0, enclosing Width, enclosing Height);
Figure is not moved, can you tell me which a great god can guide?

I want to achieve is the label inside join GIF image, at the same time is according to the size of the label to display the image, please everybody.

CodePudding user response:

Have to do is specify the Label Background directly, without custom painting,

Custom painting GIF, need to read every frame, draw in turn

CodePudding user response:

Background can't display dynamic figure, and image can display dynamic figure, but the image as a background picture stretch. The
Now figure can be dynamic, just display size don't know how to solve the problem.

CodePudding user response:

AnimateImage

CodePudding user response:

In a kind of implementation method, I use the picturebox, then write in the picturebox,
Set the image of the picturebox to GIF images, changed sizemode to Stretch,
In custom picturebox rewrite onpaint () and add the test attributes, the code is as follows:
Protected override void OnPaint (PaintEventArgs PE)
{
Base. The OnPaint (PE);
This. The Font=new System. Drawing. The Font (26 f, "MS UI Gothic," System. Drawing. FontStyle. Bold, System. Drawing. The GraphicsUnit. Point, ((byte) (128)));
SizeF textSize=PE. Graphics. MeasureString (this Text, enclosing the Font).
PE. Graphics. DrawString (Text, enclosing the Font, Brushes, Black, (this) Width - textSize) Width)/2, (this) Height - textSize) Height)/2);
}

[Editor (" System.Com ponentModel. Design. MultilineStringEditor, System. The Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a ", typeof (System. Drawing. Design. UITypeEditor))]
[SettingsBindable (true)]
[CategoryAttribute (" "), the BrowsableAttribute (true), ReadOnlyAttribute (false)]
Public override string Text {
Set
{
The test=value;
}
The get
{
Return the test;
}
}
Writes temporarily, please pass by great god see if such expression right, don't appreciate,

CodePudding user response:

Using a picturebox in writing on the GIF, reference under http://bbs.cskin.net/thread-14927-1-1.html

CodePudding user response:




reference 5 floor desperaso reply:
use picturebox, writing on the GIF under reference http://bbs.cskin.net/thread-14927-1-1.html


The idea is pretty good, thank you

CodePudding user response:

Brother sandy_more_wang positive solutions

CodePudding user response:

Use ImageAnimator update frame, and then as drawing and pictures, think how to draw how to draw

CodePudding user response:

refer to the eighth floor assky124 response:
with ImageAnimator update frame, and then as drawing and pictures, think how to draw how to draw

I didn't try this, next time I can give it a try, thanks
  •  Tags:  
  • C#
  • Related