Click here to Skip to main content
15,897,187 members
Home / Discussions / C#
   

C#

 
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 
AnswerRe: Dealing with ColorPalette problem in C# forms. [modified] Pin
Mark Salsbery9-Oct-08 6:45
Mark Salsbery9-Oct-08 6:45 
AnswerRe: Dealing with ColorPalette problem in C# forms. Pin
OCrowley29-Feb-12 2:46
OCrowley29-Feb-12 2:46 
QuestionHow to make excel compatibile in different machine? Pin
DJ2459-Oct-08 5:18
DJ2459-Oct-08 5:18 
AnswerRe: How to make excel compatibile in different machine? Pin
Giorgi Dalakishvili9-Oct-08 5:42
mentorGiorgi Dalakishvili9-Oct-08 5:42 
QuestionHow to work with Shortcut & Keyboard Pin
Laji599-Oct-08 4:35
Laji599-Oct-08 4:35 
QuestionRe: How to work with Shortcut & Keyboard Pin
led mike9-Oct-08 4:40
led mike9-Oct-08 4:40 
AnswerRe: How to work with Shortcut & Keyboard Pin
Pedram Behroozi9-Oct-08 4:43
Pedram Behroozi9-Oct-08 4:43 
GeneralRe: How to work with Shortcut & Keyboard Pin
Laji599-Oct-08 5:38
Laji599-Oct-08 5:38 
GeneralRe: How to work with Shortcut & Keyboard Pin
DaveyM699-Oct-08 8:53
professionalDaveyM699-Oct-08 8:53 
GeneralRe: How to work with Shortcut & Keyboard Pin
Pedram Behroozi9-Oct-08 22:38
Pedram Behroozi9-Oct-08 22:38 
QuestionCOM Interface Question Pin
MSBassSinger9-Oct-08 4:30
professionalMSBassSinger9-Oct-08 4:30 
AnswerRe: COM Interface Question Pin
led mike9-Oct-08 4:38
led mike9-Oct-08 4:38 
QuestionRe: VB6 COM Interface Question Pin
MSBassSinger9-Oct-08 6:17
professionalMSBassSinger9-Oct-08 6:17 
RantRe: VB6 COM Interface Question Pin
Paul Conrad9-Oct-08 7:08
professionalPaul Conrad9-Oct-08 7:08 

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.