Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 989303
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T05:46:16+00:00 2026-05-16T05:46:16+00:00

There is an image for the surface, and a text is written on the

  • 0

There is an image for the surface, and a text is written on the image for 184 rows of date..
Thus, it is expected to see 184 different text written image files are generated with all the same background images. (The code is declared below…)

The problem is that the first text is written for all 184 different data.. I think I have to remove something in the loop. But what is that ??

 for (int i = 0; i < dt.Rows.Count; i++) {
            date = Convert.ToDateTime(dt.Rows[i]["PAYMENT_DATE"]);
            branchCode = Convert.ToInt32(dt.Rows[i]["BRANCH_CODE"]);
            refNum = Convert.ToInt32(dt.Rows[i]["REF_NUM"]);
            accountNumber = Convert.ToInt32(dt.Rows[i]["ACCOUNT_NUMBER"]);
            email = dt.Rows[i]["EMAIL"].ToString();
            tableCode = dt.Rows[i]["CUSTOMER_TABLE_CODE"].ToString();

            TranLogKey logKey = new TranLogKey(date, branchCode, refNum);
            TranLogEntry entry = Log.SelectLogEntry(logKey, false);
            if (Intertech.Core.Framework.Context.CurrentContext.LogEntry == null)
                Intertech.Core.Framework.Context.CurrentContext.LogEntry = entry;

            try {
                receiptText = TransactionManager.GenerateReceipt(true, logKey, null, null, accountNumber, false);
            }
            catch (Exception exp) {
                continue;
            }

            if (receiptText != null) {
                if (receiptText.IndexOf("SURETTİR\r\n") != -1)
                    receiptText = receiptText.Substring(receiptText.IndexOf("SURETTİR\r\n") + 10).Trim();

                if (receiptText.IndexOf("İşlemi Yapan") != -1)
                    receiptText = receiptText.Substring(0, receiptText.IndexOf("İşlemi Yapan"));
                if (receiptText.IndexOf("MÜŞTERİ İMZASI") != -1)
                    receiptText = receiptText.Substring(0, receiptText.IndexOf("MÜŞTERİ İMZASI"));

                Bitmap bmp = (Bitmap)Bitmap.FromFile(imageDir);
                Graphics g = Graphics.FromImage(bmp);
                SizeF size;
                Font font = new Font("Courier New", 8, FontStyle.Regular);
                byte ALPHA = 200;
                size = g.MeasureString(receiptText, font);
                Bitmap waterbmp = new Bitmap((int)size.Width, (int)size.Height);
                Graphics waterg = Graphics.FromImage(waterbmp);
                waterg.DrawString(receiptText, font, new SolidBrush(System.Drawing.Color.Black), 2, 2);
                DrawWatermark(ref waterbmp, ref bmp, LeftIndex, TopIndex, ALPHA);
                bmp.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg);

                try {


                        GoServices.Core.SendMailOutside("The Portugal Life", "info@portugal.tr.friendship.pt",
                                    "blgnklc@skype-account.com", " e-Wish " + email, "", new string[] { "dekont.jpg" }, new object[] { ms.ToArray() });

                        LogNotificationState("K", refNum, accountNumber, 2, true, null, tableCode);

                }
                catch (Exception ex) {
                    LogNotificationState("K", 0, -1, 2, false, ex, tableCode);
                }

            }



private static void DrawWatermark(ref Bitmap watermark_bm, ref Bitmap result_bm, int x, int y, byte ALPHA) {
    System.Drawing.Color clr;

    int py, px;
    for (py = 0; py <= watermark_bm.Height - 1; py++) {
        for (px = 0; px <= watermark_bm.Width - 1; px++) {
            clr = watermark_bm.GetPixel(px, py);
            if (clr.A != 0 || clr.R != 0 || clr.G != 0 || clr.B != 0)
                watermark_bm.SetPixel(px, py, System.Drawing.Color.FromArgb(ALPHA, clr.R, clr.G, clr.B));
        }
    }
    Graphics gr = Graphics.FromImage(result_bm);
    gr.DrawImage(watermark_bm, x, y);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T05:46:17+00:00Added an answer on May 16, 2026 at 5:46 am

    I would look at how you are creating the bitmap.

    Bitmap bmp = (Bitmap)Bitmap.FromFile(imageDir);

    does this line need to be in there everytime, i.e is imagedir the same all the time?

    Do you dispose of the generated bitmap after creating it?

    what happens in this function:

    DrawWatermark(ref waterbmp, ref bmp, LeftIndex, TopIndex, ALPHA);

    You seem to then save the bmp file but not dispose of it?

    I have seen some strange behaviour from GDI+ so I would start here.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

There is a data file and some image files that I have to download
Is there a good way to read RAW image files (especially Canon CR2 and
Is there any alternative image manipulation library for .net? I would prefer something that
http://biochrom.fivesite.co.uk/catalogue4.asp On the page above there is an image floated to the left. To
There are lots of non-image-based CAPTCHA ideas floating around. But what about the old-fashioned
There are some nice free image to ASCII art conversion sites like this one:
Is there a System.Drawing.Image.FromHbitmap equivalent in WPF? Also, is it possible to dispose the
Is there any way to convert a bmp image to jpg/png without losing the
Is there a way to compress a VMWare image on a ESXi server for
There might be applications that are not suited for Core Data - image manipulation

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.