does anyone know how to do this? I presume it uses some sort of event handler but i wondered if anyone could set me on my path?
Also, how does one show that yellow textbox which sometimes appears when you hover over processional software and it gives some information about what to fill in the textfield, thats perferably how i wish to show the coordinates? I dont know the name of what its called.
In IE 8, if you hover over the name of a tab, it comes up.
Thank you in advance
Evets actually are not the way to go here. You want to show picture coordinates, pixel_accuracy. Mouse events are actually not accurate enough to do that. You will want to poll the mouses position on a timer and when you detect it hovering over your picture, tranlate the mouse position to pixel coordinates.
The yellow popup is called a ToolTip; search for C# ToolTips and I'm sure you'll find plenty. As for the hover, could you explain your intent better? It sounds like you may end up reinventing the wheel
If this is a webpage, Use javascript(/Jquery) to get the mouse co-ordinates and show them in a box. It would be much much easier, and dare I say it, really the only way to do it.
ASP.net isn't so much about client side interaction as you may be thinking along the lines of.
Related
It is ugly but I can't find a better place to put Move-up and Down buttons.
What is your suggestion?
I would say remove them and make it drag and droppable :) Of course that isn't as intuitive to the user, but maybe you could have a label that says you can drag them to move them.
Position of buttons are right.
For a more eye catching UI use up arrow and down arrow from Webdings/Wingdings font.
BTW this quesion is more suited for here.(https://ux.stackexchange.com/)
Just remove them, they are superfluous. The user can already directly click the item, can use the up/down arrow keys and has a scrollbar. That's enough.
Not only is it unnecessary, it is actually inferior. Because the key won't repeat unless the user hammers the mouse button on it and it steals away the focus from the list. There are workarounds for those problems but that's just code you shouldn't write in the first place.
I think you can remove text (move up, move down) - arrows are intuitive for people. Also consider how Microsoft implemented same feature in Edit columns dialog for grid:
BTW the best option IMO is drag-and-drop rows (no buttons at all). But you should somehow provide to users information (cursor, border, tooltip), that it is possible..
I need to load an image in a WPF window, an be able to read and modify individual pixels (in an efficient way), zoom the image (and scroll it), get the value RGB/grayscale of the pixel under the cursor, select areas (I guess knowing the cursor position and being able to modify pixels I could draw myself the square which represents the selected area)...
What is the best combination of WPF controls and classes to accomplish this?
I've been trying to do it loading a System.Windows.Media.Imaging.BitmapImage and putting it into a System.Windows.Controls.Image, but it's taking much longer than I expected.
Thank you very much
I once used this WPF Interactive Image Cropping Control. Go check it out, it should at the very least give you a good place to start. Oh, and welcome to Stackoverflow. :)
currently I am using a tool tip to display information when it hovers over a region on a winform. This works well and I don't have any complaints, but the boss want's to display more complex data, that would best be displayed in a grid rather than text.
Is there a way that perhaps I could embed a usercontrol or a datagridview in a tool tip.
thanks
C#, .Net 2.0, windows.Forms
There's such a thing as an owner-drawn tooltip. You'd have to handle the painting of the grid yourself. You wouldn't get any interactivity, although a tooltip that lets you click and scroll sounds odd anyway.
If your boss is willing to spend money on this then I can happily recommend the DevExpress tooltip control, for its customisability.
You can write a custom control (shouldn't be too hard, just a yellow rectangle with a drop shadow) with a data grid on it. It just needs to fade out when the mouse moves away and get displayed after the mouse rests on it for a couple of seconds.
I have a control which the user can resize with the mouse. When they move the right side, I just change the width, and everything works fine.
However, when they move the left size, I have to change the Left and Width properties. The right hand side of the control visibly twitches, showing the old width in the new position.
It still twitches if I set both left and width at once using Bounds; whether or not I use SetStyle with any of UserPaint, Opaque, OptimizedDoubleBuffer, AllPaintingInWmPaint or ResizeRedraw; and whether or not it's double buffered. It still twitches if I call SuspendLayout()/ResumeLayout() on either the control or its parent.
How do I stop controls from twitching when I change their left positions and their widths?
You might want to try calling Control.SuspendLayout() on the containing form before moving / resizing, then Control.ResumeLayout().
It sounds like no matter what mode you set the control to, some event that fires when you change the bounds is redrawing it before both values are set. It may have something to do with the form.
EDIT: I saw this similar question on SO, you mentioned you had already used SetStyle(), but maybe there is some combination of options you can choose that will give you the desired effect.
Hope that helps!
Could this help?
http://richardsbraindump.blogspot.com/2007/09/how-to-create-flicker-free.html
I dont know if you used SetStyle with those parameters.
If this isnt helping, Ill delete the answer othervise Ill add the code snippet from the url.
Instead of doing a live resize, maybe showing a sizer/ghost rectangle would work better. Then when the user mouses up, resize the control once.
Here's an article explaining a Win32/C++ method.
http://www.dotnetheaven.com/Uploadfile/amitnabarro/resize_rt04082005085351AM/resize_rt.aspx
You might be able to use the control container's Graphics object to draw a bounding rectangle without a flicker.
Ok, I have googled, but maybe I put my search in weirdly. :/
I have a VB.NET WinForms application. I have the anchor properties set for all the controls so that it will resize all the controls to look decent when the form is maximized. (Haven't gotten around to manual resizing yet however).
Anyway, the problem:
I go to set the same properties for a button (testing with a single button for now) on the main GUI form/picture. When I go to run the program via F5, it looks decent. But when I maximize the form, the entire button covers up more than it should.
I've taken screenshots of the form so you can see a visual of what I'm talking about. :/
Before: http://zack.scudstorm.com/before.png
After: http://zack.scudstorm.com/after.png
What other propert(y|ies) do I need to set for the buttons to show up correctly? :/ (The buttons go over the boxes that say, for example, "1-1", "2-3", etc.
Thanks,
-Zack
Seems like you have anchored top-left and bottom-right when what you want is just top-left.
Edit: If it's just an image that does not change when the winform changes, then don't anchor your buttons at all. Just put them where they go. If you are scaling the image, then I would either detect the clicks on the image and do the scaling math or do the scaling math and set my buttons in code in the Form.OnResize event.
As it appears that your goal is just to be able to handle clicks on the "computers"...
One option that can be useful for this sort of task is to create an "overlay" bitmap (not displayed, but which is the exact same size as your source bitmap) which uses different colors to represent all the clickable regions. (e.g. (R=0,G=0,B=0) for computer 0, (0,0,1) for computer 1, etc)
You could even generate this bitmap somewhat automatically without too much trouble (If you have a mode where you can click the top left and then bottom right corners of the image to define a new region)
When the mouse is clicked, you can check the pixel at the scaled coordinates of the mouse position in the overlay and determine what their click corresponds to. This can be a lot easier than creating loads of controls, and makes it a lot easier to have clickable regions that aren't rectangular.