官网

http://www.hzhcontrols.com

前提

入行已经7,8年了,一直想做一套漂亮点的自定义控件,于是就有了本系列文章。

GitHub:https://github.com/kwwwvagaa/NetWinformControl

码云:https://gitee.com/kwwwvagaa/net_winform_custom_control.git

如果觉得写的还行,请点个 star 支持一下吧

欢迎前来交流探讨: 企鹅群568015492 

麻烦博客下方点个【推荐】,谢谢

NuGet

Install-Package HZH_Controls

目录

https://www.cnblogs.com/bfyx/p/11364884.html

用处及效果

准备工作

使用GDI+画的控件,不了解可以先百度下

开始

添加一个类UCPieChart ,继承UserControl

添加一些属性

  /// <summary>
/// The pie items
/// </summary>
private PieItem[] pieItems = new PieItem[]; /// <summary>
/// The random
/// </summary>
private Random random = null; /// <summary>
/// The format center
/// </summary>
private StringFormat formatCenter = null; /// <summary>
/// The margin
/// </summary>
private int margin = ; /// <summary>
/// The m is render percent
/// </summary>
private bool m_IsRenderPercent = false; /// <summary>
/// The percen format
/// </summary>
private string percenFormat = "{0:F2}%"; /// <summary>
/// The components
/// </summary>
private IContainer components = null; /// <summary>
/// Gets or sets a value indicating whether this instance is render percent.
/// </summary>
/// <value><c>true</c> if this instance is render percent; otherwise, <c>false</c>.</value>
[Browsable(true)]
[Category("自定义")]
[DefaultValue(false)]
[Description("获取或设置是否显示百分比占用")]
public bool IsRenderPercent
{
get
{
return m_IsRenderPercent;
}
set
{
m_IsRenderPercent = value;
Invalidate();
}
} /// <summary>
/// Gets or sets the text margin.
/// </summary>
/// <value>The text margin.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置文本距离,单位为像素,默认50")]
[DefaultValue()]
public int TextMargin
{
get
{
return margin;
}
set
{
margin = value;
Invalidate();
}
} /// <summary>
/// Gets or sets the percent format.
/// </summary>
/// <value>The percent format.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置文百分比文字的格式化信息")]
[DefaultValue("{0:F2}%")]
public string PercentFormat
{
get
{
return percenFormat;
}
set
{
percenFormat = value;
Invalidate();
}
} /// <summary>
/// The center of circle color
/// </summary>
private Color centerOfCircleColor = Color.White;
/// <summary>
/// Gets or sets the color of the center of circle.
/// </summary>
/// <value>The color of the center of circle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置圆心颜色")]
public Color CenterOfCircleColor
{
get { return centerOfCircleColor; }
set
{
centerOfCircleColor = value;
Invalidate();
}
} /// <summary>
/// The center of circle width
/// </summary>
private int centerOfCircleWidth = ;
/// <summary>
/// Gets or sets the width of the center of circle.
/// </summary>
/// <value>The width of the center of circle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置圆心宽度")]
public int CenterOfCircleWidth
{
get { return centerOfCircleWidth; }
set
{
if (value < )
return;
centerOfCircleWidth = value;
Invalidate();
}
} /// <summary>
/// The title
/// </summary>
private string title;
/// <summary>
/// Gets or sets the ti tle.
/// </summary>
/// <value>The ti tle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题")]
public string TiTle
{
get { return title; }
set
{
title = value;
ResetTitleHeight();
Invalidate();
}
}
/// <summary>
/// The title font
/// </summary>
private Font titleFont = new Font("微软雅黑", );
/// <summary>
/// Gets or sets the title font.
/// </summary>
/// <value>The title font.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题字体")]
public Font TitleFont
{
get { return titleFont; }
set
{
titleFont = value;
ResetTitleHeight();
Invalidate();
}
} /// <summary>
/// The title froe color
/// </summary>
private Color titleFroeColor = Color.Black;
/// <summary>
/// Gets or sets the color of the title froe.
/// </summary>
/// <value>The color of the title froe.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题颜色")]
public Color TitleFroeColor
{
get { return titleFroeColor; }
set
{
titleFroeColor = value;
Invalidate();
}
} /// <summary>
/// The title size
/// </summary>
private SizeF titleSize = SizeF.Empty;
/// <summary>
/// Resets the height of the title.
/// </summary>
private void ResetTitleHeight()
{
if (string.IsNullOrEmpty(title))
titleSize = SizeF.Empty;
else
{
using (var g = this.CreateGraphics())
{
titleSize = g.MeasureString(title, titleFont);
}
}
} /// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题颜色")]
[Localizable(true)]
public PieItem[] DataSource
{
get { return pieItems; }
set
{
pieItems = value;
Invalidate();
}
}

