Storing Picture in a GridBox

whizkid123

Freshman
Joined
Dec 11, 2002
Messages
33
Location
India
I have a picture which is to be stored on top of a grid. The grid should come on top of the picture and whenever a user click on a cell in a grid, the corresponding values(predecided or pixels) needs to be retrieved. How can it be done? Thanx!
 
You can use the methods of a Graphics object to draw a grid, and to calculate which box in the grid the user clicked on, perform an integer divide on the mouse coordinates, by the size of the grid.
 
Can you please put some code? I'm new to .Net! If we use the graphics object to draw a grid, will be picture be in the picturebox and over that do we use the graphics object or what? Please help and explain by code! Thanx a lot!
 
What exactly are you trying to accomplish? Are you wanting to place a grid of lines on top of a picture or the other way around (your first line says a picture on top of a grid)?

What are you trying to retrieve when they click? A list of ALL the pixels inside the grid cell? As an array or what...?

-ner
 
Well it can be either ways. Whichever is possible. But placing a picture on top of a grid would be more helpful coz in that manner I can retrieve the row and column number of the particular cell that he has clicked (It's possible right?). See I'll tell you what I want. See I have a picture with me. It should be overimposed with grid lines giving seperate values for each grid. So when the click on a particular grid box, the value such as A1, B2, C4, D3 (as in excel) could be retreived and stored in database. Is it clear? Please helP!!! Thanx a lot!!
 
If you mean the size of it, sure. You'll notice at the top of the code for the form there are two constant values, one for the horizontal spacing in the grid and one for the vertical spacing. You can modify these to your own size.
 
Back
Top