It seemed farily straight forward learning how to process files dropped onto a ListView control. But I can't seem to find anything about dragging files FROM the ListView control.
To complicate things, the ListView control is displaying an FTP directory. So I don't want to actually download the files until I confirm they have been dropped on a window that will accept them.
I know that it's possible to provide the actual data for a drag-and-drop operation only after the drop has taken place. But I'm having trouble finding anything about doing this from a ListView control using C# and Webforms.
Any tips?
Thanks!
The best link I've found on this issue yet is at Delay's Blog.
He starts by saying "This code [...] and is specifically targeted at scenarios where an application wants to allow the user to drag an element to a folder and create a file (or files) dynamically on the drop/paste. The standard .NET APIs for drag-and-drop don't support this scenario [...]"
Wow, that's the answer. For all the problems I have with C# and .NET, I run into yet another obstacle. He does have some code to workaround this. I'll be checking that out.
Related
I have a silverlight application with several menu buttons, each of which opens up a user control in a center "work space" area. It works fine. Now what I'd like to do is make some more user controls, compile them into a dll, and through say, a configuration file, have the silverlight app add a new menu button and make it make one of those new controls appear. The difficult part is, I'd like to be able to do this without recompiling the silverlight app. I'd like another developer to be able to make a user control that does some things, compile it into a dll, and drop it into the silverlight directory with some changes to a config file to get the main app to load it in. Is there a way I could do this?
Since noone else has replied yet:
What you want to do is reflect classes form a third-party dll at runtime. This is possibly too big a subject for SO, and all I can really recommend is looking up examples of it, and maybe the msdn section on it.
You'll also want to look up serialization and deserialization in C# and silverlight (this question might be a good start).
Sorry I can't be more help than that, but hopefully someone more experienced will weigh in with a useful article or some such.
Good luck :)
I'm working on a windows forms application that reads and displays source code files from my hard drive. I'm not sure which control would be best suited for this. Is there any library that will allow me to display the source code with colors and numbered code-lines?
EDIT: To clarify, what i'm looking for is a way to display the code with colors and line-numbers, no need for editing. The application is to be used by a teacher, allowing him to view source code files handed in by his students. The teacher doesn't have to be able to edit the files.
ScintillaNet is a WinForms control which is a .NET wrapper of the excellent Scintilla library and is quite good. Avalon which is mentioned in another answer is also very good, but it is an WPF control (of course, WPF controls can be added to WinForms forms by using ElementHost controls, but it will introduce additional complexity which may or may not be warranted).
Ok, so long story short, I was working on a .NET WEBFORMS project which was capable of creating ASPX pages through an ASPX form, which was basically a drag and drop controls page which, we could say, seemed to be a basic but functionality acceptable page/wizard/aspx-creator.
Well, now my higher-ups decided that approach is not a worthy solution and, I don't know why, they got into their heads that this, instead of this ASPX creator form, could be implemented through custom controls added to the toolbox.
So, my doubt is... is that even possible? Or better, is that a reasonable solution? I mean, the first cons I've already found is the fact It seems that it's impossible to yield CodeBehind code by the drag and drop method.
Thanks in advance!
Custom Controls
This MDSN walkthrough teaches you aboutmaking custom web controlls for asp. these would be able to appear in your tool box and could be dragged into its respective place, is this waht you are looking for?
EDIT:
Re-reading it looks like you want to be able to drag in bits of code and have certain regions prompted for edits, this CAN be done, using snippets. if you type propg or propfull and tab twice it constructs that code and tells you what bits to edit right? you can make your own snippets!
Creating custom snippets
failful msdn tutorials to the rescue once more!
It's my first post, so if I’m posting wrong or something, please let me know!
I'm developing an application in C# where I have to stream picture and sound from an IP Camera.
I have found a SDK from the manufacturer of the IP camera which should make it possible to integrate the streaming process into an application.
The IP camera is a LevelOne FCS-0010, and the SDK contains an .OCX file, an .INF file and a PDF file, which describes the different configuration parameters for the .INF file.
And here's my question: how do I use the OCX file in my application?
According to some forums, the OCX can just be drag 'n dropped into the toolbar in VS and then drag 'n dropped onto a WinForms form. This actually goes pretty well!
But then I just get a clean ActiveX object into my application, nearly just blank. Probably the OCX component needs to be configured, but how?
I guess I have to use the -INF file in some way in my application, so the OCX component could be configured. However, I really can’t figure out how.
It has to be registered first, use the vendor's recommended install procedure. Then you need to generate a AxHost wrapper for control, that allows it to be placed on a Winforms form or a WPF ElementHost.
Two ways to do that. Right-click the toolbox, Choose Items, COM tab and pick the control from the list. Which might be hard to do or not work at all if you don't know the name of the control. Second way is to run the Visual Studio Command Prompt and type aximp foo.ocx. That produces an AxFoo.Interop.dll, you can put it on the toolbox through Choose Items, Browse tab.
Not every ActiveX control is compatible with .NET, window-less controls are not supported.
Please forgive any silly words I may say. I am coming from a Actionscript3 background.
I am using "Visual C# 2010 Express".
I have a simple Form, in a WindowsForm Project, which currently holds just a Listbox. (Which I presume I will have to change to something else).
And I made myself a different display object (User Control) that is currently a Checkbox a title. (More will be added once I get over the hurdle below)
But I can't even get as far as Displaying the UserControl as a list.
I can't seem to find anywhere on the listbox to say "User this displayobject as the visual for listbox". I see tutorials saying "ItemsPanelTemplate" but I get error saying there is no such property for a Listbox.
I even tried making the Form in Design view and it is not in the list down the side of the GUI when I dragged as Listbox on screen.
Now I know how I would do this in pure Actionscript, but I dont know how to do this in Pure C#. Tutorials are not helping, as all the Microsoft site seems to try to give me is XAML (XML). and I am looking for C# code. So I have thrown in the towel and pleading for outside help.
Thank you for any help you can give.
It sounds like you want a list of items, each with a CheckBox and some descriptive text. Try using the CheckedListBox control. MSDN link.
This question also answers the question of how to do custom image drawing for each item in a ListBox. It may be helpful.
Edit after clarification:
Try embedding the UserControl in a ListView, rather than a ListBox.
References on embedding controls in ListViews:
C# listview - embedding controls
Adding button into a Listview in WinForms
You could also use a list of Panels, with each Panel hosting a UserControl.
C# List of Panels
But the real answer, as seen in the question's comments, is that Winforms doesn't have a convenient way to do this. This is a task much better suited to WPF.
You may check out freeware component Better ListView Express from ComponentOwl. It supports simple Details view without columns, two and three-state checkboxes, images and more...
They also offers full version with even more nice features like hierarchical and multi-line items.