|
Off the top of my head I do not know of any events like DataRowBound for the WinForms DataGridView.
However, if you were to tell us what it is that you are trying to do, someone might be able to suggest a methodology.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
For example;
a cell value is 0 or 1 (its coming database)
If the value is "0" grid should be write "yes" (it doesnt see 0)
If the value is "1" grid should be write "no" (it doesnt see 1)
I hope i was explained it.
Thanks.
|
|
|
|
|
If I was doing that I would handle the CellFormatting event, as you mentioned in your original post.
Sorry not to be able to offer better assistance but perhaps someone else will.
Good luck!
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
If I was doing that I would do it in the datasource and not the data grid. You are not changing the formatting but the content of the cell (I know you don't like the event but it is the one most of us use).
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Pls is it possible to use ip cams in windows apps.
if yes how do i do it.
thanks
|
|
|
|
|
|
|
Oh come on!!! How could that get downvoted!! It's "We Built this City on Rock and Roll" complete with the Builder pattern lol
Thank you. I'm here all week hehehe
"I need build Skynet. Plz send code"
|
|
|
|
|
Because it's retarded.
.45 ACP - because shooting twice is just silly ----- "Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "The staggering layers of obscenity in your statement make it a work of art on so many levels." - J. Jystad, 2001
|
|
|
|
|
It won't compile. You have syntax errors in CityBuilder (and no, I didn't downvote you - I got the joke).
"WPF has many lovers. It's a veritable porn star!" - Josh Smith As Braveheart once said, "You can take our freedom but you'll never take our Hobnobs!" - Martin Hughes.
My blog | My articles | MoXAML PowerToys | Onyx
|
|
|
|
|
...something must have happened when I posted that lost the CityBuilder implementation
"I need build Skynet. Plz send code"
|
|
|
|
|
I also didn't univote you - but this belongs in the Lounge, not the programming questions forums.
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
lol good call.
"I need build Skynet. Plz send code"
|
|
|
|
|
Let me explain a little of what I'm trying to do....
I have a image of our first and second floor of the build that has each office / cubical shown. Due to this being an inventory application I want to know what is in each one of those. What I am trying to do is when you hover a room with your mouse it highlights it and displays a panel to the right of your cursor showing a list of assets located in that room.
I got a feeling I should be doing this with WPF, but I know nothing about WPF.
My first version I created a panel for each room/cubical and it just displayed the room number.
Is there a way to draw sort of hot spots on a windows form picture box instead of doing panels? I'm wondering if there is a better way of doing this with a Windows Form application
|
|
|
|
|
One way to achieve the desired result does not involve 'drawing' at all.
Make use of Control.MouseHover[^]. Of course this means that you would need to have some form of collection containing the coordinates of the various rooms/asset owners to check against the mouse coords.
Henry Minute
Do not read medical books! You could die of a misprint. - Mark Twain
Girl: (staring) "Why do you need an icy cucumber?"
“I want to report a fraud. The government is lying to us all.”
Why do programmers often confuse Halloween and Christmas?
Because 31 Oct = 25 Dec.
|
|
|
|
|
Here is a technique that often works well:
- have your image, shown to the user;
- have a second image (or a 2D array) of the same size, containing nothing but an item code for each pixel; so it could hold a value of 1 or RGB(1,0,0) for all pixels belonging to room 1, etc.; this "shadow" image is not shown to the user at all.
- have an array or list of items holding the description of each room.
While the mouse hovers the real image, use its (relative) position to do a GetPixel in the shadow image at the same location, that yields the room index (or a special value for none), then fetch the room description from the array/list. You can then:
- paint a highlighted outline of the room on top of the Control that shows the floor plan;
- stuff relevant information in the tooltip.
Remarks:
1. if your image is large, you might create a shadow image at a smaller scale, say 1/4.
2. filling the shadow image can be handled by code, based on the room description; it would then need coordinates of course.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Thanks for the reply!
Ok that sounds like a great idea but I'm having a little difficult time following you. I have not worked much with graphics in that way. Would it be possible to point me to a article I could read that would help in this area?
As to your remarks, my image is large I would say. It's size is 800 x 600.
Edit:
I found an article I think: Image Processing for Dummies with C# and GDI+ Part 1 - Per Pixel Filters[^]
I'm reading it right now.. will let you know if this helps me towards your soltuion
modified on Wednesday, May 26, 2010 10:46 AM
|
|
|
|
|
I don't have a link to such thing.
As for size, it basically depends on how accurate you want your hovering response to be; if the walls are 5 pixels thick, then a scale of 1/4 would be adequate. If walls are only 2 pixels, maybe you want actual size.
BTW: the shadow image helps in mapping the mouse position to the room number; you can of course do without, simply by scanning your room list and checking for "room contains point"; the shadow image comes in handy when you have lots of different rooms (performance), or oddly shaped ones (such as corridors) that make the containment test rather tedious.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I posted above on the article I'm reading that will hopefully help with GDI..
As for performance we have rooms of different shape and sizes and there are MANY rooms lol.
|
|
|
|
|
Since he would have to create the shadow image anyway, and this is in human time rather than real time (being a response to a mouse action), I would maintain each room as a Region, and do the hit test on that - it is probably easier to read IMO!
foreach (Region r in myRooms)
{
if (r.IsVisible(pt))
{
...
}
}
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
yes, regions sound fine, it all depends on where the data is coming from; it might be hard to initialize the regions, one or a couple of rectangles per room (even overlapping ones) could be easier; see my other reply below.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
Luc Pattyn wrote: ne or a couple of rectangles per room (even overlapping ones)
Is pretty much what I was thinking - then just use Region.Union so you are only working with one object to represent a room outline. But if you do have curved walls, you can handle that as well...
Did you know:
That by counting the rings on a tree trunk, you can tell how many other trees it has slept with.
|
|
|
|
|
the main issue is you have to enter the data in the system; which may require some digitization, or manually measuring and entering the coordinates for a lot of points. Regions are fine for computers, less so for humans.
Luc Pattyn [Forum Guidelines] [Why QA sucks] [My Articles]
I only read formatted code with indentation, so please use PRE tags for code snippets.
I'm not participating in frackin' Q&A, so if you want my opinion, ask away in a real forum (or on my profile page).
|
|
|
|
|
I have actually never messed with a "Region". I'm going to have to research what it is and what it does in a few
|
|
|
|
|
Ok I think I understand how I am supposed to scan each pixel. From that article I see how I can change the color as well. Now what I am wondering is how do I actually tell the location of the pixel to what I am looking at? Basically how do I find the bounderies for each room so I can keep an array saying that "These pixels belong to room 1", "these pixels belong to room 2"?
|
|
|
|