Creating GUI applications, that can display graphs, are interactive, etc

How does one go about making an application on Windows? Are most made using Windows Form Programming (In the Visual Studio IDE) or is there a third party library that is most often used? Is it created more code level, without the help of the GUI editor, or what exactly?

I was going to start programming an application that I want to make using Windows Forms, but when I thought about it, the windows forms seemed limited in the ways you can customize your program.

Like creating pie graphs, and highlighting the segments when the user hover's over them with the mouse. But perhaps I am just unaware of how this is done in Windows Forms. Another thing was the changing of the form as it was interacted with. For example, when the user loads a profile, close the welcome form and open the form holding the profile's info - do you have to actually close the form and load a new one? Or can you just re-draw the buttons and other components on the original form? It seems like a resource hog if you have to close and re-open a bunch of forms to simply redraw something.

Basically, the windows forms coding seems to static for my needs. I need something that can, for example, re-graph data on the fly and such, and am not aware if there is a way to do that through windows forms. How is this kind of stuff done? Give me a shove in the right direction.

Thanks for any help.
QT, or GTK+/and or clutter are better options than using windows forms I think.

I'm making an app right now using clutter.
http://www.clutter-project.org/

For the type of thing your talking about I think clutter would be great. Also renders with openGL (hardware accelerated), is cross platform compatible, it's very well documented, and you can do a lot of cool things with it. It's written in C, but there is a c++ binding cluttermm, and also bindings for other languages like python.

I have managed to make a real time frequency analyzer and signal level meter. I draw the graphs with clutter_cairo.

There is a cool example of a clock using clutter cairo which helped me get started here.

http://docs.clutter-project.org/docs/clutter/stable/ClutterCairoTexture.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
#include <stdlib.h>
#include <math.h>
#include <cairo.h>
#include <clutter/clutter.h>

static gboolean
draw_clock (ClutterCairoTexture *canvas,
            cairo_t             *cr)
{
  guint width, height;
  GDateTime *now;
  float hours, minutes, seconds;

  /* get the current time and compute the angles */
  now = g_date_time_new_now_local ();
  seconds = g_date_time_get_second (now) * G_PI / 30;
  minutes = g_date_time_get_minute (now) * G_PI / 30;
  hours = g_date_time_get_hour (now) * G_PI / 6;

  /* clear the contents of the canvas, to avoid painting
   * over the previous frame
   */
  clutter_cairo_texture_clear (canvas);

  /* scale the modelview to the size of the surface */
  clutter_cairo_texture_get_surface_size (canvas, &width, &height);
  cairo_scale (cr, width, height);

  cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
  cairo_set_line_width (cr, 0.1);

  /* the black rail that holds the seconds indicator */
  clutter_cairo_set_source_color (cr, CLUTTER_COLOR_Black);
  cairo_translate (cr, 0.5, 0.5);
  cairo_arc (cr, 0, 0, 0.4, 0, G_PI * 2);
  cairo_stroke (cr);

  /* the seconds indicator */
  clutter_cairo_set_source_color (cr, CLUTTER_COLOR_White);
  cairo_move_to (cr, 0, 0);
  cairo_arc (cr, sinf (seconds) * 0.4, - cosf (seconds) * 0.4, 0.05, 0, G_PI * 2);
  cairo_fill (cr);

  /* the minutes hand */
  clutter_cairo_set_source_color (cr, CLUTTER_COLOR_DarkChameleon);
  cairo_move_to (cr, 0, 0);
  cairo_line_to (cr, sinf (minutes) * 0.4, -cosf (minutes) * 0.4);
  cairo_stroke (cr);

  /* the hours hand */
  cairo_move_to (cr, 0, 0);
  cairo_line_to (cr, sinf (hours) * 0.2, -cosf (hours) * 0.2);
  cairo_stroke (cr);

  g_date_time_unref (now);

  /* we're done drawing */
  return TRUE;
}

static gboolean
invalidate_clock (gpointer data_)
{
  /* invalidate the contents of the canvas */
  clutter_cairo_texture_invalidate (data_);

  /* keep the timeout source */
  return TRUE;
}

G_MODULE_EXPORT int
test_cairo_clock_main (int argc, char *argv[])
{
  ClutterActor *stage, *canvas;

  /* initialize Clutter */
  if (clutter_init (&argc, &argv) != CLUTTER_INIT_SUCCESS)
    return EXIT_FAILURE;

  /* create a resizable stage */
  stage = clutter_stage_new ();
  clutter_stage_set_title (CLUTTER_STAGE (stage), "2D Clock");
  clutter_stage_set_user_resizable (CLUTTER_STAGE (stage), TRUE);
  clutter_actor_set_background_color (stage, CLUTTER_COLOR_LightSkyBlue);
  clutter_actor_set_size (stage, 300, 300);
  clutter_actor_show (stage);

  /* our 2D canvas, courtesy of Cairo */
  canvas = clutter_cairo_texture_new (300, 300);
  clutter_container_add_actor (CLUTTER_CONTAINER (stage), canvas);

  /* bind the size of the canvas to that of the stage */
  clutter_actor_add_constraint (canvas, clutter_bind_constraint_new (stage, CLUTTER_BIND_SIZE, 0));

  /* make sure to match allocation to canvas size */
  clutter_cairo_texture_set_auto_resize (CLUTTER_CAIRO_TEXTURE (canvas), TRUE);

  /* quit on destroy */
  g_signal_connect (stage, "destroy", G_CALLBACK (clutter_main_quit), NULL);

  /* connect our drawing code */
  g_signal_connect (canvas, "draw", G_CALLBACK (draw_clock), NULL);

  /* invalidate the canvas, so that we can draw before the main loop starts */
  clutter_cairo_texture_invalidate (CLUTTER_CAIRO_TEXTURE (canvas));

  /* set up a timer that invalidates the canvas every second */
  clutter_threads_add_timeout (1000, invalidate_clock, canvas);

  clutter_main ();

  return EXIT_SUCCESS;
}

G_MODULE_EXPORT const char *
test_cairo_clock_describe (void)
{
  return "Simple 2D canvas using a Cairo texture actor";
}


You can create a custom shaped actor which you can attach signals to like button events, scroll events, motion events, key events, using cogl (clutter openGL) like this. With some math your could make pie graph with different sections as different actors.

http://docs.clutter-project.org/docs/clutter-cookbook/1.0/actors-non-rectangular.html

There is a GTK+ widget which can graph stuff you might check out.

GtkGraph is a simple to use widget for GTK+ V2.0 designed to allow easy presentation of scientific data. It has been designed with ease of use in mind and simple graphs can be produced with only a few function calls. Additional functions are provided to allow complete control of the format in which data traces are displayed, and scaling of the graph axes. A selection of graph annotations are also available to enhance display or draw attention to particular regions of the graph.


http://gtkgraph.sourceforge.net/

GTK+ and clutter can also be used together.

QT is more widely used though, knowing how to use it might be helpful for employment.
Last edited on
Topic archived. No new replies allowed.