Forum  General Visual ...  How do I...?  PictureBox is broken, broken, broken....
Previous Previous
 
Next Next
New Post 8/23/2011 6:53 PM
Resolved
  trilogic
48 posts
No Ranking


PictureBox is broken, broken, broken.... 

Using the latest download...

I created a custom control using only the picturebox and an ImageList (all images from ~/Resources/Images.

Trying to update the image on a button click event is not working.  Here is the method that is called from the button click event code.

       public void UpdateState(LEDState value)
        {
            switch (value)
            {
                case LEDState.LEDBlack:
                    pictureBox1.Image = imageList1.Images[0];
                    label1.ForeColor = Color.White;
                    break;
                case LEDState.LEDYellow:
                    pictureBox1.Image = imageList1.Images[1];
                    label1.ForeColor = Color.Black;
                    break;
                case LEDState.LEDOrange:
                    pictureBox1.Image = imageList1.Images[2];
                    label1.ForeColor = Color.Black;
                    break;
                case LEDState.LEDRed:
                    pictureBox1.Image = imageList1.Images[3];
                    label1.ForeColor = Color.White;
                    break;
                case LEDState.LEDGreen:
                    pictureBox1.Image = imageList1.Images[4];
                    label1.ForeColor = Color.Black;
                    break;
            }
            pictureBox1.Update();   // these seem to have no effect
            this.Update(true);
        }
 

I always get the same iomage even though I can see in the debugger different enum values and images being used in the code at runtime.  I ALWAYS get the same image no matter what.

Tried with PNG's and GIF's.  This is a prototype for a bank so it would be nice to have it work.

 
New Post 8/24/2011 4:59 AM
  jayhobbs
1664 posts
1st Level Poster




Re: PictureBox is broken, broken, broken.... 

Hi

Images in VWG use the ImageResourceHandle and IconResourceHandle

Please see http://www.visualwebgui.com/Developers/KB/tabid/654/article/w_images/Default.aspx

Cheers

Jay

 

 
New Post 8/24/2011 8:20 AM
  trilogic
48 posts
No Ranking


Re: PictureBox is broken, broken, broken.... 

Actually,

I'm using the ImageList control within my UserControl and assigning images from the ImageList directly to the PictureBox comtol .Image property.  I tried this using the method above and I also tried using the .ToImage() methof of the image from the ImageList - the latter yeilds no images at all - not even errors.

I'm also attempting to change the ForegroundColor on a label within the UserControl at the same time.  And while in the debugger I can see the color values on the label and the color being assigned to it - nothing happens in the browser.  In the same manner I can see the Image property of the PictureBox control and the image being assigned to it before and after within the debugger.  While the Image value in the debugger changes appropriately there is nothing happening on the browser.

 
New Post 8/24/2011 8:41 AM
  JamesC
634 posts
www.redcastle.co.uk
1st Level Poster




Re: PictureBox is broken, broken, broken.... 

Hi there - what version are you using?

I'm using the latest beta release "d" and the following code works just fine:

private void button0_Click(object sender, EventArgs e)
{
 pictureBox1.Image = imageList1.Images[0];
 pictureBox2.Image = imageList2.Images[0];
}

private void button1_Click(object sender, EventArgs e)
{
 pictureBox1.Image = imageList1.Images[1];
 pictureBox2.Image = imageList2.Images[1];
}

private void button2_Click(object sender, EventArgs e)
{
 pictureBox1.Image = imageList1.Images[2];
 pictureBox2.Image = imageList2.Images[2];
}

two picture boxes, two image lists (one with images in the icons folder one with images in the images folder)

 
New Post 8/24/2011 8:53 AM
  trilogic
48 posts
No Ranking


Re: PictureBox is broken, broken, broken.... 

I'm using 6.4.0 Release for  .NET 4.0 under Visual Studio 2010.  I've seen the PictureBox update too - when it is on the main form.

My PictureBox and Label are within a User control and the User Control is on the main form.

 
Previous Previous
 
Next Next
  Forum  General Visual ...  How do I...?  PictureBox is broken, broken, broken....
Azure banner
.NET Web, Cloud and Mobile application delivery platform | Sitemap | Terms of Use | Privacy Statement | Copyright © 2005-2011 Visual WebGui®       Visual WebGui weblog on ASP.NET Visual WebGui Group on LinkedIn Visual WebGui updates on Twitter Visual WebGui Page on Facebook Visual WebGui YouTube Channel Visual WebGui Platform News RSS