Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Problem in Images display on dialog.

Problem in Images display on dialog.

Scheduled Pinned Locked Moved C / C++ / MFC
help
5 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    hemlat
    wrote on last edited by
    #1

    Hi, In my application I am having dialog .I am receiving images from mobile and I am displaying Images on dialog. I have added vertical scroll bar to dialog.I am creating 8 static controls programatically on dialog and I am using these 8 static controls for Image display. At a time I am displaying 8 Images on Dialog.I am using Scroll bar to display all Images. I have written following code in my "displayImage" function.for every scroll I am calling this function.

    for(int i = 0; i < 8; i++)
    {
    //To get 4 Images for each row
    if((i != 0)&&(i%4 == 0))
    {
    x1 = 1;
    x2 = 250;
    y1 = y1+355;
    y2 = y2+355;
    }

    	//Static control creation for Image
    	myStatic\[i\] = new CStatic();
    
    	myStatic\[i\]->Create(\_T(""),WS\_CHILD|WS\_VISIBLE|SS\_BITMAP,
    

    CRect(x1,y1,x2,y2),this);
    image.Load(Image);
    HBITMAP hbmp = image.Detach();
    if(hbmp == NULL)
    {
    Error = GetLastError();
    }
    if(hbmp != NULL)
    myStatic[i]->SetBitmap(hbmp);
    }

    First 8 Images are displaying Properly.After that If I scroll Scroll Bar dialog is showing first 8 Images first and It is displaying second 8 images.If I scroll third time it is showing first 16 images after that it is showing third 8 images and so on.Can anyone help me.

    _ 1 Reply Last reply
    0
    • H hemlat

      Hi, In my application I am having dialog .I am receiving images from mobile and I am displaying Images on dialog. I have added vertical scroll bar to dialog.I am creating 8 static controls programatically on dialog and I am using these 8 static controls for Image display. At a time I am displaying 8 Images on Dialog.I am using Scroll bar to display all Images. I have written following code in my "displayImage" function.for every scroll I am calling this function.

      for(int i = 0; i < 8; i++)
      {
      //To get 4 Images for each row
      if((i != 0)&&(i%4 == 0))
      {
      x1 = 1;
      x2 = 250;
      y1 = y1+355;
      y2 = y2+355;
      }

      	//Static control creation for Image
      	myStatic\[i\] = new CStatic();
      
      	myStatic\[i\]->Create(\_T(""),WS\_CHILD|WS\_VISIBLE|SS\_BITMAP,
      

      CRect(x1,y1,x2,y2),this);
      image.Load(Image);
      HBITMAP hbmp = image.Detach();
      if(hbmp == NULL)
      {
      Error = GetLastError();
      }
      if(hbmp != NULL)
      myStatic[i]->SetBitmap(hbmp);
      }

      First 8 Images are displaying Properly.After that If I scroll Scroll Bar dialog is showing first 8 Images first and It is displaying second 8 images.If I scroll third time it is showing first 16 images after that it is showing third 8 images and so on.Can anyone help me.

      _ Offline
      _ Offline
      _AnsHUMAN_
      wrote on last edited by
      #2

      Probably your data structure is not getting cleared and still holds the images that you displayed earlier. Debug to check

      You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

      H 1 Reply Last reply
      0
      • _ _AnsHUMAN_

        Probably your data structure is not getting cleared and still holds the images that you displayed earlier. Debug to check

        You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

        H Offline
        H Offline
        hemlat
        wrote on last edited by
        #3

        I am facing this issue since few days. I tried so many options but no use 1)I deleted myStatic[i] variables after using static controls. If I do that dialog is not showing any Images.here myStatic is local variable. 2) I declared member variables m_myStatic[8].No use.

        _ 1 Reply Last reply
        0
        • H hemlat

          I am facing this issue since few days. I tried so many options but no use 1)I deleted myStatic[i] variables after using static controls. If I do that dialog is not showing any Images.here myStatic is local variable. 2) I declared member variables m_myStatic[8].No use.

          _ Offline
          _ Offline
          _AnsHUMAN_
          wrote on last edited by
          #4

          Of course you delete the static control variables. But where and how do you store the images that later on get displayed in these static controls. My previous question was whether you clear the data from the structure and not the static controls themselves.

          You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

          H 1 Reply Last reply
          0
          • _ _AnsHUMAN_

            Of course you delete the static control variables. But where and how do you store the images that later on get displayed in these static controls. My previous question was whether you clear the data from the structure and not the static controls themselves.

            You need to google first, if you have "It's urgent please" mentioned in your question. ;-)_AnShUmAn_

            H Offline
            H Offline
            hemlat
            wrote on last edited by
            #5

            I have made static control variable array as member variable. In display Image function I am deleting static control variable array before creating new Static controls. My code is working fine.Thanks for your reply

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups