I need plot a curve for my data , the source is like :
12, 14, 18, 30, ....
I was using Qt Qwt, and need port it to windows forms, are there controls? free of charge?
Yes, the Microsoft Chart controls.
Related
I am facing display issues with winforms in window 10 OS. The fonts used for forms is 'Estrangelo Edessa’. In windows 10, this font doesn't come installed by default and hence text/content looks ugly (cutoff/improperly sized). So i am thinking to change the font that looks closer to 'Estrangelo Edessa' and will be native to windows 7, 8 and 10. Please suggest one such font.
I suggest trying Verdana or Lucida Sans Unicode as they have similar proportions to Estrangelo Edessa. Alternatively, Calibri is narrower but otherwise similar and nicer to read.
You may also want to look into having your forms size the controls so text is never cut off, just in case. For example, all WinForms controls have a PreferredSize property.
I need to draw doughnut chart under .net 4.0 but i cannot find any useful library. Metro ui and other need only .net 4.5. I do not want to make custom control. Can you suggest some library?
Easy with Live Charts https://github.com/beto-rodriguez/Live-Charts
it is a new library I started because alternatives right now were not what I needed, maybe it helps you too
<liveCharts:PieChart Name="Chart" Grid.Row="1" Grid.Column="0">
<liveCharts:PieChart.Series>
<liveCharts:PieSeries Title="Maria" PrimaryValues="15, 10, 40, 55"
Labels="Day 1, Day 2, Day 3, Day 4"></liveCharts:PieSeries>
</liveCharts:PieChart.Series>
<liveCharts:PieChart.PrimaryAxis>
<liveCharts:Axis Title="Sold Items"></liveCharts:Axis>
</liveCharts:PieChart.PrimaryAxis>
</liveCharts:PieChart>
I've got a C# 3.0 Windows Forms app built with VS2008 (previously ported from C# 1.1) that looks fine on a WinXP 32bit PC but has jacked proportions on Win7 64bit laptop.
I'm finding references to the lack of support on Win7 for Tahoma 8, which the app uses. Do I need to redesign my dialog using Tahoma 9 to get it to display well on all 3 OSes?
Here are my initial measurements (cm) of a group box containing radio buttons and a button:
OS, Resolution, GroupBox HxW, RadioButton HxW
XP, 1024 x 768, 7.5 x 6.75, 0.75 x 4.4
7, 1024 x 768, 6.8 x 6.3, 0.8 x 5.0
7, 1680 x 1050, 4.9 x 4.5, 0.55 x 3.5
The problem is basically that on the different OS's, the group box has its proportions changed differently than the radios it contains, such that radios and labels that fit fine in the group box in XP run out of bounds (both x & y axis) on 7. Similarly, the text on the button grew more than the button. This happens even when I dial down the 7 box's resolution to match the XP box. The GroupBox's font is larger than that of the radios, but even when I made them equal I saw no improvement.
I think it has something to do with the fact that the application was originally created with an older version of C# and then ported. I say this because I just created a new (empty) Windows forms project using VS2008, and for every control in my app that isn't displaying correctly on win7, when I copy that control to the new app and run it on win7 it resizes correctly. There must be some high level property in the app that the controls are inheriting.
What causes this and what can I do about it?
Thanks in advance.
The main form's 'AutoScaleMode' was set to 'Font'. Setting it to 'DPI' fixed it (although that created other problems due to the code not anticipating being resized on startup...null refs, but I can deal with those).
Tergiver gets double credit for pointing me to the form's property sheet and for me taking this long to notice the obvious property :)
I'm new in win32 programming and I've some questions about resources.
Must I use a resource editor (from Visual Studio) to make controls? I know it can be post-edited using a Resource Hacker editor. How to prevent it?
GUI created in Windows Forms (.net) or Borland Delphi (VCL) can't be edited using res hacker, maybe it creates controls at runtime.
Is a pointless work make all controls by runtime to prevent it to be edited by res hacker?
HWND hButton = CreateWindowEx(
0,
_T("BUTTON"),
_T("Click!"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON | BS_LEFTTEXT,
5, 5, 80, 25, hwnd, (HMENU)IDC_BUTTON1,
GetModuleHandle(NULL),
NULL
);
Second question: isn't there a easy way to set position of a control in top right of parent window?
Today I'm doing it in this way:
case WM_SIZE:
{
HWND hButton;
RECT rcParent, rcButton;
hButton = GetDlgItem(hwnd, IDC_BUTTON1);
GetClientRect(hwnd, &rcParent);
GetClientRect(hButton, &rcButton);
if(!SetWindowPos(hButton, 0, rcParent.right - (rcButton.right - rcButton.left + 5), 5, 0, 0, SWP_NOSIZE))
{
MessageBox(hwnd, _T("Error at WM_SIZE"), _T("Error!"), MB_OK | MB_ICONERROR);
}
}
break;
Are there something like Anchors in pure win32 programming?
The resource file format for dialogs is ancient. The only thing in its favor is the dialog unit abstraction that means that dialogs automatically scale to take account of the users preferred font face and display dpi settings.
Other than that, there is no support in the dialog format for anchors. Microsoft have sadly not released a new UI building toolkit however for native development so for Native Win32 apps you are stuck creating / positioning your controls at runtime manually for any task that dialog resources cannot cater for.
WPF is clearly superior, but requires .NET
I don't see the point of disallowing res hacking one way or another. What do you gain by preventing it? If your own layout skills are so bad that people will want to re-layout their dialogs "illegally" then... well wtf is all I can say.
To Summarize:
It IS pointless to try and protect dialog layouts. What can you possibly hope to achieve by limiting something people would only resort to if your own layouts were ##%^ anyway.
You WILL however probably want to create the controls at runtime anyway as the dialog resource format lacks modern features like anchors. Allthough it is a good idea to continue the practice of designing forms in units based on font metrics rather than pixels.
If you want a pre-build "form" layout system with anchors, Win32 cannot help you. The QT framework if you want a cross platform c++ solution, or switching to .NET's WPF are both powerful alternatives that may allow you to leverage your existing non UI code.
Is a pointless work make all controls
by runtime to prevent it to be edited
by res hacker?
It's not pointless, it's only extra work. You will need also to code a resource editor and/or a layout manager to ease your work. You can define and handle your own resource definition file, and put it as a custom resource.
Are there something like Anchors in
pure win32 programming?
No layout manager in pure win32. But you may find some free source code to do this. It's rather easy to do some minimal layout manager.
Hi probably no becouse win32 api is base for most all graphics libs in windows. What can i recommend you its use some graphics libs if you can do it in your project.
In Vista/7, the Windows Explorer shell window makes use of a special kind of static progress bar to display hard drive space.
With default styles, this bar is blue colored and non-animated. It also turns red colored when it gets close to being full (low disk space).
Using messaging, I can tell the Windows Forms ProgressBar control to update its state to Paused and Error (yellow and red colored, respectively), which works fine, but these are still specific to progress.
In the Windows User Experience Guidelines, it specifically points out this "meter" variant of the Progress Bar:
This pattern isn't a progress bar, but
it is implemented using the progress
bar control. Meters have a distinct
look to differentiate them from true
progress bars.
They say it "is implemented using the progress bar control", so... how? What message could I send to the control to have it behave this way?
I've seen that you can send messages for setting the bar color, but the documentation says these calls are ignored when visual styles are enabled. Nothing else in the Windows API documentation for raw ProgressBar controls seemed to suggest a way to do this. Am I just stuck making a custom drawn bar? I'd really like to utilize the OS whenever possible so that the application will appear consistent throughout different OS versions. I realize that pre-Vista versions probably won't support this, though.
I'm looking for a Windows Forms solution, but I wonder if it is even exposed at all via Win32 API.
It is possible, but not through ProgressBar. Nor does Win7 use a PB to draw those meters, there is no window handle associated with the bar. It must be using custom drawing. That's possible in WinForms as well with the VisualStyleRenderer class. One thing that doesn't help however is that the required visual style parts and states are not declared, not even in .NET 4.0.
This sample form reproduces the meter bar:
using System;
using System.Drawing;
using System.Windows.Forms;
using System.Windows.Forms.VisualStyles;
namespace WindowsFormsApplication1 {
public partial class Form1 : Form {
public Form1() {
InitializeComponent();
}
VisualStyleRenderer renderer = new VisualStyleRenderer(VisualStyleElement.ProgressBar.Bar.Normal);
protected override void OnPaint(PaintEventArgs e) {
renderer.SetParameters("PROGRESS", 11, 2);
renderer.DrawBackground(e.Graphics, new Rectangle(10, 10, 200, 15));
renderer.SetParameters("PROGRESS", 5, 4);
renderer.DrawBackground(e.Graphics, new Rectangle(10, 10, 100, 15));
}
}
}
I got the part and state numbers from the vsstyle.h SDK header file.