How to add visual displays (graphs, screens, diagrams) to Visual studio C# - c#

I'm having a lot of fun with C#, recently I created a simple "statistics calculator". It takes in data and calculates the mean, standard deviation etc.
However, I want to add something visual to my console apps. For example a diagram showing the data, or a graph (I also want to try coding something with function graphing).
How can I do that?

It depends on what visual technology you use – WinForms, WPF, MAUI, etc. WinForms has the built-in Chart class. But I think you will eventually want to explore other, 3rd party solutions. I used the LiveCharts with WPF. It is not that hard to prepare data and the graphs look nice.

For GUI with .Net there are many options including:
Web: https://dotnet.microsoft.com/en-us/
Desktop :
https://dotnet.microsoft.com/en-us/apps/desktop ,
https://learn.microsoft.com/en-gb/dotnet/desktop/wpf/get-started/create-app-visual-studio?WT.mc_id=dotnet-35129-website&view=netdesktop-6.0
Multi-Platform: https://dotnet.microsoft.com/en-us/apps/maui , https://www.avaloniaui.net/

Related

C# - Custom GUI Design

So over the years I have seen quite a few C# and VB applications which have custom UI designs. One of which I can give an example of is the DayZCommander (C#) application which looks like this:
I was wondering this because I wanted to start making login forms which look like this (note this is just a photoshop render):
And just use it for overall form design.
If you can give me some information, or an answer on this topic please do.
Thanks.
First of all you'll have to use WPF to easily achieve these kinda results (It might be possible with WinForms but it will very hard).
You can also use 3rd party controls like MahApps Metro (also available using NuGet). Here's an example of what you can end up with :
You have also tools like Microsoft Expression Blend that will make creating animated UIs/Custom control templates very easy. but sooner or later you'll to dive in XAML to create your own custom control templates but that's beyond the scope of this answer (there are plenty of good tutorials online).

How can I port my Windows Phone game to a Silverlight thing that I can use on a webpage?

I'm confused about how to port my WP7 C# game to the web using Silverlight.
I know that code written in C# using the Windows Phone (add-in? plugin? other?) for Visual Studio makes a Silverlight app. But how can I embed my finished WP7 app in a webpage?
I've seen some things such as ExEn, SilverSprite, and XnaTouch {the page redirects to MonoGame}, but I'm confused if I even need something like this in order to make my game playable on the web. I've got a feeling the capability may even be embedded in Visual Studio. Is it even possible to do this without rewriting all the code?
Shortened version: How can I port my WP7 C# game to the web using Silverlight?
Create a new project in Visual Studio targeting Silverlight beside your WP7 project. Then if your existing code is structured nicely, you should be able to re-use most of your "back-end" code (the views, viewmodels people talk of). The best way to do this for files that are common is to add them as links to the new project, so you don't have to keep them both up to date - if there are small changes between versions you can use conditional compilation to do this.
You'll want to use some completely new classes for some things, such as probably the top level view. Some XAML (eg a UserControl definition) might be usable between both with changes, though some people will favour always creating different versions. Have a look at this extensive article on cross-platform SL/WPF/WP7 development.
What have you tried?
If you create a Silverlight application in Visual Studio, you should be able to include all your existing Views, ViewModels, resources and so on. I don't know if you'll be able to make a single project that both builds into a WP7 and a Silverlight application but I personally wouldn't bother trying.
You can't directly - there are missing runtime components and features that are only available to Windows Phone applications.
You can, however, reuse lots of code, especially C# - all XAML code, I beleive, you'll have to copy/paste from WP7 XAML to Silverlight XAML.

How to create an interactive (Drag and drop stuff) GUI in C#

Need to make a custom application in which i can drag and drop (predefined) items on to a workspace and move them freely, example is of in Microsoft Office PowerPoint where a workflow diagram can be made easily ...
need a start, where can i get one ?
You may want to take a look at this CodeProject article, concerning how to create a diagram designer in WPF:
http://www.codeproject.com/KB/WPF/WPFDiagramDesigner_Part1.aspx
Sounds like a fun, but big project.
I'd start here: Creating Your Own Drawing Application with Visual Basic .NET, Part 1. It's VB.NET, but it's a good start, and it';s all about the framework. Hopefully, you can translate VB.NET to C#.
I think that you need to learn how to make a simple drag and drop first. Try this tutorial or this tutorial. Hope this helps!

