My question is very general, I'm making a project and referenced two projects(graphsharp and wpfextensions). These are helping me to create graphs.
When I created my graph for example I can easily drag the vertexes or move the graph by clicking the empty space in screen etc..
But I do not know what is happening in background, for multitouch capabilities, I need to find what is going on when a mouse event raised.
Therefore my question is how to find these events and methods in a lot of source files ?
Thanks.
The question does really general and fuzzy but probably some tool like Snoop http://snoopwpf.codeplex.com/ will help you (here you can take a look how it works and looks http://blois.us/Snoop/). There is "Events" tab for selected part of UI of your application where you can investigate all the way of Event through a visual tree and see who (which control) has handled this event. Then you should check the control that handled this event and see if it's something you are looking for.
Related
I have a Form object with a title bar displayed.
I need a pure managed way(P/Invoke-free, both Mono and .NET compatible, preferrably a .NET 2.0 API) to detect when the FORM itself starts being dragged, changes location and when it is dropped(not any content).
I did this in the past in Mono but I don't remember how anymore and I don't know if my solution was MS.NET-compatible...
If anyone could provide an example, three event names for me to google more details or point me to a relevant StackOverflow question, I would greatly appreciate. So far, my search has returned no relevant results...
Are you talking actual drag-drop operation here, or when the user moves the form? If it is the movement itself, you might be able to use the ResizeBegin event, which is raised when the user starts to move the form. This together with LocationChanged and ResizeEnd should cover your needs. However, the ResizeBegin and ResizeEnd events are (of course) also raised when you start and end resizing the form, not only when you are moving it.
This is a broad question, I am aware. However, I have been trying to make a modification in a C# source code to enable a ToolboxControl UI control's right hand border to respond to a mouse drag. In other words make the control size bigger by grabbing the right hand boarder and dragging it to the right. I Have not been successful. So I am thinking if I incorporate a XAML file and create the ToolboxControl in XAML, maybe I would have more control in manipulating the ToolBoxControl.
I dont know how to break up a pure C# WPF code into C# and XAML.
In a nutshell, The problem I am dealing currently is that there is already C# code developed by other developers to perform certain function. I am using the existing C# code but I believe if I move some of the UI functionality from the C# into a XAML file, I would have a better handle on adding some of the needed UI features to the original program.
So you see my problem is I am not starting from scratch. I need to use an existing C# code and break away some UI functionality of it nd put it in a new xaml file. Do you have any ideas about any place that that has been done?
I am looking for any repsonse that leads me to a conversation thread or a sample. In other words I dont know where to start from. any useful guidance is apprecaited and would be marked as an answer.
Check out this article.
At its simplest, you will need to add an invisible (or not) drag handle to the right hand border of your control, then adjust the control size during the drag events raised by that drag handle.
Here is another article showing a similar concept expanded to an entire diagramming system, which includes the resize behavior you mentioned.
You may be able to define a style for what you are trying to accomplish. I wouldn't worry too much about breaking apart the C# from the XAML as that is a nice to have but not nec
How would you get a button to look and perform similar to that of the buttons in the volume mixer on Win7?
What I mean is that in the volume mixer there are icons that doesn't look like buttons until you hover them, they also haven't got the standard blueish color when hovered.
So far I haven't found a way to do this directly in visual studio.
I'm guessing that creating a custom user control is the only way to go, but I've had no luck so far, I would appreciate some examples.
In addition, there are also combo boxes in the volume mixer I would like to duplicate. They're hidden except for the text and arrow until they're hovered.
Is there a way to accomplish this?
(Here an image that might help explain what I mean:
http://i53.tinypic.com/2ij409u.png)
For windows application, (and also how they did win7), they used the technology called WPF. I am not specifically answering how you can do this, because in WPF, this is the fundamental that defining skin (via markup called XAML) without touching the implementation code. If you are serious in learning how to do that, I suggest you look for tutorials or good book about WPF.
Here's one of the markup looks like for a button. To modify the button's look, what you need is to define it's XAML, and you don't have to inherit it in the code. The example looks scary long, but Visual Studio could help you.
You could use a third party control library, for example Krypton Toolkit, its free!
There is quite a terrific solution for this button quest. You can paste pictureBoxes on form and handle MouseUp, MouseLeft and MouseDown events. When each of them fires, you need to set specific image (one of tree, in fact) - normal picture, picture of "highlighted" icon and picture of pressed icon. But that's really a hard and useless work, so better don't.
If you need several of such "buttons" in a panel, I remember, I once managed to get the same behaviour by using toolStrip with buttons.
I know that when a drag/drop operation is completed, upon receiving a MouseUp or Esc key event, it returns an enum that indicates what happened (Move, Copy, None, etc.) My question is this: is there a way to send back status information to the form/control that initiated the drag event, while it is going on?
The use case is as follows (think Visual Studio-esque layout manager for all of this): I am writing a layout/window managing component that allows regions of the layout to be dragged around. I use a transparent form to paint a semi-transparent overlay that changes based on where the mouse is dragging over, a la the preview overlay that appears when dragging windows around in Visual Studio.
Another motivation is that the serialization process I describe is relatively resource intensive, and I'd prefer not to do it if the dragging is all going to occur within the same process/window. So, if there was a way to lazily serialize only when an actual "drop" in another window happens, that would probably make all the difference in usability.
What I want to do is enable dragging between different windows or even different instances of the application. I've already plumbed out the serialization code and everything, but the issue is that, when I drag a chunk of layout into another window, the first window doesn't have any way of knowing that the mouse is now over another instance of the application, which is more than capable of painting its own overlay. So, the original overlay hangs around like an idiot and my program looks like crap.
Is there any way for me to pass along some kind of callback or is there any message or property I can listen for/poll during a drag operation that will tell me if my mouse pointer is over a region that can accept its data? Please don't make me resort to listening for the CursorChanged event, I've already lost too much self respect using reflection to hack around weird wpf/winforms dragging interop bugs. If anyone could suggest a clean resolution for this problem I would be extremely grateful.
Additionally, if anyone could point me to any favorite sites which describe how to go about doing reeeeally funky things with drag and drop, it would be appreciated, as I've found there is quite a lack of really nitty gritty information available about dragging. Usual things like custom cursors and the like are okay, but I'm probably more interested in Win32 black arts and the like.
UPDATE:
I actually just found out about the GiveFeedback event a second ago, came back to my question, and there it was. Huge facepalm moment. However, since I've got you here, what about my second question: is there any way to lazily load the information only when it encounters a valid target? Could I somehow implement my own IDataObject or do things get marshaled righ when the mouse leaves the form? GiveFeedback provides me only with whether there's a valid target under the cursor, but doesn't let me change what data is being dragged...
ANOTHER UPDATE:
Is there any way to determine the source of a drag operation? That is, when my control receives a DragEnter message, how can I tell if the source of the drag is my own control or a foreign one? I know I can hackishly encode it by messing with the AllowedEffects property, but is there any more direct route?
Check out the GiveFeedback event (there's a nice article here) - that sounds to me to be exactly what you're after.
I have a Form object with a title bar displayed.
I need a pure managed way(P/Invoke-free, both Mono and .NET compatible, preferrably a .NET 2.0 API) to detect when the FORM itself starts being dragged, changes location and when it is dropped(not any content).
I did this in the past in Mono but I don't remember how anymore and I don't know if my solution was MS.NET-compatible...
If anyone could provide an example, three event names for me to google more details or point me to a relevant StackOverflow question, I would greatly appreciate. So far, my search has returned no relevant results...
Are you talking actual drag-drop operation here, or when the user moves the form? If it is the movement itself, you might be able to use the ResizeBegin event, which is raised when the user starts to move the form. This together with LocationChanged and ResizeEnd should cover your needs. However, the ResizeBegin and ResizeEnd events are (of course) also raised when you start and end resizing the form, not only when you are moving it.