Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Images are shrunken => i want to get them shrink-proof

Images are shrunken => i want to get them shrink-proof

Scheduled Pinned Locked Moved C#
graphicsdatabasehelpquestion
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • T Offline
    T Offline
    tronix01
    wrote on last edited by
    #1

    Hello @ all I have a problem with my generated PNG - Images. It's a bit strange for me but may be someone now what i can do to solve this problem. My windows service create on the fly PNG - Images and store them as binary in a database. The stored images are displayed later with a crystal report in a windows app. That works very fine since years and also with different pc's (most XP-OS), but there is a problem with a new PC (XP-OS) since a few days. All images are displayed shrunken in the reports and it's not the whole report.... only the images. Text- and Report still proportional. Could it be that something is missing at the new machine ? Any ideas how this could be ? Thanks a lot!

    Bitmap couponImg = null;
    Font font = null;
    Graphics graphic = null;

    try
    {
    couponImg = new Bitmap(coupon.Width, coupon.Height, PixelFormat.Format24bppRgb);

     using (graphic = Graphics.FromImage(couponImg)) //V1.01.03.01
          {
            graphic.Clear(coupon.BackgroundColor);
     
            graphic.InterpolationMode  = System.Drawing.Drawing2D.InterpolationMode.HighQualityBicubic;
            graphic.PixelOffsetMode    = System.Drawing.Drawing2D.PixelOffsetMode.HighQuality;
            graphic.TextRenderingHint  = System.Drawing.Text.TextRenderingHint.AntiAlias;
            graphic.TextContrast       = 0;
            graphic.CompositingQuality = System.Drawing.Drawing2D.CompositingQuality.HighQuality;
            graphic.SmoothingMode      = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
    
            if (coupon.couponCellCollection != null && coupon.couponCellCollection.Count > 0)
            {
              for (int idx = 0; idx < coupon.couponCellCollection.Count; idx++)
              {
                font = new Font(coupon.font, (float)coupon.couponCellCollection\[idx\].fFontSize, FontStyle.Bold, GraphicsUnit.Millimeter);
    
                graphic.DrawString(coupon.couponCellCollection\[idx\].sCellValue, font, Brushes.Black, new PointF(coupon.couponCellCollection\[idx\].iPosX, coupon.couponCellCollection\[idx\].iPosY));
    
                font = null;
              }
            }
            graphic.DrawImage(couponImg, new Rectangle(0, 0, coupon.Width, coupon.height), 0, 0, coupon.Width, coupon.height, GraphicsUnit.Pixel);
        
            graphic.Flush(); //V1.01.03.01
          }
    }
     }
     catch (Exception)
     {
    couponImg = null;
     }
     finally
     {
        if (graphic != null)
        {
    
    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups