使用类库创建饼图/条形图 [英] Creating Pie/Bar Graphics using Class Library

查看:64
本文介绍了使用类库创建饼图/条形图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个能够绘制饼图或条形图的类库.我正在使用以下代码...

I want to create a class library which is able to draw pie or bar chart. i''m using following codes...

Graphics g = CreateGraphics();


当我使用该代码时,Visual Studio告诉我您不能使用dll文件(类库).

我仍然有问题,该如何解决... o_O


when i used that code visual studio told me you cant use with dll files(Class Library).

i''ve still problem how can i fix that... o_O

推荐答案

不,我敢打赌,Visual Studio没告诉你. Visual Studio或.NET Framework都告诉您一些不同的内容,您甚至都不想与我们共享.您是否向项目添加了所需的程序集引用?除了你自己,你没有其他要修复的东西.

即使从单行开始,您似乎仍在尝试滥用该技术.首先,您需要从中获取Graphics的实例,并获取覆盖的Control.OnPaint的参数或Control.Paint的事件处理程序.也许我过去的解决方案会让您对如何做有一个想法:
Paint是一种哪种好玩的方法? (DataGridViewImageCell.Paint(...)) [在mdi子窗体之间画线 [在面板上捕获图形 [如何从旧图纸中清除面板 [ ^ ].

我建议您退后一步,学习编程,.NET和C#的基础知识.了解什么是装配体以及如何引用装配体.使用.NET,DLL只是可执行文件文件扩展名"的一部分,它可以是任何东西.真正的中央播放器是由可执行模块组成的程序集(VS只能创建一个单模块程序集,但是在Reflection中,您可以看到这些模块).掌握全部内容后,您将可以进入UI和图形,但现在不行.

—SA
No, I bet, Visual Studio did not tell you that. Either Visual Studio or .NET Framework told you something different which you did not even bother sharing with us. Did you add required assembly references to your project? You have nothing to fix except yourself.

Even from your single line it seems like you''re trying to abuse the technology. To start with, you need to get an instance of the Graphics from and argument of overridden Control.OnPaint or your event handler of Control.Paint. Maybe my past solutions will give you an idea on what to do:
What kind of playful method is Paint? (DataGridViewImageCell.Paint(...))[^],
Drawing Lines between mdi child forms[^],
capture the drawing on a panel[^],
How do I clear a panel from old drawing[^].

I would advice you step back and learn the basics of programming, .NET and C#. Learn what and assembly is and how assemblies are referenced. With .NET, DLL is just on of file "extensions" for executable files, it can be anything. The central real player is assembly which is composed of executable modules (VS can create only a single-module assembly, but in Reflection you can see those modules). When you get it all, you will be able to move into UI and graphics, but not right now.

—SA


这篇关于使用类库创建饼图/条形图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