private void DrawCard(MNPageContext context, Rectangle rect, MNReferencedImage image) { Size imgSize = SMGraphics.GetMaximumSize(rect, image.ImageData.Size); context.g.DrawImage(image.ImageData, rect.X + rect.Width / 2 - imgSize.Width / 2, rect.Y + rect.Height / 2 - imgSize.Height / 2, imgSize.Width, imgSize.Height); }
public override void Paint(MNPageContext context) { Rectangle bounds = Area.GetBounds(context); Rectangle textBounds = bounds; Pen currentPen; // background image is drawn centered if (BackgroundImage != null) { BackgroundImageRect = new Rectangle(textBounds.Location, SMGraphics.GetMaximumSize(textBounds, BackgroundImage.ImageData.Size)); BackgroundImageRect.Offset((textBounds.Width - BackgroundImageRect.Width) / 2, (textBounds.Height - BackgroundImageRect.Height) / 2); context.g.DrawImage(BackgroundImage.ImageData, BackgroundImageRect); } /*context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 48, 16, 16); * context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 32, 16, 16); * context.g.DrawRectangle(Pens.Gray, textBounds.Right - 16, textBounds.Bottom - 16, 16, 16);*/ context.g.DrawRectangle(Pens.Black, textBounds); if (!context.drawSelectionMarks) { foreach (DrawPoints dp in drawPoints) { currentPen = SMGraphics.GetPen(dp.penColor, dp.penWidth); context.g.DrawLines(currentPen, dp.pts); } if (tempPoints.pts.Count > 1) { currentPen = SMGraphics.GetPen(tempPoints.penColor, tempPoints.penWidth); context.g.DrawLines(currentPen, tempPoints.pts.ToArray <Point>()); } } // draw selection marks base.Paint(context); }