473,406 Members | 2,956 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

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 FlowLayoutPannel. 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 7744
Hi,

Can you use a ImageButton instead?
--
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Fao, Sean" <en**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:OC**************@TK2MSFTNGP03.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 FlowLayoutPannel. 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**********@yahoo.comI-WANT-NO-SPAMwrote in message
news:OC**************@TK2MSFTNGP03.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 FlowLayoutPannel. 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 FlowLayoutPannel. 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
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...
3
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...
2
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...
1
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...
4
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...
3
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...
4
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...
5
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...
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.