首页 \ 问答 \ 如何在Winform中显示Panel中的饼图(How to show Piechart in Panel in Winform)

如何在Winform中显示Panel中的饼图(How to show Piechart in Panel in Winform)

我正在winform中创建Piechart。我的图表很好。我想要加的唯一的事情就是在Panel中显示Piechart但我无法做到..

这是饼图代码..

    public void DrawPieChartOnForm()
    {
        //Take Total Five Values & Draw Chart Of These Values.
        int[] myPiePercent = { 10, 20, 25, 5, 40 };

        //Take Colors To Display Pie In That Colors Of Taken Five Values.
        Color[] myPieColors = { Color.Red, Color.Black, Color.Blue, Color.Green, Color.Maroon };

        using (Graphics myPieGraphic = this.CreateGraphics())
        {
            //Give Location Which Will Display Chart At That Location.
            Point myPieLocation = new Point(10, 400);

            //Set Here Size Of The Chart…
            Size myPieSize = new Size(500, 500);

            //Call Function Which Will Draw Pie of Values.
            DrawPieChart(myPiePercent, myPieColors, myPieGraphic, myPieLocation, myPieSize);
        }
    }

请帮帮我..先谢谢..


I am creating Piechart in winform.My chart is coming fine.The only thing that i want to add up is to display the Piechart in Panel but i am not able to do it..

Here is the Code of Piechart..

    public void DrawPieChartOnForm()
    {
        //Take Total Five Values & Draw Chart Of These Values.
        int[] myPiePercent = { 10, 20, 25, 5, 40 };

        //Take Colors To Display Pie In That Colors Of Taken Five Values.
        Color[] myPieColors = { Color.Red, Color.Black, Color.Blue, Color.Green, Color.Maroon };

        using (Graphics myPieGraphic = this.CreateGraphics())
        {
            //Give Location Which Will Display Chart At That Location.
            Point myPieLocation = new Point(10, 400);

            //Set Here Size Of The Chart…
            Size myPieSize = new Size(500, 500);

            //Call Function Which Will Draw Pie of Values.
            DrawPieChart(myPiePercent, myPieColors, myPieGraphic, myPieLocation, myPieSize);
        }
    }

Please help me.. Thanks in advance..


原文:https://stackoverflow.com/questions/25987856
更新时间:2023-05-15 07:05

最满意答案

事实上,抓住这一切。 我现在正在工作,在我的最后没有明显的变化。 但是,当您注入脚本时,您应该能够在DOM IIRC中看到它。 是否有可能你只是有一个流浪的错字,导致它不呈现? 您可能想要在其他页面上测试它。

除非Chrome推动一些固定事物(可能)的随机更新,否则我认为它可能只是与intercept.js有关。

尽管如此,我仍然会给Facebook使用严格的文档类型并且不能仅用一个字验证。

初始答案 (保留仅用于表明我的困惑)

我能够用最简单的脚本来复制结果,而我已经在其他页面上工作。 这个问题可能与doctype,XHTML Strict有关,尽管页面管理只包含一个单词,但它不会进行验证 。 我尝试了几种处理它的方法:

  • 在manifest.json中将content_scripts.run_at更改为"document_end"
  • 使用chrome.tabs.executeScript注入脚本
  • 使用chrome.tabs.executeScript注入纯代码
  • 使用chrome.tabs.executeScript注入包含在CDATA标记中的代码的脚本
  • 使用chrome.tabs.executeScript注入包含在CDATA标记中的纯代码

没有工作。


Actually, scratch all of this. I got it working now with no apparent changes on my end. When you inject a script, however, you shouldn't be able to see it in the DOM IIRC. Is it possible you just have a stray typo that's causing it to not render? You might want to test it on other pages.

Unless it was Chrome pushing some random update that fixed things (possible), I'm thinking it might just have to do with intercept.js.

I will still give Facebook a ton of credit for using a strict doctype and failing to validate with only one word, though.

Initial answer (preserved only to demonstrate my confusion)

I was able to duplicate your result with the simplest scripts possible, which I got working on other pages. The issue might have something to do with the doctype, XHTML Strict, and the fact that -- despite the page managing to contain only a single word -- it doesn't validate. I tried several methods of dealing with it:

  • Change content_scripts.run_at to "document_end" in manifest.json
  • Use chrome.tabs.executeScript to inject a script
  • Use chrome.tabs.executeScript to inject pure code
  • Use chrome.tabs.executeScript to inject a script with the code surrounded in CDATA tags
  • Use chrome.tabs.executeScript to inject pure code surrounded in CDATA tags

None worked.

相关问答

