Draw image on imageButtons

Discussion in 'Questions (Windows Mobile)' started by pochero, Nov 18, 2008.

  1. pochero

    pochero Member Licensed User

    For a digital clock which may change the hour and minute manually. In the example, how can I draw a single digit on the imagebuttons? The digits are images (in the ImageList)
    I'm trying with imagelib library, but my brain says stop...
    Thank you
     
  2. Cableguy

    Cableguy Expert Licensed User

    What for?
    you don't need special libs to just show an image from an image list...

    assuming the iist is populated with 60 images(worst case cenario)
    imagine the minute to be 15..
    Imagebutton1.image = Imagelist1.item(15)
     
  3. Erel

    Erel Administrator Staff Member Licensed User

    The attached program demonstrates how to draw on an offscreen bitmap and update the ImageButton.
     

    Attached Files:

    • 1.sbp
      File size:
      935 bytes
      Views:
      48
  4. pochero

    pochero Member Licensed User

    cableguy, one half of a digit is on one imagebutton, the other half on another imagebutton, so i can't do what you say.

    Erel, the problem is that i need to write one image on two imageButtons.

    Thank you
     
  5. Erel

    Erel Administrator Staff Member Licensed User

    I've attached an old example which demonstrates how to draw part of an image.
    You will need something like that to draw the right part on the right image.
     

    Attached Files:

  6. pochero

    pochero Member Licensed User

    It was very hard for me but finally it works, thank you.
     
  7. Erel

    Erel Administrator Staff Member Licensed User

    You are always welcome to share your results. I'm sure that it will help other users as well.
     
  8. pochero

    pochero Member Licensed User

    It doesn't work well yet. I get a outofmemoryexception at the device. It seems imagelib objets doesn't free memory when they are reused.
    Also the background image of imagebuttons doesn't appear.
    There is a refresh problem in windows. At device clock works ok (except for the memory problem)

    The attached code shows my problem.

    Thank you.
     
  9. Erel

    Erel Administrator Staff Member Licensed User

    Try to use regular Image controls instead of ImageButtons.
    It should work fine with Images.
     
  10. pochero

    pochero Member Licensed User

    I need imagebuttons because in my app I can stop de clock and manually change hours and minutes by pressing the buttons (increase and decrease).
    May be I should do it whith images and capture the click events. It is more ugly but if it works....
    Thank you
     
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice