Winforms control for displaying html text - c#

I am coding a Windows Forms Application in C#, and one of the requirements is to display some html code in a control, with the correct colors that correspond to the relevant tags.
E.g. When right clicking on a webpage in Google Chrome, then selecting View Page Source, a form is shown with all the html, correctly formatted, with tag colors and each line of code's line number.
Is there a free, reliable control that can do this? Is there an inbuilt Microsoft control that does this?
As I am new to this area of coding, can someone please provide me with some useful names, and some resource links if possible? I am not sure of the correct name for a control that does this, and as such, my Google searches have not come up with what I am looking for.
Also, the control needs to be trustworthy.
Thanks

You can try ScintillaNET control. It's open source and has HTML syntax highlighting as well as many other features.

Related

Create a nice user input in a popup and send the data to the main page

I am working on an ASP.NET/C# application,
I am looking for the best way to do the following. (Note: I don't need you to tell me how to do it, just if you can point me to the right direction to look)
in my main page I have a button. When the user clicks it,I want to open popup open containing a map. the user can click on counties to highlight them and then click on submit. I want to be able to know which countries the user has clicked on in my main page (maybe save it in a array or string or anything)
What is the best way to do this? Should I use flash?
I know this is not a problem/solution type of question, but if someone can point me in the right direction I would very much appreciate it. Just some ideas and I will do the researches.
Thank you very much for any inputs or comments
And sorry for not being a specific problem question.
For the pop-up you can use a dialog (a "modal" HTML form like what you find in jQuery UI or similar). If you're using plain "old" ASP.NET you may need some trick if you want to use forms but they works well.
If what you want to provide is a selection from a map you do not need Flash (at least I wouldn't use it for such simple task, I'm not a fun of that kind of extensions). An image map can work well and it's more portable. If you want you may use HTML5 features to provide better experience for users with a compatible browser. I do not remember the link but I saw a very nice example of this using plain HTML (4) and JavaScript. Using a low-res image as base for the map, small images as checks applied on top of it and div tooltips for details (it supported a zoom-on-click feature too to enlarge a portion of the map loading a higher resolution version). I guess I wrote somewhere that URL...
Links
Nice article: http://www.workwithchoicecuts.com/methodology/revisiting-the-html-image-map/
For image maps basics: http://www.javascriptkit.com/howto/imagemap.shtml
Image map builder: http://www.image-maps.com/
jQuery plug-in for selection from maps: https://github.com/jquery/plugins.jquery.com

search text on web page

I am attempting to create a 'find on page' search option for a wp7 webbrowser control named 'TheBrowser' (using the standard webbrowser control in Visual Studio). I have done a lot of research but have not found much in the way of an example or sample where this was implemented. Essentially I will just be activating the search on a click event, from a textbox where the user may type in a word to search in the current webpage. I would also like to highlight the matched words as seen when doing a find on page search on a desktop browser.
I believe that to create this 'find on page' option I should use javascript to search through the lines of text, and then somehow highlight matched words. I have already implemented forward, back, and refresh buttons using TheBrowser.InvokeScript, but I do not know how to format for searching through the entire webpage (I have never done anything like this before). Any advice or assistance would be greatly appreciated, including code samples as I am completely new to this subject! Thanks in advance for your help and hard work!
Try jquery, this should do the trick: http://hugoware.net/blog/more-jquery-magic-search-highlighting You'll just need to inject the jquery script into the page.

html links & hover events over certain locations on an image

So i created a web site a long time ago using a designer alot like frontpage + expression design put together, and since then Ive gotten more into coding, and I'm learning html, CSS, and all that good stuff.. and i have this re-designed header that Ive made here:
http://prntscr.com/8zct
So what I need to know, is how i can get it so that when a user clicks on one of the links in the header design it will redirect to a page. and also if possible, how to make it so when a user hovers over a link a drop down may appear with other options, EDIT: I'd like to be able to add a backround image to the drop down navigation menu
As me being quite new to this sort of stuff, could anybody help me achieve this?
PS. I'm working in Visual Studio with ASP. but that doesn't change anything about the html and css stuff. just letting you guys know.
To navigate based on clicks on certain areas of an image, read about image maps.
To create menus and other active components, read about JavaScript (also recommended: jQuery).
You can also create divs that are clickable to use as hot spots on an image. that way you could add a background image to that div if ti's hovered/clicked, whereas image maps does not afford you that opportunity.

Possible to render html in a compact edition mobile 6 phone form?

I am wondering does anyone know if it is possible to render html in a mobile 6 form? The only way I can think that may work is the internal web browser control.
I am wondering is there a better way? I am thinking if I go the path of web browser control I will have to generate an html file then insert the code I want into this file.
I need something like this because I am pulling in some text that can possibly be formatted with html stuff such as font weight.
A Browser Control is really the only way (unless you want to parse the HTML yourself and turn it into rich text for an RTF control, or worse, manually handle it all yourself).
As people have said you do need 2 controls, but it might be possible to hide the regular textbox (maybe behind the browser control) will still leaving it editable.
In this case although it would be controlled underneath with code like <b>mytext</b>, the user would never see that giving them some illusion of a WYSIWYG editor (though I can already imagine a few problems you might come into attempting this)
I have written an HTML edit control for .NET.
It doesn't currently support Windows Mobile: but I have Windows Mobile development experience myself, and I might be able to port it to the Compact Framework, if you would be willing to pay for that, as explained in the Developing New Functionality section.

How do I add HTML links in C# TextBox?

How can I put a link in a C# TextBox? I have tried to put HTML tags in the box but instead of showing a link it shows the entire HTML tag. Can this be done with a TextBox?
Use the RichTextBox, no need to build your own, it cames with VS
I would try using an editable div and making it look like a text box. This would allow you to get user input and use links.
To make this easier, try JEditable.
If that is in windows forms and you really can't use the richtextbox, you can create a control with a linklabel inside of textbox.
http://www.codeproject.com/KB/miscctrl/LinkTextBox.aspx
I would think about this a little bit. If you allow executable code in an editable control, the user, the user can execute ANY code. This is generally a bad idea.
The behavior of the C# control is intentional to prevent the exact behavior that you are trying to create. A little creativity (such as parsing out links from the text box and creating a list of links next or below the text box) will provide a much safer application.
To my knowledge not with the standard textbox. You'd have to create your own. One option it the Telerik controls, they're a little pricey for individual development, but very robust and configurable.
For windows application, we can use a webbrowser control. However, for web applications Freetextbox will do the job.This is freely available dll.

Categories