C#系统。绘制参考问题

发布于 2025-01-21 08:27:47 字数 821 浏览 3 评论 0原文

当涉及C#,C ++(c Ethity)和Visual Studio时,我是一个菜鸟。

我正在尝试使用图表绘制表,

public override void OnPaintChart(PaintChartEventArgs args)
        {
            Graphics gr = args.Graphics;

            Font font = new Font("Arial", 10);
    
            for (int i = 0; i < KeyLevel.Length; i++)
                gr.DrawString(KeyLevel[i].ToString(), font, Brushes.LightGray, 20, 23 * i + 30);
        }

但我会收到以下错误: “类型'图形'是在未引用的汇编中定义的。您必须将引用添加到汇编'system.drawing.common,version = 6.0.0.0,culture =中性,中性,publickeytoken = cc6 .... ...”

如果我右键单击我的项目,然后去添加&gt;参考,唯一可用的系统。绘图显示为版本4.0.0.0。

我已经更新了Visual Studio并更新了.NET。

我已经说/引用了? (不知道术语)

using System;
using System.Drawing;

在我的脚本开头。

如何获得6.0.0.0版本?

我真的很坚持。

提前致谢。

I'm a total noob when it comes to C#, C++ (C anything) and visual studio.

I'm trying to draw a table over a chart using

public override void OnPaintChart(PaintChartEventArgs args)
        {
            Graphics gr = args.Graphics;

            Font font = new Font("Arial", 10);
    
            for (int i = 0; i < KeyLevel.Length; i++)
                gr.DrawString(KeyLevel[i].ToString(), font, Brushes.LightGray, 20, 23 * i + 30);
        }

but i'm getting the following error:
"The type 'Graphics' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Drawing.Common, Version=6.0.0.0, Culture=neutral, PublicKeyToken=cc6......."

If I right click my project and go to Add > References, the only available system.drawing is showing as version 4.0.0.0.

I've updated visual studio and updated .net.

I've stated/referenced?? (dont know terminology)

using System;
using System.Drawing;

at the beginning of my script.

How do i get version 6.0.0.0?

I'm really stuck with this.

Thanks in advance.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

因为看清所以看轻 2025-01-28 08:27:47

解决方案如果有人遇到相同的问题。

更新到Visual Studio 2022。

在Visual Studio中更新.NET

,右键单击Project&GT;管理Nuget软件包

搜索图纸和安装软件包。

在微软发誓要使生活艰难。

完毕。

Solution if anybody runs into same problem.

Update to Visual Studio 2022.

Update .net

In visual studio, right click project > Manage NuGet Packages

Search drawing and install package.

Swear at Microsoft for making life hard.

Done.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文