I asked a question similar to this here:
Is there a way to show part of one form on another form?
This would work great if I could guarantee that every single person who uses this application uses the same monitor as I do.
But I'm a realist so I'll get to the nitty gritty.
If I can (which I can) identify the specific HtmlElement of the WebBrowser control document that houses what I want to create an image from, is there any way that I can create an image from that specific HtmlElement?
I've seen some stuff about IExtractImage but everything I've seen makes my head hurt a little bit. If someone could dumb that down (if that's what I'm looking for) so that I could use that, that would be super good.
To be a bit more clear what I'm hoping for is something like HtmlElement.DrawToBitmap()
Related
I want to make an application WPF C# where i can make questions and drag drop picture and then save it. And then when i hit the save button it Makes an new application. Is this impossible? Does someone have an good url i can visit about this? I can't find anything when google it.
There already exists such an application - it's called Visual Studio. :-)
Joking aside, to answer your question, yes, it is definitely possible to build such an application. There would be numerous ways of doing it, depending on specifics.
One aspect of such an application, let's call it AppBuilder, would be to generate and compile code for the target application. It could be done, for example, using Roslyn, the C# compiler accessible from C#.
Another aspect would be to allow the user to specify the questions, as you describe, and to allow the user to place images. Overall this would require something like a design surface with tools to manipulate the placement of the images and words, not unlike the WPF designer in Visual Studio.
While the user builds the application, there has to be a way of them to save their work, to be able to come back to it later. Does every Save generate and compile the target application? Probably not. So there is a need for a persistence mechanism, and a database, or structured file of some sort, to save the user's work in a form that can later be read back and the project reconstituted in memory.
Those are just the three most obvious features that such AppBuilder would need to support. Now for a reality check: it would not be simple, and depending on your specific requirements, it could get quite complicated. What about debugging the generated application? What about styling? Etc., etc.
I don't mean to discourage you, but maybe you can provide more information about what exactly you want to accomplish, and then we could discuss more.
I am working on a simple task app that uses windows forms.
WPF might be better toolwise, but I just don't want to use a technology that uses GPU acceleration just to render something transparently. I think its idiotic.
My problem is as follows: I have a main windows which contains a series of controls. At the press of a button, another form is shown (with ShowDialog) in which I can create a task. Pressing save, adds the task to the main form's listbox where all tasks are shown. Right now,all the communication is done via button click events (mostly). I would like to have something more elegant, like a communication interface between the dialogs.
EX: When I create the task, I want to automatically assign it to a project (which is probably going to be a an array containing all the tasks) and at the same time add it to the aforementioned list & have it acessible from memory. I am not sure how to achieve this, as using collections and arrays to manipulate, feels a bit impossible & overly complicated. I had seen some people suggest using delegates, data binding and interfaces. But I don't know exactly how they can be used and MSDN documentation is just impossibly difficult to read.
I think something similar to this: http://www.youtube.com/watch?v=sgMoNSNLLvg might be of use to me, but I'm not sure how to implement it. Also, thinking of saving the app settings/state into a file. I've seen XML, App.Config and whatnot. My app plans to be portable, which means that either saving its settings into the %user% app settings folder, or something similar. BTW: Not learning for an exam or something, just building an app to learn by myself. I'm actually a UI designer. ;)
I have been asked by my boss at work to look into allowing widgets on our home page that can be dragged and dropped and the setup saved for each logged in user (or maybe done by cookies so user doesn't need to be logged in).
Are there any out of the box (preferably free) libraries that can be used? If it requires server side functionality then that's got to be c#/.NET.
I can probably put something together myself but it seemed very much like it is reinventing the wheel. :)
And this is my first question just asking for a recommendation so I'm not sure if this is the right place or if I should put in more details.
An example of the kind of thing I want is http://www.google.com/ig.
And sorry if this isn't a well formed question. I wasn't sure where else or how else to ask it. :)
jQuery & jQuery-UI will do this out of the box if you use the sortable function. The "portlets" demo seems to fit your description. You'll still need to save state manually, but that shouldn't be too difficult with an event listener.
This is a good tutorial of how to build something similar to Google's IG by using ASP.NET AJAX. The source code is a bit outdated, but you can get an idea of what should be done on the client and on the server and re-use the code:
http://www.codeproject.com/KB/ajax/MakingGoogleIG.aspx
Also take a look here:
http://www.codeproject.com/KB/aspnet/drag_drop.aspx
Just wondering whether anybody has tried to hack into WPF DocumentViewer in order to make it more useful. I've spent almost a week already trying to create more powerful API for this control based on it's methods which I extract using reflection.
Everybody knows how to get selected text from document viewer via reflection but my task is more complicated. Selected text has End and Start properties which return ITextPointers. Also I have a collection of GlyphRuns extracted using this code. And now finally I want to find out which GlyphRun contains selection start.
So I want to know how to convert ITextPointers into GlyphRuns and vice versa. I understand that they do not have 1:1 relationship. This control with closed API and last week spent in Reflector doesn't let me sleep well. I hope maybe somebody tried to do it before or seen code samples and will be able to guide me through these jungles.
I would recommend that you abandon this approach. Doing lots of private reflection like this is not something you should be basing production code on, its very brittle and downright forbidden in some contexts. Frankly, you're better off finding a 3rd party control that suits your needs such as www.infragistics.com
Or if that's not an option you can probably create your own control in the amount of time you'll have to sink into getting this to work.
I know how to invoke the print dialog and do other things. My question is : what is the best practice to print a WPF page.
To invoke another page with all
margins, formatting and layout worked
out. And then call the print on that
To invoke a user control with all
margins, formatting and layout worked
out. And then call the print on that
To invoke a window with all
margins, formatting and layout worked
out. And then call the print on that
Or any other preferred way of
doing this.
Please let me know how you approach printing ?
In WPF you have many options to print. The question which one is best suited dependes IMO extremely on the content to be printed and the desired quality.
Printing visual
If ouy want to print something that looks exactly like the representation in the UI, then you could try printing directly the visual that builds the root-content of your print-content. If you have positioning problems and have to correct properties of this visual, I would recommend to created a memory-copy of it, transform the copy and then print out this copy. Printing out visuals has IMO many drawbacks. I seldom use it except for short hacks and mini-tools. If I use, I mostly have to create the mentioned invisible copy and print out this. If you go this way, take care that you have to call Measure and Arrange from code.
Printing FlowDocument
Another possiblity is to print out a FlowDocument. If you have something that fits into FlowDocuments, I find this an easy way to create nice content to print out. Mostly if you have some simple reports, list ith some images, this way is a nice way. The print-quality is good and many complex operations will be done for you automatically as long as you don't want to override behaviour, and also this is possible. The quality of such print-out's is IMO very good.
XPS Printing
Hovever if you have complex content and you want it to print out nicely, you have to build XPS-content and print it over the XPS Print Path. This way, you have all possibilities and options, the qualitity is very good but you have the most work to do. I don't like it much, but mostly it's the way I take to print.
I assume, that your question mainly concerns the first block, however I think it could be helpfull to see which options you have, if printing the visual is not enought (for me it's very seldom enough). Hope this answers your question.