locked
how to check picturebox image? RRS feed

  • Question

  • Hi All,

    I need your help. I am using managed C++/CLI which is part of .NET framework, I have the picturebox and a button in my winform.

    I want to check the image through on the resources that if they are correct.

    private: System::Void button1_Click_1(System::Object^ sender, System::EventArgs^ e) {
    
           ResourceManager^ resourceManager = gcnew ResourceManager("MyApplication1.myImages", GetType()->Assembly);
           Bitmap^ image = (Bitmap^)resourceManager->GetObject ("Image1");
    
           if (PictureBox1->Image->Equals(image))
           {
             MessageBox::Show("image is correct");   
           }
         }



    When I clicked on the button while the picturebox image is Image1, the messagebox doesn't display as nothing have happened when I clicked on the button.

    Any idea?
    Monday, August 15, 2011 8:33 PM

Answers

  • Due to the method's name (button1_Click_1), I think you have duplicated methods.  This one is probably not linked to the click event, but one called button1_click is.


    MCP
    • Marked as answer by Rob Pan Wednesday, September 7, 2011 3:04 AM
    Tuesday, August 16, 2011 5:37 AM

All replies

  • Due to the method's name (button1_Click_1), I think you have duplicated methods.  This one is probably not linked to the click event, but one called button1_click is.


    MCP
    • Marked as answer by Rob Pan Wednesday, September 7, 2011 3:04 AM
    Tuesday, August 16, 2011 5:37 AM
  • Hi,

     

    Based on my knowledge, it seems that you may not add your resource to the project. So please  make sure that you have added your resource correctly.

     

    In addition, could you please send me a sample to provide more detail about your issue by email: v-jwpan@microsoft.com . So that we can find out the cause of your issue.

     

    I’m glad to receive your reply and help you.

     

    Best Regards,

    Rob


    Rob Pan [MSFT]
    MSDN Community Support | Feedback to us
    Get or Request Code Sample from Microsoft
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Thursday, August 18, 2011 3:05 AM