重绘

  protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SetGDIHigh(); int width;
Point centerPoint = GetCenterPoint(out width);
Rectangle rectangle = new Rectangle(centerPoint.X - width, centerPoint.Y - width, width * , width * );
if (width > && pieItems.Length != )
{
if (!string.IsNullOrEmpty(title))
e.Graphics.DrawString(title, titleFont, new SolidBrush(titleFroeColor), new PointF((this.Width - titleSize.Width) / , ));
Rectangle rect = new Rectangle(rectangle.X - centerPoint.X, rectangle.Y - centerPoint.Y, rectangle.Width, rectangle.Height);
e.Graphics.TranslateTransform(centerPoint.X, centerPoint.Y);
e.Graphics.RotateTransform(90f);
int num = pieItems.Sum((PieItem item) => item.Value);
float num2 = 0f;
float num3 = -90f;
for (int i = ; i < pieItems.Length; i++)
{
Color cItem = pieItems[i].PieColor ?? ControlHelper.Colors[i];
Pen pen = new Pen(cItem, 1f);
SolidBrush solidBrush = new SolidBrush(cItem);
SolidBrush solidBrush2 = new SolidBrush(cItem);
Brush percentBrush = new SolidBrush(cItem);
float num4 = e.Graphics.MeasureString(pieItems[i].Name, Font).Width + 3f;
float num5 = (num != ) ? Convert.ToSingle((double)pieItems[i].Value * 1.0 / (double)num * 360.0) : ((float)( / pieItems.Length));
e.Graphics.FillPie(solidBrush, rect, 0f, 0f - num5);
e.Graphics.DrawPie(new Pen(solidBrush), rect, 0f, 0f - num5);
e.Graphics.RotateTransform(0f - num5 / 2f);
if (num5 < 2f)
{
num2 += num5;
}
else
{
num2 += num5 / 2f;
int num6 = ;
if (num2 < 45f || num2 > 315f)
{
num6 = ;
}
if (num2 > 135f && num2 < 225f)
{
num6 = ;
}
e.Graphics.DrawLine(pen, width * / , , width + num6, );
e.Graphics.TranslateTransform(width + num6, 0f);
if (num2 - num3 < 5f)
{
}
num3 = num2;
if (num2 < 180f)
{
e.Graphics.RotateTransform(num2 - 90f);
e.Graphics.DrawLine(pen, 0f, 0f, num4, 0f);
e.Graphics.DrawString(pieItems[i].Name, Font, solidBrush2, new Point(, -Font.Height));
if (IsRenderPercent)
{
e.Graphics.DrawString(string.Format(percenFormat, num5 * 100f / 360f), Font, percentBrush, new Point(, ));
}
e.Graphics.RotateTransform(90f - num2);
}
else
{
e.Graphics.RotateTransform(num2 - 270f);
e.Graphics.DrawLine(pen, 0f, 0f, num4, 0f);
e.Graphics.TranslateTransform(num4 - 3f, 0f);
e.Graphics.RotateTransform(180f);
e.Graphics.DrawString(pieItems[i].Name, Font, solidBrush2, new Point(, -Font.Height));
if (IsRenderPercent)
{
e.Graphics.DrawString(string.Format(percenFormat, num5 * 100f / 360f), Font, percentBrush, new Point(, ));
}
e.Graphics.RotateTransform(-180f);
e.Graphics.TranslateTransform(0f - num4 + 3f, 0f);
e.Graphics.RotateTransform(270f - num2);
}
e.Graphics.TranslateTransform(-width - num6, 0f);
e.Graphics.RotateTransform(0f - num5 / 2f);
num2 += num5 / 2f;
}
solidBrush.Dispose();
pen.Dispose();
solidBrush2.Dispose();
percentBrush.Dispose();
}
e.Graphics.ResetTransform(); if (centerOfCircleWidth > )
{
Rectangle rectCenter = new Rectangle(rect.Left + rect.Width / - centerOfCircleWidth / , rect.Top + rect.Height / - centerOfCircleWidth / , centerOfCircleWidth, centerOfCircleWidth);
e.Graphics.FillEllipse(new SolidBrush(centerOfCircleColor), rectCenter);
}
}
else
{
e.Graphics.FillEllipse(Brushes.AliceBlue, rectangle);
e.Graphics.DrawEllipse(Pens.DodgerBlue, rectangle);
e.Graphics.DrawString("无数据", Font, Brushes.DimGray, rectangle, formatCenter);
}
base.OnPaint(e);
}

