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#
  4. Mouse Over Event (C Sharp)

Mouse Over Event (C Sharp)

Scheduled Pinned Locked Moved C#
csharpquestion
5 Posts 3 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.
  • M Offline
    M Offline
    misCafe
    wrote on last edited by
    #1

    Dear, I have one panel and set its BackgroundImage as Image1. When I use mouse over the panel, I want to see panel changes to Image2 and when I move mouse away from the panel, it shows the defualt image (Image1). What I am going to do? Thanks, Visoth

    T 1 Reply Last reply
    0
    • M misCafe

      Dear, I have one panel and set its BackgroundImage as Image1. When I use mouse over the panel, I want to see panel changes to Image2 and when I move mouse away from the panel, it shows the defualt image (Image1). What I am going to do? Thanks, Visoth

      T Offline
      T Offline
      TannerB
      wrote on last edited by
      #2

      private void panel1_MouseEnter(object sender, EventArgs e)
      {
      panel1.BackgroundImage = ...
      }

      private void panel1_MouseLeave(object sender, EventArgs e)
      {
      panel1.BackgroundImage = ...
      {

      A simple google search would of gave you the answer to this.

      M 1 Reply Last reply
      0
      • T TannerB

        private void panel1_MouseEnter(object sender, EventArgs e)
        {
        panel1.BackgroundImage = ...
        }

        private void panel1_MouseLeave(object sender, EventArgs e)
        {
        panel1.BackgroundImage = ...
        {

        A simple google search would of gave you the answer to this.

        M Offline
        M Offline
        misCafe
        wrote on last edited by
        #3

        Firstly, I would like to thanks for your respond. When I mouse enter, it changes the backgroupimage but not the same image that I want it to show. The second thing is when i leave mouse away, it still catch the image that i use mouse enter. Please see my code below: private void panel5_MouseEnter(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Selected.bmp"]; } private void panel5_MouseLeave(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Unselected.bmp"]; } Thanks

        1 1 Reply Last reply
        0
        • M misCafe

          Firstly, I would like to thanks for your respond. When I mouse enter, it changes the backgroupimage but not the same image that I want it to show. The second thing is when i leave mouse away, it still catch the image that i use mouse enter. Please see my code below: private void panel5_MouseEnter(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Selected.bmp"]; } private void panel5_MouseLeave(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Unselected.bmp"]; } Thanks

          1 Offline
          1 Offline
          12Code
          wrote on last edited by
          #4

          misCafe wrote:

          private void panel5_MouseEnter(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Selected.bmp"]; } private void panel5_MouseLeave(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Unselected.bmp"]; }

          This code should work according what you want. Double check the image list, and other code might affect the changes.

          ;)*12Code

          M 1 Reply Last reply
          0
          • 1 12Code

            misCafe wrote:

            private void panel5_MouseEnter(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Selected.bmp"]; } private void panel5_MouseLeave(object sender, EventArgs e) { this.panel5.BackgroundImage = imageList1.Images["Selection Bar Unselected.bmp"]; }

            This code should work according what you want. Double check the image list, and other code might affect the changes.

            ;)*12Code

            M Offline
            M Offline
            misCafe
            wrote on last edited by
            #5

            Alright, I'll double check it again. Thanks so much bro! Visoth

            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