Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8346687
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T07:06:02+00:00 2026-06-09T07:06:02+00:00

I have a start button with a custom image I have made. I haven’t

  • 0

I have a “start” button with a custom image I have made. I haven’t messed around with this part of C#.net, but I know a bit about VB.NET.

I’ve seen people have something like public void picturebox_MouseDown() and whatnot, but none seems to work. I am trying to change the image when a mouse event is given.

MouseDown would change the image to StartButtonDown

MouseUp would change the image to StartButtonUp

MouseEnter would change the image to StartButtonHover

MouseLeave would change the image to StartButtonUp

Is there something specific I should do, I’ve google’d this for about an hour and still haven’t found anything to help me.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T07:06:07+00:00Added an answer on June 9, 2026 at 7:06 am

    Here is something I wrote which is very similar to what you require.

    using System;
    using System.Drawing;
    using System.Windows.Forms;
    
    public partial class ImageButton : PictureBox
    {
        private Image _upImage, _downImage, _hoverImage;
    
        [System.ComponentModel.Browsable(true),
         System.ComponentModel.Category("Images")]
        public Image UpImage
        {
            get { return _upImage; }
            set
            {
                if (value != null)
                {
                    _upImage = value;
                    this.Image = _upImage;
                }
            }
        }
    
        [System.ComponentModel.Browsable(true),
         System.ComponentModel.Category("Images")]
        public Image DownImage
        {
            get { return _downImage; }
            set
            {
                if (value != null)
                {
                    _downImage = value;
                }
            }
        }
    
        [System.ComponentModel.Browsable(true),
         System.ComponentModel.Category("Images")]
        public Image HoverImage
        {
            get { return _hoverImage; }
            set
            {
                if (value != null)
                {
                    _hoverImage = value;
                }
            }
        }
    
        public ImageButton()
        {
            InitializeComponent();
        }
    
        protected override void OnMouseDown(MouseEventArgs e)
        {
            if (DownImage != null)
                this.Image = DownImage;
    
            base.OnMouseDown(e);
        }
    
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (UpImage != null)
                this.Image = UpImage;
    
            base.OnMouseUp(e);
        }
    
        protected override void OnMouseEnter(EventArgs e)
        {
            if (HoverImage != null)
                this.Image = HoverImage;
    
            base.OnMouseEnter(e);
        }
    
        protected override void OnMouseLeave(EventArgs e)
        {
            if (UpImage != null)
                this.Image = UpImage;
    
            base.OnMouseLeave(e);
        }
    
    }
    

    What I have done is inherrited from the standard PictureBoxto make an ImageButton. I have three properties for the Image to display with no mouse action (UpImage), the Image to display when the MouseDown event is triggered (DownImage), and the Image to display when the mouse is hovering over the control (HoverImage).

    Note that you should add a check for the MouseUp and MouseLeave events. If I click on the image and drag the mouse away from the control, the control will go from the UpImage to the DownImage to the UpImage again because I have left the control (MouseLeave) even though my mouse is still down. You may desire that the DownImage remain displayed when the mouse leaves the control. Additionally, when the MouseUp event occurs, you should check if the mouse is still hovering over the control. If it is, you will want to display the HoverImage rather than the UpImage.

    You could also check for which mouse button is used. Maybe you only want the images to change with left button clicks, not right or middle.

    But this should get you started.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This way i have created my custom button and set the image.I have set
I have an ASP.NET MVC Page with a button called Start Live Meeting. When
I have a question this time around regarding the Android custom camera, NOT the
I have a phonegap activity which I want to start via a button press:
I have a small data collection app which has a single button to start
I have a custom button in an activity. It works fine. I hit back,
I have button and that jQuery script (to start the progress bar): <script src=../_Files/JScripts/jquery-1.3.2.js
I have a custom class declared as follows (in vb.net) <Serializable()> Public Class NumInfo
So I have made a custom UIButton and added it to the code and
Hi I have a JQuery Ui (jquery-ui-1.8.13.custom.min.js) inside a Dialog. When I start typing

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.