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. TheNow figure can be dynamic, just display size don't know how to solve the problem.
CodePudding user response:
AnimateImageCodePudding 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.htmlCodePudding user response: