tags:

views:

65

answers:

5

Greetings Stackers,

I have a simple little application that performs some analysis of all our corporate clients, and generates a score for each one based on their activity (think "traffic light" happyness system).

Now, the score that's generated gets it's information from a variety of metrics, and spits out what can appear to be an arbitrary magic number.

What I want to do is present the algorythm results in an easily-consumed way.

At the moment I'm using a simple HTML document displayed in a webbrowser control, generated by the algorythm for each record.

For example, the output looks like this:

A meeting gives 20 points.      Have 1 meeting.      20 points.
Each phonecall gives 5 points.  Have 5 phone calls.  25 points.
Each purchase gives 10 points.  Have 2 purchases.    20 points.

(in reality, there are some subtle highlights of colour on the key words too)

Is an embedded webbrowser control, populated by generated HTML really the best way of achieving this sort of thing? It seems a bit wrong.

Currently using winforms, but as it's a new, internal and simple app, can switch to WPF if more suitable.

+2  A: 

If you're not using WPF, then the answer is yes. That's about the best way of doing that, especially because of formatting.

WPF would be a much better idea though, so if you can, move on over. XAML is your friend.


EDIT:

Righto, so if this were a WPF application, you could use for instance, a Grid to give yourself the right column and row formatting you need. Then, from this point you could add a Label, or TextBox (Less formatting ability with the latter) and extend the controls ControlTemplate, or simply add a Style according to what you need.

Now if you wanted to do something like conditional formatting on the values that are received, you can do so with the use of a DataTemplate with DataTrigger's to show a style, dependent on the data.

Basically, WPF will give you much more flexibility, robustness and learning goodness, rather than using a WebBrowser control with some good ol' HTML.

PS: You can also template the DataGrid control and stylize it to suit your needs, or even dynamically load ResourceDictionary's for multiple display types. WPF is very flexible.

Kyle Rozendo
XAML may be my friend, but it would be nice to know how he is going to help me.
tvanfosson
Sure, will edit it now.
Kyle Rozendo
+1 for the update
tvanfosson
Thanks - lots of info! Sounds like my choice now is between using HTML and winforms, both of which I know and can get done quick, or use this as an excuse to learn WPF :)
Cylindric
If this is a small and personal app, take the jump and learn some WPF. You wont regret it :)
Kyle Rozendo
A: 

you can use the RichTextBox class. It can show formatted text (exactly like WordPad) but you have to provide Rtf format to this class. If you have only HTML, the browser is a good idea.

najmeddine
A: 

I will take it from architectural point of view.

you can think of some sort of configurable templated scheme, and implement it in whatever presentation layer.

ie, templates are stored in xml or database, and the presentation layer understands how to present data.

so you can easily switch to any suitable presentation.

Ahmed Khalaf
A: 

You could use GDI and do this from the paint method in a custom control. However this a lot of formatting code to write!

In the past I have used HTML + webbrowser control for this sort of thing, without many problems.

The RickTextBox control show formatted text, but is likely to be harder to use, (I am assuming you already know a bit of HTML). The RickTextBox control is also not a flexible as HTML.

You could use WPF with XAML, it would work well for this task. However you will have to learn WPF first…

Therefore I think HTML + webbrowser control is your best option.

Ian Ringrose
A: 
balexandre
That's exactly how I'm doing it at the moment. It works fine (although I had a problem getting the webbrowser control to behave), but I wanted to be sure I wasn't doing something peculiar.
Cylindric
as long as you fill up an HTML element, you can even include CSS into the WebBrowser.DocumentText you will be fine.
balexandre