I'm trying to learn how to modify Bitmaps programatically .
As a first attempt, I'm trying to simply create a blank bitmap, programatically change it to all red, and display it in a pictureBox.
The following code builds without error and, under "Start Without Debugging" runs without error except the blank pictureBox remains blank - no red bitmap is displayed in it. Any suggestions?
M. David Johnson
mdj@bds-soft.com
As a first attempt, I'm trying to simply create a blank bitmap, programatically change it to all red, and display it in a pictureBox.
The following code builds without error and, under "Start Without Debugging" runs without error except the blank pictureBox remains blank - no red bitmap is displayed in it. Any suggestions?
private: System::Void button1_Click (System::Object ^ sender, System::EventAr gs^ e)
{
Yes, I know it's inefficient to put the color assignments inside the loop because they never change. But, since that's where I'll eventually put color modifications coding, they make good placeholders. :-) {
Bitmap^ TempBitmap;
TempBitmap = gcnew Bitmap(33,33);
Color TempColor;
unsigned char cArg;
unsigned char cRed;
unsigned char cGreen;
unsigned char cBlue;
for (int i=0; i<33; i++)
{
pictureBox1->Image = TempBitmap;
label4->Text = "DONE";
}TempBitmap = gcnew Bitmap(33,33);
Color TempColor;
unsigned char cArg;
unsigned char cRed;
unsigned char cGreen;
unsigned char cBlue;
for (int i=0; i<33; i++)
{
for (int j=0; j<33; j++)
{
}{
cArg = 255;
cRed = 255;
cGreen = 0;
cBlue = 0;
TempColor.FromA rgb(cArg,cRed,c Green,cBlue);
TempBitmap->SetPixeli,j,Te mpColor);
}cRed = 255;
cGreen = 0;
cBlue = 0;
TempColor.FromA rgb(cArg,cRed,c Green,cBlue);
TempBitmap->SetPixeli,j,Te mpColor);
pictureBox1->Image = TempBitmap;
label4->Text = "DONE";
M. David Johnson
mdj@bds-soft.com
Comment