Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Mar 22nd, 2008, 5:59 PM   #1
csrocker101
Programmer
 
Join Date: Dec 2006
Posts: 50
Rep Power: 2 csrocker101 is on a distinguished road
Button click on PictureBox

I have made a program in the .NET compact framework for a windows mobile PC Pocket PC. I have 6 Bitmap images in which I have loaded into 6 picturebox's. I am wondering if it is possible to process a button click on a picturebox. I'm reading a .NET compact framework book and it says that picturebox's cannot accept button clicks and that you must use the Override OnPaint method or something. I tried doing....

private void pictureBox1_Click(object sender, EventArgs e)
        {
            if (pictureBox1.Click = true)
            {
                //do stuff
            }

but I got an error saying that "The event 'System.Windows.Forms.Control.Click' can only appear on the left hand side of += or -=". Is there a way to do this??
csrocker101 is offline   Reply With Quote
Old Mar 22nd, 2008, 6:19 PM   #2
csrocker101
Programmer
 
Join Date: Dec 2006
Posts: 50
Rep Power: 2 csrocker101 is on a distinguished road
Re: Button click on PictureBox

Sorry...I meant...if(pictureBox1.Click == true)

typoo
csrocker101 is offline   Reply With Quote
Old Mar 22nd, 2008, 11:27 PM   #3
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
Re: Button click on PictureBox

If you're using visual studio, switch to Designer and select the picture box. Press Spacebar for properties and click the small 'events' button on top (yellow thunder icon). This will give you the list of all possible events for the selected controller. find the mouseclick and double click the empty drop down on the right. This should create a method for handling the mouse click.
OpenLoop is offline   Reply With Quote
Old Mar 23rd, 2008, 1:49 PM   #4
xavier
Professional Programmer
 
xavier's Avatar
 
Join Date: Oct 2004
Location: .ro
Posts: 406
Rep Power: 5 xavier is on a distinguished road
Send a message via Yahoo to xavier
Re: Button click on PictureBox

Am I missing something ?
csharp Syntax (Toggle Plain Text)
  1. private void pictureBox1_Click(object sender, EventArgs e)
  2. {
  3. // - when you are here , a mouse click on the pictureBox has occurred
  4. // no need for the rest.
  5. if (pictureBox1.Click = true)
  6. {
  7. //do stuff
  8. }
  9. }
__________________
Don't take life too seriously, it's not permanent !
xavier is offline   Reply With Quote
Old Mar 23rd, 2008, 3:17 PM   #5
OpenLoop
Expert Programmer
 
OpenLoop's Avatar
 
Join Date: May 2005
Location: East Lansing, MI
Posts: 663
Rep Power: 4 OpenLoop is on a distinguished road
Re: Button click on PictureBox

Quote:
Originally Posted by xavier View Post
Am I missing something ?
csharp Syntax (Toggle Plain Text)
  1. private void pictureBox1_Click(object sender, EventArgs e)
  2. {
  3. // - when you are here , a mouse click on the pictureBox has occurred
  4. // no need for the rest.
  5. if (pictureBox1.Click = true)
  6. {
  7. //do stuff
  8. }
  9. }
Do you have an event assignment, something like this:
this.pictureBox1.Click += new System.EventHandler(this.pictureBox1_Click);
OpenLoop is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Vista Elements Button Alias Existing Project Development 2 Nov 9th, 2007 6:25 PM
Applet / Button problem. TCStyle Java 1 Apr 29th, 2007 12:10 PM
Button click Heba PHP 1 Mar 1st, 2006 7:08 AM
IE and dynamic button creation MegaArcon JavaScript and Client-Side Browser Scripting 5 Dec 6th, 2005 9:31 AM
Automate button click from C# bobfox C# 2 Sep 8th, 2005 10:55 AM




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:08 AM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC