Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 22-09-2010, 08:03 PM   #1 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default C# Exception Problem


hello, i am designing a form with a datagridview and assigning different fonts in all the cells. the prob is ArgumentException is thrown at random times when sLang.ShowDialog(). when the form is open.

designer, code , resx file and "font folder" included:>
Free File Hosting & Video Downloads, Free File Sharing, Online Friends Network - Ziddu

(note:change the namespace)
it will require 19 or less fonts named 0.ttf, 1.ttf..........in "C:\fonts\"

if any questions abt coding pl ask. any suggestion is welcome
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 23-09-2010, 11:44 PM   #2 (permalink)
XLr8
 
arpanmukherjee1's Avatar
 
Join Date: Sep 2008
Posts: 637
Default Re: C# Exception Problem

found the problem :

Code:
public Bitmap ConvertTextToBitmap(int width, int height, string str, Font fontName)
        {
            using (Bitmap bmp = new Bitmap(width, height))
            {
                using (Graphics gfx = Graphics.FromImage((Image)bmp))
                {
                    gfx.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
                    Font font = fontName;
                    gfx.FillRectangle(Brushes.Transparent, new Rectangle(0, 0, bmp.Width, bmp.Height));
                    gfx.FillRectangle(Brushes.White, 0, 0, width, height);
                    gfx.DrawString(str, font, new SolidBrush(Color.Black), 2, 3);
                    return bmp;
                }
            }
        }
looks like the returned bitmap is corrupted all values throw exception.

didnt knew that would happen. any explanation ???????
__________________
Quote:
There are more things in heaven and earth, Horatio,
Than are dreamt of in your philosophy.
arpanmukherjee1 is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Charan
- by clmlbx

Advertisement




All times are GMT +5.5. The time now is 03:22 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2