更多
  • 这意味着,你可能会在扩展/内部页面上看到一个onUpdated事件(popup?options page?detached dev tools?)。 一种选择是按URL过滤: chrome.tabs.onUpdated.addListener(function(tabId, changeInfo, tab) { if(changeInfo.status == "complete") { if(!tab.url.match(/^http/)) { return; } // Wrong ...
  • document.ready仅在加载document.ready时发生一次。 AJAX请求不会导致它。

    text

    这应该工作。 还尝试将$(msg).find("#content").html()更改$(msg).find("#content")[0].innerHTML ,因 ...
  • 事实上,抓住这一切。 我现在正在工作,在我的最后没有明显的变化。 但是,当您注入脚本时,您不应该能够在DOM IIRC中看到它。 是否有可能你只是有一个流浪的错字,导致它不呈现? 您可能想要在其他页面上测试它。 除非Chrome推动一些固定事物(可能)的随机更新,否则我认为它可能只是与intercept.js有关。 尽管如此,我仍然会给Facebook使用严格的文档类型并且不能仅用一个字验证。 初始答案 (保留仅用于表明我的困惑) 我能够用最简单的脚本来复制结果,而我已经在其他页面上工作。 这个问题可能与d ...
  • 当读取外部标记 (具有src属性的标记 )时,现代浏览器将异步下载此脚本,即,在下载脚本时继续读取/解析HTML。 但是,浏览器会阻止所有后续脚本的执行(注意不下载),想到脚本执行队列 ,所有脚本将逐个排队并执行,但下载是异步的。 更早的浏览器(主要是IE6和IE7)是不同的,它们会阻止HTML解析过程,等待脚本下载和执行,并继续解析剩余的HTML。 总结: 下载和执行是脚本的不同阶段,现代浏览器块执行阶段, 下载可以是异步和并行以提高性能,早期的浏览器阻止下载阶段,这使得页面解析效率降低。 Mordern ...
  • 最简单的方法是,使用jquery.ajax load funciton,解析数据,在另一个var中获取脚本标签数据,将其放入javascript eval函数,有些放在页面上,并将其他数据放在你需要的任何地方要插入的新DOM。 the easiest thing to do is, use the jquery.ajax load funciton , parse the data, get the script tags data in another var, put this into javascr ...
  • 如果您事先知道URL模式,我建议使用chrome.webRequest或chrome.declarativeWebRequest API来阻止图像。 这可以从后台/活动页面完成。 ( 这个答案的第一个修订版显示了“beforeload”事件的一个例子。但是这个事件已经从Chrome 35中删除了,所以我删除了这个例子。) If you know the URL patterns in advance, I suggest to use the chrome.webRequest or chrome.decl ...
  • 只是一个猜测,但如果每次都没有更改网址,您将最终得到内容的缓存副本,一遍又一遍地导致相同的数据,除非服务器发送无缓存标头。 Just a guess, but if the url isn't changing each time, you will end up with a cached copy of the content causing the same data over and over unless the server is sending a no-cache header.
  • 你试图在表格中设置一个div,这是不可能的。 你可以解决它来改变这个:
    至 //Here goes all the etc 将您的JavaScript代码更改为 $(document).ready(function() { setInterval(function () { ...
  • 您列出了不存在的依赖项。 jQuery是库的名称; 你需要引用它的句柄,以加载库,但是jquery 。 当我相信你试图告诉JS加载页脚时,你也将版本号设置为true。 改变这个: wp_register_script('click_scroll', plugins_url( 'click_scroll.js', __FILE__), array( 'jQuery'), true ); 对此: wp_register_script( 'click_scroll', plugins_url( 'click_s ...
  • 正如您所指出的,Durandal将忽略视图中的script标记。 它们仅从index.html (或其等价物)加载。 您是否能够提前引用脚本(和noscript),将它们放在index.html文件中? 换句话说,它们是否必须动态加载? 旁注:你在“main.js中引用了我所有的其他脚本”是什么意思? 你的意思是它们是RequireJS的路径配置吗? 或者你的意思是说它们在index.html文件(或其等价物)中被引用? After much research I found my answer final ...

相关文章

更多

最新问答

更多
  • 获取MVC 4使用的DisplayMode后缀(Get the DisplayMode Suffix being used by MVC 4)
  • 如何通过引用返回对象?(How is returning an object by reference possible?)
  • 矩阵如何存储在内存中?(How are matrices stored in memory?)
  • 每个请求的Java新会话?(Java New Session For Each Request?)
  • css:浮动div中重叠的标题h1(css: overlapping headlines h1 in floated divs)
  • 无论图像如何,Caffe预测同一类(Caffe predicts same class regardless of image)
  • xcode语法颜色编码解释?(xcode syntax color coding explained?)
  • 在Access 2010 Runtime中使用Office 2000校对工具(Use Office 2000 proofing tools in Access 2010 Runtime)
  • 从单独的Web主机将图像传输到服务器上(Getting images onto server from separate web host)
  • 从旧版本复制文件并保留它们(旧/新版本)(Copy a file from old revision and keep both of them (old / new revision))
  • 西安哪有PLC可控制编程的培训
  • 在Entity Framework中选择基类(Select base class in Entity Framework)
  • 在Android中出现错误“数据集和渲染器应该不为null,并且应该具有相同数量的系列”(Error “Dataset and renderer should be not null and should have the same number of series” in Android)
  • 电脑二级VF有什么用
  • Datamapper Ruby如何添加Hook方法(Datamapper Ruby How to add Hook Method)
  • 金华英语角.
  • 手机软件如何制作
  • 用于Android webview中图像保存的上下文菜单(Context Menu for Image Saving in an Android webview)
  • 注意:未定义的偏移量:PHP(Notice: Undefined offset: PHP)
  • 如何读R中的大数据集[复制](How to read large dataset in R [duplicate])
  • Unity 5 Heighmap与地形宽度/地形长度的分辨率关系?(Unity 5 Heighmap Resolution relationship to terrain width / terrain length?)
  • 如何通知PipedOutputStream线程写入最后一个字节的PipedInputStream线程?(How to notify PipedInputStream thread that PipedOutputStream thread has written last byte?)
  • python的访问器方法有哪些
  • DeviceNetworkInformation:哪个是哪个?(DeviceNetworkInformation: Which is which?)
  • 在Ruby中对组合进行排序(Sorting a combination in Ruby)
  • 网站开发的流程?
  • 使用Zend Framework 2中的JOIN sql检索数据(Retrieve data using JOIN sql in Zend Framework 2)
  • 条带格式类型格式模式编号无法正常工作(Stripes format type format pattern number not working properly)
  • 透明度错误IE11(Transparency bug IE11)
  • linux的基本操作命令。。。