一些辅助函数

  /// <summary>
/// Sets the data source.
/// </summary>
/// <param name="source">The source.</param>
public void SetDataSource(PieItem[] source)
{
if (source != null)
{
DataSource = source;
}
}
/// <summary>
/// Sets the data source.
/// </summary>
/// <param name="names">The names.</param>
/// <param name="values">The values.</param>
/// <exception cref="System.ArgumentNullException">
/// names
/// or
/// values
/// </exception>
/// <exception cref="System.Exception">两个数组的长度不一致!</exception>
public void SetDataSource(string[] names, int[] values)
{
if (names == null)
{
throw new ArgumentNullException("names");
}
if (values == null)
{
throw new ArgumentNullException("values");
}
if (names.Length != values.Length)
{
throw new Exception("两个数组的长度不一致!");
}
pieItems = new PieItem[names.Length];
for (int i = ; i < names.Length; i++)
{
pieItems[i] = new PieItem
{
Name = names[i],
Value = values[i]
};
}
Invalidate();
}

完整代码

 // ***********************************************************************
// Assembly : HZH_Controls
// Created : 2019-09-23
//
// ***********************************************************************
// <copyright file="UCPieChart.cs">
// Copyright by Huang Zhenghui(黄正辉) All, QQ group:568015492 QQ:623128629 Email:623128629@qq.com
// </copyright>
//
// Blog: https://www.cnblogs.com/bfyx
// GitHub:https://github.com/kwwwvagaa/NetWinformControl
// gitee:https://gitee.com/kwwwvagaa/net_winform_custom_control.git
//
// If you use this code, please keep this note.
// ***********************************************************************
using System;
using System.ComponentModel;
using System.ComponentModel.Design;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Text;
using System.Linq;
using System.Windows.Forms; namespace HZH_Controls.Controls
{
/// <summary>
/// Class UCPieChart.
/// Implements the <see cref="System.Windows.Forms.UserControl" />
/// </summary>
/// <seealso cref="System.Windows.Forms.UserControl" />
public class UCPieChart : UserControl
{
/// <summary>
/// The pie items
/// </summary>
private PieItem[] pieItems = new PieItem[]; /// <summary>
/// The random
/// </summary>
private Random random = null; /// <summary>
/// The format center
/// </summary>
private StringFormat formatCenter = null; /// <summary>
/// The margin
/// </summary>
private int margin = ; /// <summary>
/// The m is render percent
/// </summary>
private bool m_IsRenderPercent = false; /// <summary>
/// The percen format
/// </summary>
private string percenFormat = "{0:F2}%"; /// <summary>
/// The components
/// </summary>
private IContainer components = null; /// <summary>
/// Gets or sets a value indicating whether this instance is render percent.
/// </summary>
/// <value><c>true</c> if this instance is render percent; otherwise, <c>false</c>.</value>
[Browsable(true)]
[Category("自定义")]
[DefaultValue(false)]
[Description("获取或设置是否显示百分比占用")]
public bool IsRenderPercent
{
get
{
return m_IsRenderPercent;
}
set
{
m_IsRenderPercent = value;
Invalidate();
}
} /// <summary>
/// Gets or sets the text margin.
/// </summary>
/// <value>The text margin.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置文本距离,单位为像素,默认50")]
[DefaultValue()]
public int TextMargin
{
get
{
return margin;
}
set
{
margin = value;
Invalidate();
}
} /// <summary>
/// Gets or sets the percent format.
/// </summary>
/// <value>The percent format.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置文百分比文字的格式化信息")]
[DefaultValue("{0:F2}%")]
public string PercentFormat
{
get
{
return percenFormat;
}
set
{
percenFormat = value;
Invalidate();
}
} /// <summary>
/// The center of circle color
/// </summary>
private Color centerOfCircleColor = Color.White;
/// <summary>
/// Gets or sets the color of the center of circle.
/// </summary>
/// <value>The color of the center of circle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置圆心颜色")]
public Color CenterOfCircleColor
{
get { return centerOfCircleColor; }
set
{
centerOfCircleColor = value;
Invalidate();
}
} /// <summary>
/// The center of circle width
/// </summary>
private int centerOfCircleWidth = ;
/// <summary>
/// Gets or sets the width of the center of circle.
/// </summary>
/// <value>The width of the center of circle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置圆心宽度")]
public int CenterOfCircleWidth
{
get { return centerOfCircleWidth; }
set
{
if (value < )
return;
centerOfCircleWidth = value;
Invalidate();
}
} /// <summary>
/// The title
/// </summary>
private string title;
/// <summary>
/// Gets or sets the ti tle.
/// </summary>
/// <value>The ti tle.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题")]
public string TiTle
{
get { return title; }
set
{
title = value;
ResetTitleHeight();
Invalidate();
}
}
/// <summary>
/// The title font
/// </summary>
private Font titleFont = new Font("微软雅黑", );
/// <summary>
/// Gets or sets the title font.
/// </summary>
/// <value>The title font.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题字体")]
public Font TitleFont
{
get { return titleFont; }
set
{
titleFont = value;
ResetTitleHeight();
Invalidate();
}
} /// <summary>
/// The title froe color
/// </summary>
private Color titleFroeColor = Color.Black;
/// <summary>
/// Gets or sets the color of the title froe.
/// </summary>
/// <value>The color of the title froe.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题颜色")]
public Color TitleFroeColor
{
get { return titleFroeColor; }
set
{
titleFroeColor = value;
Invalidate();
}
} /// <summary>
/// The title size
/// </summary>
private SizeF titleSize = SizeF.Empty;
/// <summary>
/// Resets the height of the title.
/// </summary>
private void ResetTitleHeight()
{
if (string.IsNullOrEmpty(title))
titleSize = SizeF.Empty;
else
{
using (var g = this.CreateGraphics())
{
titleSize = g.MeasureString(title, titleFont);
}
}
} /// <summary>
/// Gets or sets the data source.
/// </summary>
/// <value>The data source.</value>
[Browsable(true)]
[Category("自定义")]
[Description("获取或设置标题颜色")]
[Localizable(true)]
public PieItem[] DataSource
{
get { return pieItems; }
set
{
pieItems = value;
Invalidate();
}
} /// <summary>
/// Initializes a new instance of the <see cref="UCPieChart"/> class.
/// </summary>
public UCPieChart()
{
InitializeComponent();
random = new Random();
formatCenter = new StringFormat();
formatCenter.Alignment = StringAlignment.Center;
formatCenter.LineAlignment = StringAlignment.Center;
SetStyle(ControlStyles.UserPaint | ControlStyles.SupportsTransparentBackColor, true);
SetStyle(ControlStyles.ResizeRedraw, true);
SetStyle(ControlStyles.OptimizedDoubleBuffer, true);
SetStyle(ControlStyles.AllPaintingInWmPaint, true);
pieItems = new PieItem[];
if (GetService(typeof(IDesignerHost)) != null || LicenseManager.UsageMode == LicenseUsageMode.Designtime)
{
pieItems = new PieItem[]; for (int i = ; i < ; i++)
{
pieItems[i] = new PieItem
{
Name = "Source" + (i + ),
Value = random.Next(, )
};
}
}
} /// <summary>
/// Gets the center point.
/// </summary>
/// <param name="width">The width.</param>
/// <returns>Point.</returns>
private Point GetCenterPoint(out int width)
{
width = Math.Min(base.Width, base.Height - (titleSize != SizeF.Empty ? ((int)titleSize.Height) : )) / - margin - ;
return new Point(base.Width / - , base.Height / + (titleSize != SizeF.Empty ? ((int)titleSize.Height) : ) - );
} /// <summary>
/// 引发 <see cref="E:System.Windows.Forms.Control.Paint" /> 事件。
/// </summary>
/// <param name="e">包含事件数据的 <see cref="T:System.Windows.Forms.PaintEventArgs" />。</param>
protected override void OnPaint(PaintEventArgs e)
{
e.Graphics.SetGDIHigh(); int width;
Point centerPoint = GetCenterPoint(out width);
Rectangle rectangle = new Rectangle(centerPoint.X - width, centerPoint.Y - width, width * , width * );
if (width > && pieItems.Length != )
{
if (!string.IsNullOrEmpty(title))
e.Graphics.DrawString(title, titleFont, new SolidBrush(titleFroeColor), new PointF((this.Width - titleSize.Width) / , ));
Rectangle rect = new Rectangle(rectangle.X - centerPoint.X, rectangle.Y - centerPoint.Y, rectangle.Width, rectangle.Height);
e.Graphics.TranslateTransform(centerPoint.X, centerPoint.Y);
e.Graphics.RotateTransform(90f);
int num = pieItems.Sum((PieItem item) => item.Value);
float num2 = 0f;
float num3 = -90f;
for (int i = ; i < pieItems.Length; i++)
{
Color cItem = pieItems[i].PieColor ?? ControlHelper.Colors[i];
Pen pen = new Pen(cItem, 1f);
SolidBrush solidBrush = new SolidBrush(cItem);
SolidBrush solidBrush2 = new SolidBrush(cItem);
Brush percentBrush = new SolidBrush(cItem);
float num4 = e.Graphics.MeasureString(pieItems[i].Name, Font).Width + 3f;
float num5 = (num != ) ? Convert.ToSingle((double)pieItems[i].Value * 1.0 / (double)num * 360.0) : ((float)( / pieItems.Length));
e.Graphics.FillPie(solidBrush, rect, 0f, 0f - num5);
e.Graphics.DrawPie(new Pen(solidBrush), rect, 0f, 0f - num5);
e.Graphics.RotateTransform(0f - num5 / 2f);
if (num5 < 2f)
{
num2 += num5;
}
else
{
num2 += num5 / 2f;
int num6 = ;
if (num2 < 45f || num2 > 315f)
{
num6 = ;
}
if (num2 > 135f && num2 < 225f)
{
num6 = ;
}
e.Graphics.DrawLine(pen, width * / , , width + num6, );
e.Graphics.TranslateTransform(width + num6, 0f);
if (num2 - num3 < 5f)
{
}
num3 = num2;
if (num2 < 180f)
{
e.Graphics.RotateTransform(num2 - 90f);
e.Graphics.DrawLine(pen, 0f, 0f, num4, 0f);
e.Graphics.DrawString(pieItems[i].Name, Font, solidBrush2, new Point(, -Font.Height));
if (IsRenderPercent)
{
e.Graphics.DrawString(string.Format(percenFormat, num5 * 100f / 360f), Font, percentBrush, new Point(, ));
}
e.Graphics.RotateTransform(90f - num2);
}
else
{
e.Graphics.RotateTransform(num2 - 270f);
e.Graphics.DrawLine(pen, 0f, 0f, num4, 0f);
e.Graphics.TranslateTransform(num4 - 3f, 0f);
e.Graphics.RotateTransform(180f);
e.Graphics.DrawString(pieItems[i].Name, Font, solidBrush2, new Point(, -Font.Height));
if (IsRenderPercent)
{
e.Graphics.DrawString(string.Format(percenFormat, num5 * 100f / 360f), Font, percentBrush, new Point(, ));
}
e.Graphics.RotateTransform(-180f);
e.Graphics.TranslateTransform(0f - num4 + 3f, 0f);
e.Graphics.RotateTransform(270f - num2);
}
e.Graphics.TranslateTransform(-width - num6, 0f);
e.Graphics.RotateTransform(0f - num5 / 2f);
num2 += num5 / 2f;
}
solidBrush.Dispose();
pen.Dispose();
solidBrush2.Dispose();
percentBrush.Dispose();
}
e.Graphics.ResetTransform(); if (centerOfCircleWidth > )
{
Rectangle rectCenter = new Rectangle(rect.Left + rect.Width / - centerOfCircleWidth / , rect.Top + rect.Height / - centerOfCircleWidth / , centerOfCircleWidth, centerOfCircleWidth);
e.Graphics.FillEllipse(new SolidBrush(centerOfCircleColor), rectCenter);
}
}
else
{
e.Graphics.FillEllipse(Brushes.AliceBlue, rectangle);
e.Graphics.DrawEllipse(Pens.DodgerBlue, rectangle);
e.Graphics.DrawString("无数据", Font, Brushes.DimGray, rectangle, formatCenter);
}
base.OnPaint(e);
}
/// <summary>
/// Sets the data source.
/// </summary>
/// <param name="source">The source.</param>
public void SetDataSource(PieItem[] source)
{
if (source != null)
{
DataSource = source;
}
}
/// <summary>
/// Sets the data source.
/// </summary>
/// <param name="names">The names.</param>
/// <param name="values">The values.</param>
/// <exception cref="System.ArgumentNullException">
/// names
/// or
/// values
/// </exception>
/// <exception cref="System.Exception">两个数组的长度不一致!</exception>
public void SetDataSource(string[] names, int[] values)
{
if (names == null)
{
throw new ArgumentNullException("names");
}
if (values == null)
{
throw new ArgumentNullException("values");
}
if (names.Length != values.Length)
{
throw new Exception("两个数组的长度不一致!");
}
pieItems = new PieItem[names.Length];
for (int i = ; i < names.Length; i++)
{
pieItems[i] = new PieItem
{
Name = names[i],
Value = values[i]
};
}
Invalidate();
} /// <summary>
/// Releases unmanaged and - optionally - managed resources.
/// </summary>
/// <param name="disposing">为 true 则释放托管资源和非托管资源;为 false 则仅释放非托管资源。</param>
protected override void Dispose(bool disposing)
{
if (disposing && components != null)
{
components.Dispose();
}
base.Dispose(disposing);
} /// <summary>
/// Initializes the component.
/// </summary>
private void InitializeComponent()
{
SuspendLayout();
base.AutoScaleMode = System.Windows.Forms.AutoScaleMode.None;
BackColor = System.Drawing.Color.Transparent;
base.Name = "UCPieChart";
ResumeLayout(false);
}
}
}