How to build UIs like skype

I want to know how can I build UIs like skype using standard .Net/C#. Is it possible at all?
Thanks
You can use Windows Presentation Foundation to build more stylish GUIs than Windows Forms. It's pretty difficult to move from Forms to WPF. You usually need a good design tool, like Expression Blend.
AFAIK skype was built using Qt4, it's rather easy to build custom gui widgets, check
C++ GUI Programming with Qt4, 2nd Edition and this tutorial.
P.S. check this to see how to build qt4 on windows using MSVC 2008.
It might be possible to build such an UI using Windows Forms, but only with a lot of custom control code or a really good component suite. But as Chris said, WPF should be the tool of your choice when you want to use .NET.
Qt4 is a really powerful C++ framework, also powering apps like Google Earth. The Qt SDK, inclduing everything you need to get started (Compiler, IDE, documentation), can be obtained here. It's licensed (among others) under the LGPL.
Windows Presentation Foundation will give you the most flexibility, but it can be hard to use. An alternative to this is Sliverlight - Version 3 is going to be capable of being used outside of the browser (similar to Adobe Air), and in some ways provides an easier development experience. You might want to consider using some third party controls to give you access to nice functionality that you wouldn't get out of box.
To my acknowledge Skype is build with Delphi an a set of third party tools, so it for sure can be done without WPF.
Take a look at the components from DevExpress or TMS.

How do I give professional look and feel to my .NET windows application?

I'm using WINFORMS not WPF.
I just know basic c# .net gui programming. I donot want the traditional windows look. I want to have my own custom look (eg. gtalk, antivirus softwares, media players, google chrome).
Actually I'm inspired by google's PICASA software. Its awesome. I want to do something like that.How can I do that? If there is something I should learn please point me.
Also I may have to write my own custom controls (like modified tree view etc..) I guess. Please give some good learning resources.
This article describes how to draw custom windows. The author also shows how to draw non-rectangular windows.
If you could use WPF instead of Windows Forms, this is a good article about customizing window drawing:
http://www.codeguru.com/csharp/.net/net_wpf/article.php/c16379/
There is also a question with some good answers here on SO:
Creating custom forms in WPF?
Update:
I think that skinning and custom drawing is fun to do from a programmers perspective, but I also think that there is almost no benefit for the user.
The creators of the platform you are developing for might have put a lot of effort into the design of their windowing toolkits.
If you just want to change some visual aspects of your application you also should take into account that you might miss some important other aspects of UI design:
consistency
accessibility
aesthetics (if you are overdoing
effects, gradients, ...)
internationalization
...
As you are developing for Windows, you also lose the skinning ability of the OS itself. And I think that some of the skins that come with newer versions of Windows are pretty good.
You can try any of the following:
telerik
Syncfusion
(source: componentsource.co.jp)
Or other components.
They do make your UI pretty.
Edit: if you want to study how they do it, you can buy the source code-- along with documentation and understand from there.
There are some commercial control libraries available.
I can recommend the Krypton Suite. It consists of the free Krypton Toolkit (which contains a lot of skinnable controls) and other non-free controls (Navigator, Ribbon, Docking, Workspace). It has some built-in palettes and renderers that allow you to make your UI look like Office 2010, Office 2007, Office 2003, ...
You want to look for +winforms +skinning. I haven't tried these, but the first hits don't look bad. Most decent skinning tools will be paid for.
From what you said, you want to develop your own custom controls. You have some frameworks for this like Qt which can use Direct3D for hardware accelerated graphics. It also have a Visual Studio plugin. There is a free LGPL version and a commercial version of it.
I remembered about Qt because you mentioned Picasa and as far as I remember, I heard the Picasa UI has been written through Qt.
You can try using "SetWindowRgn(..)" to set an arbitrary region for your window. This may range from giving a rounded rectangle shape to giving a weird looking shape to the form!
Check this out: Link.
There is another option if you are working in Vista(aero enabled), ie you can check out DwmExtendFrameIntoClientArea(..) function here: link text
You can set the form's border style to 'none' and go on to create your custom form! You then might have to create custom buttons to carry out tasks like close, minimise, maximise etc. You might even need to write code for drag and drop events..
For the background, you might need to have a look at the gradient fills to give a great effect, otherwise you can use great looking pictures as Background..! But the latter option isnt good unless you have really good pic.

Categories

Resources