move desktop icons onto windows form when drag and drop? - c#

im kind of confused, i used codes that enable you to drag and drop desktop icons/files/folders on windows forms, but how to show it inside the windows forms and the icon is still executable?

Most of the time GridControl is used to display the files.Its easy to display information about files in that way.But the best way to shows files depends on what do you want to do with the files.If you elaborate your problem then we can suggest.

Related

Problems while running C# application on a mac using mono

I have a C# WinForms application with very simple controls: Message boxes, labels, pictureboxes and textboxes. I want to be able to run this app on a Mac so I downloaded mono and ran it using the terminal.
I have 2 questions:
1.) How do I make the default process for a windows based exe application to open using the framework so I dont have to open it from the terminal every time?
2.) The controls don't appear at the right position. Most of the labels, textboxes have moved their position and the position of a button on the screen is not where it is supposed to be clicked but a little below it. The form looks perfect on Windows.
Can anyone help me figure this out?
Thanks in advance

Use a bitmap image as a main window in C# WinForm

I was creating a Windows Forms based application in C#. I want to display a custom main UI. I have a source Bitmap image for the same. But I cannot find the solution so as to how to do this in C#.
Here is my main window for the UI in which I would display the buttons and the display.
Can anyone tell me how to do this??
Thanks.
You can't do that using WinForms, you must use WPF.
Some links (there are many helpful resources, check on google for more):
WPFtutorial
Designing with Windows Presentation Foundation
Advantage of WPF app vs Winform for business apps

How to create an icon that can be dragged to explorer or skype to save/send a file?

I'm working on a tool that generates output that I'd like the user to be able to conveniently send to Skype or other running applications rather than simply saving it if required.
Back when I used Acorn's RiscPC, the recommended style of the 'Save As' feature was a small dialog with an icon that represented the file, that you could drag to a folder to save, or drag to another application to send it to that app rather than saving it.
Right now, users need to save the file, then find the file in Windows Explorer and drag it to Skype from there. Sure I could easily add a 'Show in folder' icon, but it would be much neater to simply drag it straight to Skype.
Anyone know how to do this, or if it's been done before I can have a look at?
I should emphasize, I'm not specifically talking about dragging stuff to Skype, I could look at the Skype API for that, I'm talking about simulating a drag generally, as if it were a file dragged from explorer.
If you're using WinForms, here is a CodeProject article that shows you bi-directional drag and drop to and from Explorer/your application. Look here for WPF.
Hope this helps!

I want to drag an image from a Silverlight UIElement and drop it on the users Desktop or Windows Explorer

I have a Silverlight control containing an image. I want the user to be able to drag the image out of the Silverlight application and drop it anywhere they would be able to drop an image. For example, to the Desktop or to a PowerPoint slide or Word document. Everything that I have read thus far says it cannot be done but I find that hard to believe. I'm very new to Silverlight and RIA development so any help would be much appreciated.
Below is the code sample in my WinForm Form but the drag never starts.
string[] aString = { imagePath };
DataObject data = new DataObject(DataFormats.FileDrop, aString);
data.SetData(DataFormats.StringFormat, imagePath);
DoDragDrop(data, DragDropEffects.Copy);
Well the trouble is that a drag operation in Silverlight doesn't have simple access to anything outside the browser (by design). Depending on the user's settings you even have to get explicit permission for clipboard operations and sandboxed temporary file storage. This really sounds like a task better suited to a WPF application (perhaps with web deployment?) or some other desktop application technology.
However, that being said here are some things you could try/consider:
Silverlight/Javascript/ActiveX combination hosted in Internet Explorer
Silverlight 5 "Out of Brower" & P/Invoke (I heard P/Invoke will be supported when Silverlight 5 comes out)
Silverlight connecting to a web service running on the same computer (crazy, but you didn't ask for "not crazy", you asked for possible)
I am not very familiar with drag and drop in the Win32 API so it would take a lot of research and experimentation before I could confirm that this was even possible (and I can already tell you it isn't practical).
Edit: Based on the extra information you provided about the question I suspect it is possible to do what you are attempting. First, are you using WPF or WinForms? I assume WPF but one of your comments says WinForms. I wasn't very familiar with WPF drag/drop operations, but having looked into it, I think your code is on the right path. I created a WPF application and initiated a drag during a KeyDown event. This meant that the mouse button was not necessarily pressed. If I initiated the DragDrop while the button was down it worked. If I initiated while the mouse button wasn't down, I had to push the mouse button down and the drag operation would start (this was unexpected since I assumed the mouse would have to already be down). If I pressed the mouse down outside the application, then gave the WPF app focus (ALT+Tab), then initiated the DragDrop while the mouse button was still down, it didn't work. I got a reference to the MouseDevice and checked the LeftButton property, and the state was showing as "Released" even though the button was still being held down. It seems the key here is the way drag/drop interacts with internal mouse state. You might have to find a way to set the mouse state (maybe with the UI Automation API?). At this point it should be painfully obvious that this whole thing is a hack (even though it is probably possible to get it to work somehow).
The solution we came up with was as follows. The RIA i.e. Silverlight sends a message to our Desktop application WinForms with the path of the image to drag along with the bounding rectangle in screen coordinates that we want to start the drag from. The Desktop code creates and places a Panel over the area that we want to drag from. This panel is where we use DoDragDrop to initiate the native drag when the user left clicks. Since this panel is placed outside and above the silverlight control, everything works perfect. Sandbox defeated.
I have been working on some Silverlight apps for the past few months and fully investigated your exact requirements only to find it was not possible. I believe you can drag from the file system, from Silverlight control to control, but not to the file system.
Does Silverlight 4 support drag and drop from app to desktop?
http://msdn.microsoft.com/en-us/library/dd772166%28v=vs.95%29.aspx

How to create UI similar to file replace dialog in window 7 using C# Windows Forms?

I need to create a dialog that allows user to choose between several rather complex actions. I really like the usability of the windows 7 file replace dialog and I think it would suit my needs very well. Here's a screenshot for reference:
Is it possible to use the controls that were used for windows dialog? If not, how would you recommend creating UI similar to this dialog?
Seems like this could easily be done with a window containing a few labels for the text and three custom controls - with some images for the arrows and file icons - each of which changes their background image when the user mouses over them - and fires an event the window picks up on when they are clicked. Fairly standard WinForms stuff.
Is there a particular part of the process you need some extra help with? Like, for example, the mouse over?

Categories

Resources