Click here to Skip to main content
15,904,297 members
Home / Discussions / C#
   

C#

 
GeneralRe: run a method after getting a reponse it is done Pin
Anthony Mushrow9-Oct-08 10:31
professionalAnthony Mushrow9-Oct-08 10:31 
QuestionVisual Studio 2008 - Report Viewer does show on WinForm Pin
tkmarshall9-Oct-08 9:05
tkmarshall9-Oct-08 9:05 
AnswerRe: Visual Studio 2008 - Report Viewer does show on WinForm Pin
Wendelius9-Oct-08 9:44
mentorWendelius9-Oct-08 9:44 
GeneralRe: Visual Studio 2008 - Report Viewer does show on WinForm Pin
tkmarshall9-Oct-08 10:55
tkmarshall9-Oct-08 10:55 
GeneralRe: Visual Studio 2008 - Report Viewer does show on WinForm Pin
Wendelius9-Oct-08 11:00
mentorWendelius9-Oct-08 11:00 
GeneralRe: Visual Studio 2008 - Report Viewer does show on WinForm Pin
tkmarshall10-Oct-08 4:58
tkmarshall10-Oct-08 4:58 
GeneralRe: Visual Studio 2008 - Report Viewer does show on WinForm Pin
Wendelius10-Oct-08 6:38
mentorWendelius10-Oct-08 6:38 
QuestionApp.Config Encrypt section, not saving Pin
Bill Warner9-Oct-08 8:12
Bill Warner9-Oct-08 8:12 
QuestionAnonymous constructor for Dictionary Pin
ezazazel9-Oct-08 7:50
ezazazel9-Oct-08 7:50 
AnswerRe: Anonymous constructor for Dictionary Pin
Daniel Grunwald9-Oct-08 8:02
Daniel Grunwald9-Oct-08 8:02 
GeneralRe: Anonymous constructor for Dictionary Pin
ezazazel9-Oct-08 8:04
ezazazel9-Oct-08 8:04 
Questionsummation Pin
Monin D.9-Oct-08 7:11
Monin D.9-Oct-08 7:11 
AnswerRe: summation Pin
Dan Neely9-Oct-08 7:18
Dan Neely9-Oct-08 7:18 
AnswerRe: summation Pin
DaveyM699-Oct-08 7:53
professionalDaveyM699-Oct-08 7:53 
AnswerRe: summation Pin
ezazazel9-Oct-08 8:03
ezazazel9-Oct-08 8:03 
GeneralRe: summation Pin
Monin D.9-Oct-08 11:09
Monin D.9-Oct-08 11:09 
AnswerRe: summation Pin
#realJSOP9-Oct-08 8:48
professional#realJSOP9-Oct-08 8:48 
GeneralRe: summation Pin
Dan Neely9-Oct-08 9:02
Dan Neely9-Oct-08 9:02 
GeneralRe: summation Pin
Ennis Ray Lynch, Jr.9-Oct-08 10:12
Ennis Ray Lynch, Jr.9-Oct-08 10:12 
GeneralRe: summation Pin
Mark Churchill9-Oct-08 17:07
Mark Churchill9-Oct-08 17:07 
AnswerRe: summation Pin
User 66589-Oct-08 21:55
User 66589-Oct-08 21:55 
QuestionDealing with ColorPalette problem in C# forms. Pin
OCrowley9-Oct-08 6:06
OCrowley9-Oct-08 6:06 
Hello!

I'm currently fiddling around with pixel drawing on Windows Forms using VC# Express, and I'm crashing into this problem.

I want to try and set up Bitmap which is configured to 8-bit colours and make use of a ColorPalette object, but I'm having slight trouble how to set this up, as I'm quite new to C# compared to C/C++.

Here is my current code:


<< in the namespace/class: >>
Rectangle pixRect;
BitmapData pixData;
Bitmap pixBitmap;

Color[] myCols;
ColorPalette myPal;   // This is the problem.


<< in the form constructor: >>
unsafe
{
    myPal = new ColorPalette();

    pixBitmap = new Bitmap(50, 20, PixelFormat.Format8bppIndexed);

    pixBitmap.Palette = myPal;    // This line shows a warning and crashes at this line at runtime.
    myCols = myPal.Entries;
    pictureBox1.Image = pixBitmap;

    pixRect = new Rectangle(0, 0, pixBitmap.Width, pixBitmap.Height);
              
    myCols[0] = Color.FromArgb(255, 0, 255);   // Just a test, don't know if this works or not.
}


I can actually tell that "myPal" ColorPalette is no assigned, occording to a compile warning message, but there doesn't seem to be a ColorPalette constructor.

Any suggestions ?

Thanks in advance,
OCrowley.
QuestionRe: Dealing with ColorPalette problem in C# forms. Pin
led mike9-Oct-08 6:09
led mike9-Oct-08 6:09 
AnswerRe: Dealing with ColorPalette problem in C# forms. Pin
OCrowley9-Oct-08 6:25
OCrowley9-Oct-08 6:25 
GeneralRe: Dealing with ColorPalette problem in C# forms. Pin
led mike9-Oct-08 7:01
led mike9-Oct-08 7:01 

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.