473,660 Members | 2,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Selecting a PictureBox

I'm working on a Windows application (VS 2005) that I will need to be
able to select images I've added to a FlowLayoutPanne l. I was
attempting to select the various PictureBoxes and noticed that it wasn't
working. Reading through the MSDN to find out why, I ran across the
following:

"The PictureBox is not a selectable control, which means that it cannot
receive input focus."

This obviously puts a damper on the project. Is there any workaround or
alternative image controls that can be selected?

Thank you in advance,

--
Sean
Sep 7 '06 #1
5 7781
Hi,

Can you use a ImageButton instead?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Fao, Sean" <en**********@y ahoo.comI-WANT-NO-SPAMwrote in message
news:OC******** ******@TK2MSFTN GP03.phx.gbl...
I'm working on a Windows application (VS 2005) that I will need to be able
to select images I've added to a FlowLayoutPanne l. I was attempting to
select the various PictureBoxes and noticed that it wasn't working.
Reading through the MSDN to find out why, I ran across the following:

"The PictureBox is not a selectable control, which means that it cannot
receive input focus."

This obviously puts a damper on the project. Is there any workaround or
alternative image controls that can be selected?

Thank you in advance,

--
Sean

Sep 7 '06 #2
It's somewhat of a hack, but could you place a transparent panel over
the PictureBox and wire it's focus received event to your underlying
picturebox?

Ignacio Machin ( .NET/ C# MVP ) wrote:
Hi,

Can you use a ImageButton instead?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Fao, Sean" <en**********@y ahoo.comI-WANT-NO-SPAMwrote in message
news:OC******** ******@TK2MSFTN GP03.phx.gbl...
I'm working on a Windows application (VS 2005) that I will need to be able
to select images I've added to a FlowLayoutPanne l. I was attempting to
select the various PictureBoxes and noticed that it wasn't working.
Reading through the MSDN to find out why, I ran across the following:

"The PictureBox is not a selectable control, which means that it cannot
receive input focus."

This obviously puts a damper on the project. Is there any workaround or
alternative image controls that can be selected?

Thank you in advance,

--
Sean
Sep 7 '06 #3

Fao, Sean wrote:
I'm working on a Windows application (VS 2005) that I will need to be
able to select images I've added to a FlowLayoutPanne l. I was
attempting to select the various PictureBoxes and noticed that it wasn't
working. Reading through the MSDN to find out why, I ran across the
following:

"The PictureBox is not a selectable control, which means that it cannot
receive input focus."

This obviously puts a damper on the project. Is there any workaround or
alternative image controls that can be selected?
In .NET 1.1 I wrote my own image gallery control that allows the user
to select images. Although the PictureBox can't be selected as such, it
can receive Click and DoubleClick events, and I just redraw the picture
with a colour wash to indicate that it is the currently selected
picture. In fact, I use two colours: one for "selected" and one for
"checked".

So... you can do it; you just have to "roll your own," as it were.

Sep 7 '06 #4
Ignacio Machin ( .NET/ C# MVP ) wrote:
Can you use a ImageButton instead?
I'm actually doing this in a Windows application, which does not have an
ImageButton control like ASP.NET does (at least not that I know of).
You did, however, give me an idea. The Windows Button control *does*
have an Image property, which, for some reason, I never thought about
looking for.

At first glance, it appears that the Image property will provide the
functionality that I require.

Thank you very much for your help,

--
Sean
Sep 7 '06 #5
Bruce Wood wrote:
In .NET 1.1 I wrote my own image gallery control that allows the user
to select images. Although the PictureBox can't be selected as such, it
can receive Click and DoubleClick events, and I just redraw the picture
with a colour wash to indicate that it is the currently selected
picture. In fact, I use two colours: one for "selected" and one for
"checked".

So... you can do it; you just have to "roll your own," as it were.
I was fighting this approach because I was convinced there must be
another way (I've often looked back on code I've written and realized
how much easier the problem actually was since I learned more). At any
rate, the Button just wasn't providing the functionality I was after, so
I ended up extending the PictureBox class to fit my intended design.

After all this fighting of the urge, you inspired me to give a try.
Turns out it took me no more than 30 minutes or so to get everything
done. I would have been further ahead if I had done this from the
beginning!

Thank you very much for the inspiration!

--
Sean
Sep 7 '06 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
3878
by: akh | last post by:
I want to use de Drag and Drop ´s event to move a picture box from a form and within a Picture Box. But I have behaviour if the MyPBox As PictureBox as the Globale varible or not Thanks for your help, Here is the code.
3
63395
by: Tom | last post by:
I have a picturebox on my VB.NET form. The picturebox size mode is set to stretched. I then load an image into that form and display it. As the user moves the mouse over the form, I want to get and display (in the status bar) the image coordinates of the mouse location. However, if I use the picturebox's MouseMove event, I am getting the coordinates of the mouse over the PICTUREBOX, not the actual image underneath that (which is stretched)....
2
6135
by: Mattbooty | last post by:
Hello, Not sure if anyone else has seen this bug, but I have a form where the entire form is covered with a picturebox. The picturebox has a mouseup event. I also have an open file dialog for loading images into the picturebox. If you double click the file you want to open in the open file dialog, it somehow interperets one of the clicks as a mouseup on the picturebox and fires the mouseup event for the picturebox. How can I get...
1
5675
by: Andrew Bullock | last post by:
Hi, I want to crop a picture in a picturebox by allowing the user to select a rectangular region like you get in software like Photoshop. Is there any prefabricated solution to creating such a selection window, or will I have to code it myself? Thanks
4
3812
by: munibe | last post by:
Hi, i have a problem about picturebox control. if you may help me, i will be so happy. i have a picturebox named pic_map, and i added a button named customer_button, my wish is to add a new small picturebox on the map_picture and the new added picturebox should have click event to get the location of it when it is clicked. i have written some code in C# but when clicking the small picturebox it just gets the location of the last added one,...
3
5361
by: kirk | last post by:
I have a form with a PictureBox control on it. The .Image property is set to a PNG file(which shows the picture of the US map) with some transparency in it. The .BackColor property is set to Transparent. This so far, works perfect. I now, would like to put another PNG image(an arrow showing positioning on the map) over the last PictureBox. The problem i'm having, the background for this second PictureBox only stays transparent when...
4
3707
by: Jim McGivney | last post by:
In C# on Form1 I genetate an array of PictureBoxes and populate each with an image as seen in the code below. Later on I want to access a specific PictureBox to change its image, but I keep getting the error "The name 'PictureBox1' does not exist in the current context" The code I use to try to access the PictureBox is "PictureBox1.Image = HoldBitMap; " where kount is an integer. I know the answer is probably in using the Controls...
5
5375
by: AWW | last post by:
XP VB 2005 running an example from help that creates a picturebox in code - the picturebox is not created. If I comment out the "Dim Box as New PictureBox" and create it in Design mode - the example works. I have tried Show, Enabled, Visible, and even BackColor. Why does a help example not work? and why does Design creation work? Thanks - I hope.
1
6494
by: leshka82 | last post by:
I have recently designed a Winform Image drag & drop utility. The approach I took was to have a Panel control serve as a destination for multiple file drop. Once the user dragged & dropped the desired files I do a check to ensure that I only process the image files (".jpg", ".png", etc), while any other files are ignored by the program. For every image file being dropped I programmatically create a PictureBox control, do proper resizing of an...
0
8341
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8851
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8751
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8539
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8630
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7360
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5650
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
1
2759
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1739
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.