最后的话

如果你喜欢的话,请到 https://gitee.com/kwwwvagaa/net_winform_custom_control 点个星星吧

(七十)c#Winform自定义控件-饼状图的更多相关文章

  1. Android图表库MPAndroidChart(七)—饼状图可以再简单一点

    Android图表库MPAndroidChart(七)-饼状图可以再简单一点 接上文,今天实现的是用的很多的,作用在统计上的饼状图,我们看下今天的效果 这个效果,我们实现,和之前一样的套路,我先来说下 ...

  2. Android之自定义控件实现天气温度折线图和饼状图

    以前写了个天气的APP,最近把他更新了一个版本,就抽取其中的天气温度折现图这个功能写了这篇博客,来与大家分享,希望对你有所帮助. 效果如图: 代码: MainActivity.Java /**** * ...

  3. Winform 后台生成饼状图并保存为图片

    .cs代码如下 string ldt_picPath = System.Windows.Forms.Application.StartupPath + @"Pic\" + Item ...

  4. DevExpress使用之ChartControl控件绘制图表(多坐标折线图、柱状图、饼状图)

    最近因为公司项目需要用到WinForm的DecExpress控件,在这里把一些使用方法总结一下. DevExpress中有一个专门用来绘制图表的插件ChartControl,可以绘制折线图.饼状图.柱 ...

  5. Android图表库MPAndroidChart(八)——饼状图的扩展:折线饼状图

    Android图表库MPAndroidChart(八)--饼状图的扩展:折线饼状图 我们接着上文,饼状图的扩展,增加折现的说明,来看下我们要实现的效果 因为之前对MPAndroidChart的熟悉,所 ...

  6. Android绘图机制(四)——使用HelloCharts开源框架搭建一系列炫酷图表,柱形图,折线图,饼状图和动画特效,抽丝剥茧带你认识图表之美

    Android绘图机制(四)--使用HelloCharts开源框架搭建一系列炫酷图表,柱形图,折线图,饼状图和动画特效,抽丝剥茧带你认识图表之美 这里为什么不继续把自定义View写下去呢,因为最近项目 ...

  7. [BOT]自己动手实现android 饼状图,PieGraphView,附源码解析

    本文要介绍的是一个参照手机支付宝app里面记账本功能里的"饼状图"实现的控件.通常app中可能的数据展示控件有柱状图,折线图,饼状图等,如果需要一个包含多种View控件的库,那么 ...

  8. highcharts饼状图使用案例

    在公司由于需要对订单数据进行分析,故使用到了highcharts工具 <block name="Js"> <script type="text/java ...

  9. C#+JQuery+.Ashx+百度Echarts实现全国省市地图和饼状图动态数据图形报表的统计

    在目前的一个项目中,需要用到报表表现数据,这些数据有多个维度,需要同时表现出来,同时可能会有大量数据呈现的需求,经过几轮挑选,最终选择了百度的echarts作为报表基础类库.echarts功能强大,界 ...

随机推荐

  1. 构建docker虚拟化平台

    安装epel-release扩展包 yum install epel-release -y 安装docker yum install docker-ce 启动docker systemctl star ...

  2. C# NAudio录音和播放音频文件-实时绘制音频波形图(从音频流数据获取,而非设备获取)

    NAudio的录音和播放录音都有对应的类,我在使用Wav格式进行录音和播放录音时使用的类时WaveIn和WaveOut,这两个类是对功能的回调和一些事件触发. 在WaveIn和WaveOut之外还有对 ...

  3. 2013-2014 ACM-ICPC Pacific Northwest Regional Contest L.Languages

    题意略. 思路: 这种字符串的模拟题,应该熟练使用stringstream. 详见代码: #include<bits/stdc++.h> using namespace std; map& ...

  4. python 3.7.4下载与安装的问题

    发病时间:2019 年 8 月12 日 周一 1.操作系统环境: Win10 64位 2.pyhon版本3.7.4 python官网地址:www.python.org 本机下载的文件名为:python ...

  5. Javaweb Session机制(有待补充)

    Javaweb Session机制 一.前言 session,中文经常翻译为会话,其本来的含义是指有始有终的一系列动作/消息,比如打电话是从拿起电话拨号到挂断电话这中间的一系列过程可以称之为一个ses ...

  6. 10_switch语句的使用

    /* switch 语句和c语言的用法不同 1.go语句是默认添加break语句的,但c不是默认的 2.go语句添加一个fallthrough语句,可以顺序执行接下来的结构 3.switch在关键词后 ...

  7. C# Memcache集群原理、客户端配置详细解析

    概述 memcache是一套开放源的分布式高速缓存系统.由服务端和客户端组成,以守护程序(监听)方式运行于一个或多个服务器中,随时会接收客户端的连接和操作.memcache主要把数据对象缓存到内存中, ...

  8. CentOS搭建php + nginx环境

    更新Centos的yum源 yum update 安装EPEL源和REMI源 yum install epel-release yum install http://rpms.remirepo.net ...

  9. JS函数提升和变量提升

    1.1什么是函数提升和变量的提升? JS引擎在运行整个JS代码的过程中,分为俩步. 第一步是读取和解析JS代码,第二部是执行. 在引擎解析JS代码的时候,当解析器遇见变量声明(var 变量名)和函数声 ...

  10. 关于Socket、TCP/IP、HTTP、FTP及网络编程

    来源:陶邦仁 链接:http://blog.jobbole.com/99694/ 既然是网络传输,涉及几个系统之间的交互,那么首先要考虑的是如何准确的定位到网络上的一台或几台主机,再者如何进行可靠高效 ...