Button images - Page 2
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 2 of 2 FirstFirst 12
Results 16 to 21 of 21

Thread: Button images

  1. #16
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    198

    Re: Button images

    Hi Arjay,

    Thanks for the Zipper, It took me a while to get thinks going.... even whith your program.
    Will keep you guys updated,

    regards,

    ger

  2. #17
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    198

    Re: Button images

    Hi all,

    So far everything is working.
    Still one minor detail.
    the Pictures I use have round edges, and they do not cover the whole button.
    So when the mouse pointer enters the button area the picture changes.
    But the backcolor changes also, giving very annoying results.

    So my quest, How do I turn of the backcolor change on mouse enter and mouse click.
    Transparent does not do the trick.

    Regards,

    gerwin

  3. #18
    Arjay's Avatar
    Arjay is offline Moderator / MS MVP Power Poster
    Join Date
    Aug 2004
    Posts
    10,965

    Re: Button images

    Quote Originally Posted by TBBW View Post
    So my quest, How do I turn of the backcolor change on mouse enter and mouse click.
    Transparent does not do the trick.
    Do the button images have transparent corners?

  4. #19
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    198

    Re: Button images

    Yep, the corners are transparent and I use Zoom to place the image on the button.

    regards.

  5. #20
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    198

    Re: Button images

    Hi all,

    To make life easier I changed the button control to a picturebox.
    Does the same for me as I use three pictures for all the events.
    To give you an idea, a dark picture when the 'button' is idle.
    a light picture when the mouse is over the 'button'
    and the flash picture when the button is clicked.

    I'm using the code which was posted in the beginning of this thread.

    But now I encounter the following situation;

    Code:
    private void pictureBox1_Click(object sender, EventArgs e)
            {
                FlashPicture = (PictureBox)sender;
                Thread FlashThePictureThread = new Thread(FlashThePicture);
                FlashThePictureThread.Start();
            }
    
    void FlashThePicture()
            {
                BeginInvoke(new MethodInvoker(Performflash));
                Thread.Sleep(250);
                BeginInvoke(new MethodInvoker(Performflash));
                Thread.Sleep(250);
            }
    
    void Performflash()
            {
                if ((FlashPicture.BackgroundImage == ImageB1) || (FlashPicture.BackgroundImage == ImageC1))
                    FlashPicture.BackgroundImage = ImageA1;
                else
                    FlashPicture.BackgroundImage = ImageB1;
            }
    This gives the flash only, for the rest it does not do anything.

    What I like is the following:
    Code:
    private void pictureBox1_Click(object sender, EventArgs e)
            {
                FlashPicture = (PictureBox)sender;
                Thread FlashThePictureThread = new Thread(FlashThePicture);
                FlashThePictureThread.Start();
                
                this.Hide();
    
                COD1 cod1 = new COD1();
                cod1.ShowDialog();
    
                this.Show();
    
            }
    but this does not work.
    (The next Dialog is called, the previous one is hidden, but there is no flash of the 'button')

    Where do I go wrong.

    regards,

    Gerwin

    By the way I downloaded "threading in C# from Joseph Albahari"
    Last edited by TBBW; October 26th, 2012 at 04:35 AM. Reason: editorial

  6. #21
    Join Date
    Oct 2009
    Location
    Holland
    Posts
    198

    Re: Button images

    Hi all,

    Solved all the 'problems' on the button change picture issues!!! (YES YES YES)
    Will post the complete solution in the next couple of days, will be helpfull for a lot of us.

    regards,

    Gerwin

Page 2 of 2 FirstFirst 12

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  


Azure Activities Information Page

Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center