Click here to Skip to main content
15,894,324 members
Home / Discussions / C#
   

C#

 
QuestionRe: calling image Pin
jojoba201024-Jan-10 23:21
jojoba201024-Jan-10 23:21 
AnswerRe: calling image Pin
sanforjackass24-Jan-10 23:31
sanforjackass24-Jan-10 23:31 
QuestionRe: calling image Pin
jojoba201024-Jan-10 23:36
jojoba201024-Jan-10 23:36 
AnswerRe: calling image Pin
sanforjackass25-Jan-10 0:29
sanforjackass25-Jan-10 0:29 
QuestionWinservice installer issue Pin
Priya Prk24-Jan-10 22:11
Priya Prk24-Jan-10 22:11 
AnswerRe: Winservice installer issue Pin
#realJSOP25-Jan-10 0:01
mve#realJSOP25-Jan-10 0:01 
GeneralRe: Winservice installer issue Pin
Priya Prk25-Jan-10 0:05
Priya Prk25-Jan-10 0:05 
QuestionCursor change in WinForms - A generic error occurred in GDI + [modified] Pin
arturw8224-Jan-10 22:04
arturw8224-Jan-10 22:04 
For windows I change the color of the cursor depending on what background color is now.

Code below. Unfortunately, from time to time (too often) gets an exception:


System.Runtime.InteropServices.ExternalException: A generic error occurred in GDI +
At System.Drawing.Bitmap.GetHicon ()

and the end of the program.

A year ago I wrote an earlier version, a mechanism to change the cursor the same, the same code, but then I used VisualStudio 2005, at 32bit Vista. And never once I had such an exception.

vs2008 and now the win7 x64.

I don't checked yet whether to build VS2005 help ...

However, it may be any known explanation and a solution to this problem.



I use IntPtr as a handle to the icon, and 64 bit systems, it is 64 bit and 32-bit Win 32 .. but not further Jazee what the problem ...

Shows the error both on and win764 win xp32 ...


private void changeCursor(int type)
        {
            int _cursorSizePx = Convert.ToInt32(((200.0 * _cursorSize) / _calibration));//px

            Bitmap b = new Bitmap(_cursorSizePx + 1, _cursorSizePx + 1);
            Graphics g = Graphics.FromImage(b);
            g.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.HighQuality;
        
//draw something
            switch (type)
            {
                case 0:

                    g.FillEllipse(new SolidBrush(_cursorColor), 0, 0, _cursorSizePx, _cursorSizePx);
                    break;
                case 1:
                    g.DrawEllipse(new Pen(new SolidBrush(_figureColor), 3), 1, 1, _cursorSizePx - 3, _cursorSizePx - 3);
                    g.FillEllipse(new SolidBrush(_sqreenColor), 1, 1, _cursorSizePx - 3, _cursorSizePx - 3);
                    break;
            }
                IntPtr ptr = b.GetHicon();  //  <----------------- GDI+ error 
                Cursor c = new Cursor(ptr);


// assign the cursor to the form
                this.Cursor = c;
        }


modified on Monday, January 25, 2010 4:21 AM

QuestionHow would I go about adding an escape to a predefined string value ? Pin
tonyonlinux24-Jan-10 21:15
tonyonlinux24-Jan-10 21:15 
AnswerRe: How would I go about adding an escape to a predefined string value ? Pin
OriginalGriff24-Jan-10 21:37
mveOriginalGriff24-Jan-10 21:37 
AnswerRe: How would I go about adding an escape to a predefined string value ? Pin
Luc Pattyn24-Jan-10 22:11
sitebuilderLuc Pattyn24-Jan-10 22:11 
Questionmodified date Pin
Member 59031024-Jan-10 18:42
Member 59031024-Jan-10 18:42 
AnswerRe: modified date Pin
_Achilles_24-Jan-10 19:01
_Achilles_24-Jan-10 19:01 
AnswerRe: modified date Pin
Mycroft Holmes24-Jan-10 20:02
professionalMycroft Holmes24-Jan-10 20:02 
AnswerRe: modified date Pin
PIEBALDconsult25-Jan-10 4:25
mvePIEBALDconsult25-Jan-10 4:25 
QuestionC# tooltip [modified] Pin
jojoba201024-Jan-10 18:19
jojoba201024-Jan-10 18:19 
AnswerRe: C# tooltip Pin
sanforjackass24-Jan-10 19:04
sanforjackass24-Jan-10 19:04 
QuestionRe: C# tooltip Pin
jojoba201024-Jan-10 19:09
jojoba201024-Jan-10 19:09 
AnswerRe: C# tooltip Pin
sanforjackass24-Jan-10 19:13
sanforjackass24-Jan-10 19:13 
QuestionRe: C# tooltip Pin
jojoba201024-Jan-10 19:14
jojoba201024-Jan-10 19:14 
AnswerRe: C# tooltip Pin
sanforjackass24-Jan-10 19:24
sanforjackass24-Jan-10 19:24 
QuestionRe: C# tooltip Pin
jojoba201024-Jan-10 19:50
jojoba201024-Jan-10 19:50 
AnswerRe: C# tooltip Pin
Mycroft Holmes24-Jan-10 19:54
professionalMycroft Holmes24-Jan-10 19:54 
AnswerRe: C# tooltip Pin
sanforjackass24-Jan-10 20:01
sanforjackass24-Jan-10 20:01 
GeneralRe: C# tooltip Pin
Mycroft Holmes24-Jan-10 19:50
professionalMycroft Holmes24-Jan-10 19:50 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.