我正在尝试设计一个图表,其中 x 表示异常消息,y 表示它发生的次数。
我无法在每个条形下显示 x 值(异常消息),我还尝试标记 x 并为每个标签设置范围,但条形不是在此标签上生成的,而是远离它们生成的。
这是我的代码示例
reportChart.Series.Add(exception);
reportChart.Series[exception].SetDefault(true);
reportChart.Series[exception].Enabled = true;
reportChart.Series[exception].Points.AddXY(exception,ExceptionMessages[exception]);
Run Code Online (Sandbox Code Playgroud)
ExceptionMessages[exception] 是一个包含当前异常发生次数的值的字典。
我有一个包含面板的表单,在这个面板中我绘制形状,如矩形和圆形,我需要放大这些形状,我看到几个选项,但大多数使用PictureBox.我应该使用位图创建面板区域作为位图并更改缩放系数?? 如果我想要进行平移并且不能在面板尺寸中绘制图像,这对我的帮助也会更大.
这是我的代码的快照
private void panel1_Paint(object sender, PaintEventArgs e)
{
Graphics g = panel1.CreateGraphics();
SolidBrush myBrush = new SolidBrush(Color.Black);
Pen p = new Pen(Color.Black);
int RecScale = 1;
foreach (CircuitData.ResistorRow resistorRow in ResistorData.Resistor)
{
RectangleF rec = new RectangleF((float)(resistorRow.CenterX - resistorRow.Length / 2), (float)(resistorRow.CenterY - resistorRow.Width/ 2), (float)resistorRow.Length, (float)resistorRow.Width);
float orientation = 360 - (float)resistorRow.Orientation;
PointF center = new PointF((float)resistorRow.CenterX, (float)resistorRow.CenterY);
PointF[] points = CreatePolygon(rec, center, orientation);
if (!Double.IsNaN(resistorRow.HiX) && !Double.IsNaN(resistorRow.HiY))
{
g.FillEllipse(myBrush, (float)resistorRow.HiX - 5 , (float)resistorRow.HiY - 5, …Run Code Online (Sandbox Code Playgroud)