- for (int i = 0; i < _imagePathList.Count; i++)
- {
- string fileName = _imagePathList[i];
- ReportImageConfig config = reportImageConfigList[i];
- Image image = new Image(fileName, 5);
- image.SaveMode = ImageSaveMode.SaveAsData;
- System.Drawing.Image img = System.Drawing.Image.FromFile(fileName);
- int vScaleFactor = Convert.ToInt32(config.Height / (img.Height * TwipsPerPixel) * 100);
- int hScaleFactor = Convert.ToInt32(config.Width / (img.Width * TwipsPerPixel) * 100);
- img.Dispose();
- img = null;
- image.HorizontalScaling = hScaleFactor;
- image.VerticalScaling = vScaleFactor;
- _textControl.Images.Add(image, config.Location, ImageInsertionMode.DisplaceCompleteLines);
- //TextField textField = new TextField("赵志敬");
- //_textControl.InputPosition = new InputPosition(new System.Drawing.Point(config.Left, config.Top + (int)config.Height));
- //_textControl.TextFields.Add(textField);
- }
- class ReportImageConfig
- {
- private string _field = string.Empty;
- private int _id = 0;
- private int _left = 0;
- private int _top = 0;
- private decimal _width = 0;
- private decimal _height = 0;
- private System.Drawing.Point _location = new System.Drawing.Point();
- public ReportImageConfig(int Id, int Left, int Top, decimal Width, decimal Height)
- {
- _id = Id;
- _left = Left;
- _top = Top;
- _width = Width;
- _height = Height;
- _location.X = Left;
- _location.Y = _top;
- }
- public ReportImageConfig(string Field, int Left, int Top, decimal Width, decimal Height)
- {
- _field = Field;
- _left = Left;
- _top = Top;
- _width = Width;
- _height = Height;
- _location.X = Left;
- _location.Y = _top;
- }
- public string Field
- {
- get { return _field; }
- }
- public int Id
- {
- get { return _id; }
- }
- public int Left
- {
- get { return _left; }
- }
- public int Top
- {
- get { return _top; }
- }
- public decimal Width
- {
- get { return _width; }
- }
- public decimal Height
- {
- get { return _height; }
- }
- public System.Drawing.Point Location
- {
- get { return _location; }
- }
- }
复制代码 |