private void RefreshName(Graphics g) { if (Element != null) { SizeF sizeText = g.MeasureString(Element.CN_Name, NameFont); g.DrawString(Element.CN_Name, NameFont, SystemBrushes.ControlText, (Width - sizeText.Width) / 2, NamePoxY); if (LevelImage != null) { g.DrawImage(LevelImage, new Rectangle(LevelImagePos, LevelImageSize), new Rectangle(Point.Empty, LevelImage.Size), GraphicsUnit.Pixel); } var levelStr = Element.Level.ToString(); SizeF sizeLevel = g.MeasureString(levelStr, LevelFont); g.DrawString(levelStr, LevelFont, SystemBrushes.ControlText, LevelImagePos.X + (LevelImageSize.Width - sizeLevel.Width) / 2, LevelImagePos.Y + (LevelImageSize.Height - sizeLevel.Height) / 2); } InnerPictruceBox.Invalidate(); }
private void RefreshBorder(Graphics g) { if (ElementBorder != null) { g.DrawImage(ElementBorder, new Rectangle(Point.Empty, Size), new Rectangle(Point.Empty, ElementBorder.Size), GraphicsUnit.Pixel); } InnerPictruceBox.Invalidate(); }
private void DrawSourceImage(Graphics g) { g.Clear(Color.FromArgb(0, 0, 0, 0)); if (SourceImage != null) { g.DrawImage(SourceImage, new Rectangle(SourceImagePos, SourceImageSize), new Rectangle(Point.Empty, SourceImage.Size), GraphicsUnit.Pixel); } InnerPictruceBox.Invalidate(); }