Open source zooming timeline library - c#

I need to draw a zoomable timeline using C# and WinForms. What I want exactly is a line with points of time from which there are edges to vertices with information about what happened in these points of time. The zooming feature is really important. Interactivity (possibility for user to move the vertices with infomation) would also be great.
Can you advise any open-source library for that?

I would make a user control for TimeLineEvent (vertical line with time line event properties and implementations like Data and Time, etc) and a user control for TimeLine that acts as some collection of TimeLineEvents.
For zooming, I would add a property like ZoomBounds and maybe Scale, etc, and override the onPaint event to draw only the zoomBounds (and over the whole timeline bounds).
There's no open source library I've ever heard of to support timelines.
Anyways, because you have a specific need for the timeline, you are most likely not going to find what you need, and better just start from scratch yourself.

Related

C++/C# path/vector drawing library (2D)

I'm looking for a toolkit / library which can help me drawing polygons, vectors and paths. Beside actually drawing the 2D elements, the library should also be able to draw handles to the base points of those elements, so I am able to move them by drag & drop. This means the lib also handles the picking routines (or at least allows me to define callbacks).
Please see the image below of a path containing single lines as well as cubic Bezier curves (including some handles and an enclosing rectangle of the full path):
example image of path including handles and enclosing rectangle
I'm not sure if there's such a library (in C++/C#). Haven't been able to find one yet. Am I stuck with drawing all the elements in this example graph by myself?
Thank you for reading!
Paule
You have too many demands. I used to use Qt, it's convenient. Using signal and slot to implement callback is very easy. Qpainter can draw many shapes, but i'am not sure it can meet your requirement. You can learn more about Qt, it has many demos to learn.
OpenGL satisfies all your requests, and implementing what you want seems not quite difficult.
To get started, you can refer to
http://www.lighthouse3d.com/tutorials/glut-tutorial/setup-basics/
Using GLUT, you can easily created OpenGL windows, create and draw figures.
Mouse and keyboard events also have callbacks, in which you can add your handler. Even if you don't want to use GLUT, there are numerous tutorials telling you how to get started with OpenGL.
Once you are familiar with basic OpenGL skills, there is also a tutorial on how to create something more complex, like Bezier curves, using OpenGL. Although this tutorial doesn't works exactly as you want, you can still add control points, and drag & drop using glut functions.
http://nehe.gamedev.net/tutorial/bezier_patches__fullscreen_fix/18003/

Rotate Windows form upside down

I have a C# application that has an existing WinForm that I now need to display upside down.
The application will be displayed on a touchscreen Windows 7 device. If two people are using the device, one person is viewing it right-side-up while another user will be simultaneously viewing it upside-down. I will need to have one control displayed right-side-up while another control is displayed upside-down, each duplicate forms. Both need to be functional. It is not necessary for the title bar and Windows close, maximize, and minimize to be rotated.
Is there a way to easily rotate this Form and all of its contents without having to rewrite it from scratch?
Unfortunately, rotating controls is not directly possible in WinForms.
At least, not if you want them to retain their functionality. It would be relatively simple to draw the control into a bitmap, rotate the bitmap, and then draw that back to the desired location on the form. But you would obviously lose the ability to interact with the controls. They would just be static representatives of their original selves.
But making functional upside-down controls just isn't going to happen. I mean, you could try to write a bunch of custom drawing code for owner-drawn controls, but you'll still run into a bunch of bugs, corner cases, and compatibility problems. The Win32 controls that WinForms is based on just don't support this. No big surprise, really, considering they were invented some 20–25 years before anyone thought of computer screens that you could carry around in your pocket and rotate in any direction. There is a good reason that UI technologies like WPF came out around the time that touch screens and tablets did.
There are some possibilities that can be explored when it comes to flipping the entire screen, but that's not going to help when you want different controls going different directions. (And I guess it betrays my vantage point as a desktop app guy when I say this, but that just sounds like an incredibly confusing UI.)
If you absolutely have to have this, someone else is going to have to give you another route to hack it, perhaps along the lines of Dhawalk's comment: hosting the WinForms control inside of a WPF app that does provide built-in support for rotated controls. I don't know enough about this to make any concrete suggestions down that path. From a few minutes of searching, it appears that WindowsFormsHost does not actually support rotation transforms, so this may be a non-starter anyway.

How to draw in Windows Phone(substitute to graphics in Java)

Is there any substitute to the Java's graphics in the Windows Phone. I would like to draw a component(watch hand like) which indicates how much the user is away from the "correct state". It is for the guitar tuner.
Thanks
PS: I don't want to use it XAML at all to do it, just simple paint graphics and repaint when needed.
The best way to go about this is to open your project in Expression Blend.
It lets you draw various components, add pictures, edit pictures and add Story lines to it.
For Instance, Once you draw the hand, based on the tuner, you could adjust the Width of the Hand to let the user know how far he is away from the required target.
Expression Blend also lets you make storyboards if you wish to include animations.

How to select, display and save regions of a graphic?

So here's the situation: I need to take a (user-specified) graphic, and allow the user to define and label regions within that graphic. For example, if you uploaded a picture of a face, you might want to define "right eye", "left eye", "nose" etc. Also, having defined the regions, if I select a previously defined region, it should be highlighted on the image somehow. These regions are (obviously) not necessarily rectangular, and they cannot overlap. And if you click within a defined region in the graphic, I would be able to identify which region was clicked on.
There are a couple ways I can think of for doing this, none of which are quite satisfactory. Another developer before me tried doing it with a transparent grid overlaid on the original graphic, fiddling with the background alpha/color for highlighting regions, but I think they rather kludged it. I could either get my hands really dirty trying to clean up their code, or try a completely new approach.
What would you suggest for maximum speed and user-friendliness?
Bounty added: for the best solution that will get me up and running in the minimum time.
The GraphicsPath class is made to do this. Keep a list of them along with the image. Draw the image first, then Graphics.DrawPath() to draw the regions on top of the image.
Hit testing is simple with GraphicsPath.IsVisible(). Iterate the list in reverse order so overlaps work.
Assuming you haven't decided yet on the technology you'll use, I'd suggest WPF; I find most graphics-related tasks easier with WPF (at least in version 4) and it's specifically geared for interactivity, so creating non-rectangular regions using mouse clicks and hit-testing clicks to select shapes would be pretty easy. Loading images is also easy.
However, if you haven't used WPF or Silverlight until now, there is some overhead in learning the basic concepts and APIs; so I'm afraid there's no real way I can recommend it as a maximum speed solution without knowing your (or whoever's will be working on it) competencies. That said, using MVVM and WPF would be definitely the maximum speed solution for me. Also the maximum user-friendliness since WPF enables quite interesting interaction models out-of-the-box, like multi-touch support (that's the trendy one that should be mentioned, right?) and easy non-standard layout and placement of controls.
You need polygons, saved as list of points. And you need hit testing for them. See the link:
http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/40ebadc1-6154-4c7c-9cb1-d608a426b29c

How do I create simple animations using a WriteableBitmap?

Greetings, everyone.
I'm trying to learn some Silverlight basics, and have decided to write a simple Mandelbrot-set drawing application for that reason. In Silverlight, of course. ;)
The application is mostly done. I'm using a WriteableBitmap to work on the pixels, and a simple Image placed on an empty form to display this bitmap (using the Source property). I've even managed to get zooming and moving the fractal around under control.
Now I wanted to spice things up a little bit by adding just a slight bit of animations; I know I cannot make the fractal move, as it's a scalar graphics object, but for example, when I zoom in, it would be nice if the initial zoom was a smooth animation, after which the application would recalculate the new, "zoomed in and sharp as a knife" image. Likewise, if I drag the image around (which is used to move the fractal) and the mouse leaves the image area, it would be great if the fractal returned smoothly to it's initial position (as it is now, it just "snaps" back as the initial settings are restored).
My problem is that I have no idea which parameter to control in an animation. I'm using ScaleTransform, for example, for zooming, but that is used to render the WriteableBitmap on the bitmap itself rather than use the transform properties of the image object. I did so because when I started manipulating the image properties, then the whole image started to move around the form, when I'd rather it's boundaries stay in place.
I suspect I may be trying to do something which Silverlight wasn't really meant to do in the first place (or I've started doing this whole thing wrong), but if I COULD add such little animations, that would be great. As such, any tips appreciated.
It sounds like you want to use the Silverlight animation engine to animate your own custom properties, that control your image display, rather than the image elements or containers.
If your properties for controlling the appearance of the image were exposed as double Dependancy Properties, then the animation system can use the basic DoubleAnimation objects to change your settings smoothly over time. You can even author animations in Expression Blend.
The animation engine would certainly give you easing functions etc to smooth out motion. If I had more detail on how your object was structured I could be more specific, but I hope this helps.

Categories

Resources