谁有饼状图(比例图),给我一份源码,谢谢

解决方案 »

  1.   

    http://www.codeproject.com/miscctrl/pie_chart_ctrl.asp
      

  2.   

    MSchart 你可以用这个控件!
      

  3.   

    MSchart  控件有一个函数叫editcopy吧,可以把当前的并图放到
    剪贴板里,打印的时候直接打印剪贴板的内容就行了。
      

  4.   

    MSchart  控件有一个函数叫editcopy吧,可以把当前的并图放到
    剪贴板里,打印的时候直接打印剪贴板的内容就行了。具体些,能给个例子吗
      

  5.   

    MSchart  控件有一个函数叫editcopy吧,可以把当前的并图放到
    剪贴板里,打印的时候直接打印剪贴板的内容就行了。具体些,能给个例子吗
      

  6.   

    MSchart  控件有一个函数叫editcopy吧,可以把当前的并图放到
    剪贴板里,打印的时候直接打印剪贴板的内容就行了。具体些,能给个例子吗
      

  7.   

    http://www.vcfan.com/vc/down_children.asp?child_name=codes_kongjian&page=2
    第1335(编号)
      

  8.   

    http://www.vcfan.com/vc/down_children.asp?child_name=codes_kongjian&page=2
    第1335(编号)里面没有打印这一项?
      

  9.   

    我有mschart的使用例子,但是公司的项目,不敢给你啊!呵呵
      

  10.   

    在OnPreparePrinting中:如果是饼图打印
                  pChartLine->EditCopy();

    if(IsClipboardFormatAvailable(CF_BITMAP))
    {
    if(OpenClipboard())
    {
    m_hbitmap = (HBITMAP)::GetClipboardData(CF_BITMAP);
    CloseClipboard();
    }
    }
      

  11.   

    在OnPrint里;
    CRect rectPage = pInfo->m_rectDraw;
    if(m_hbitmap)
    {
    BITMAP bm;
    ::GetObject(m_hbitmap, sizeof(BITMAP), &bm);
    CSize chartSize(bm.bmWidth, bm.bmHeight);

    CDC dcMemory,dcScreen;
    dcScreen.Attach(::GetDC(NULL));

    // create "from" device context and select the loaded bitmap into it
    dcMemory.CreateCompatibleDC(&dcScreen);
    dcMemory.SelectObject(m_hbitmap);

    // Print at 85% size within left/right margin 
    CSize printSize;
    printSize.cx=(int)(rectPage.right*.85);
    printSize.cy=printSize.cx/chartSize.cx*chartSize.cy;
    CRect rect(0,0,printSize.cx,printSize.cy);

    // Print chart centered
    pDC->StretchBlt( ((rectPage.right+rectPage.left)/2)-(printSize.cx/2), rectPage.top, printSize.cx, printSize.cy, &dcMemory, 0, 0, chartSize.cx, chartSize.cy, SRCCOPY);
    dcMemory.DeleteDC();
    }
    就可以打印剪贴板里的内容
      

  12.   


     
      在OnPreparePrinting中:如果是饼图打印
                  pChartLine->EditCopy(); //////pChartLine是什么

    if(IsClipboardFormatAvailable(CF_BITMAP))  ////////CF_BITMAP是什么 
    {
    if(OpenClipboard())
    {
    m_hbitmap = (HBITMAP)::GetClipboardData(CF_BITMAP);
    CloseClipboard();
    }
    }
      
     
      在OnPrint里;
    CRect rectPage = pInfo->m_rectDraw;  ///////pInfo是什么
    if(m_hbitmap)               ////////m_hbitmap是什么
    {
    BITMAP bm;
    ::GetObject(m_hbitmap, sizeof(BITMAP), &bm);
    CSize chartSize(bm.bmWidth, bm.bmHeight);

    CDC dcMemory,dcScreen;
    dcScreen.Attach(::GetDC(NULL));

    // create "from" device context and select the loaded bitmap into it
    dcMemory.CreateCompatibleDC(&dcScreen);
    dcMemory.SelectObject(m_hbitmap);

    // Print at 85% size within left/right margin 
    CSize printSize;
    printSize.cx=(int)(rectPage.right*.85);
    printSize.cy=printSize.cx/chartSize.cx*chartSize.cy;
    CRect rect(0,0,printSize.cx,printSize.cy);

    // Print chart centered
    pDC->StretchBlt( ((rectPage.right+rectPage.left)/2)-(printSize.cx/2), rectPage.top, printSize.cx, printSize.cy, &dcMemory, 0, 0, chartSize.cx, chartSize.cy, SRCCOPY);
    dcMemory.DeleteDC();
    }
    就可以打印剪贴板里的内容
      
     
      

  13.   

    该代码可以打印对话框上显示的饼图吗?
    OnPreparePrinting,OnPrint在CDialog中不能用吧?
      

  14.   

    我的是再FormView里的。
    pChartLine是msChart控件的句柄
    CF_BITMAP是告诉剪贴板要考的bitmap图像
    pInfo是CTestocxPrintViewView::OnPrint(CDC* pDC, CPrintInfo* pInfo)里的。打印变量的指针。
    m_hbitmap是一个 CBitmap,全局变量,用来判断剪贴板是否有位图
      

  15.   

    http://www.codeproject.com/miscctrl/pie_chart_ctrl.asp
    里有饼图方式下的程序,但不带打印功能, 它是在对话框上放了一个Custom control控件,
    属性里Class是PIE_CHART_CTRL,Style是0x50010000,在对话框的初始化里边有语句: m_wndChart.SubclassDlgItem(IDC_PIECHART1, this);如何写  pChartLine->EditCopy(); pChartLine如何被替换掉
      

  16.   

    如何把http://www.codeproject.com/miscctrl/pie_chart_ctrl.asp里的饼图打印出来
      

  17.   

    http://www.codeproject.com/miscctrl/pie_chart_ctrl.asp
    里有饼图方式下的程序,但不带打印功能, 它是在对话框上放了一个Custom control控件,
    属性里Class是PIE_CHART_CTRL,Style是0x50010000,在对话框的初始化里边有语句: m_wndChart.SubclassDlgItem(IDC_PIECHART1, this);
    我画饼图 用的是这种方式,不是把mschart控件直接放在对话框上,这样打印不一样吧?
    pChartLine->EditCopy();这句不一样,我的m_wndChart不是mschart类型,而pChartLine是mschart类型
      

  18.   

    editcopy是mschart的一个函数。其实他editcopy做的事就是找到饼图区域,然后把他给截下来,再放到剪贴板。
    就这么多,你用别的控件也可以啊,只不过要自己写这个过程。
      

  19.   

    如何把Custom control控件区域内的所有东西作为一个bitmap截下来
      

  20.   

    HBITMAP CopyScreenToBitmap(LPRECT lpRect) //lpRect 代表选定区域
    {
    HDC       hScrDC, hMemDC;    // 屏幕和内存设备描述表
    HBITMAP    hBitmap, hOldBitmap;   // 位图句柄int       nX, nY, nX2, nY2; // 选定区域坐标
    int       nWidth, nHeight;  // 位图宽度和高度
    int       xScrn, yScrn;    // 屏幕分辨率 
        if (IsRectEmpty(lpRect))// 确保选定区域不为空矩形
         return NULL;
      

  21.   

    //为屏幕创建设备描述表
       hScrDC = CreateDC("DISPLAY", NULL, NULL, NULL);
       //为屏幕设备描述表创建兼容的内存设备描述表
       hMemDC = CreateCompatibleDC(hScrDC);
       // 获得选定区域坐标
       nX = lpRect- >left;
       nY = lpRect- >top;
       nX2 = lpRect- >right;
       nY2 = lpRect- >bottom;
       // 获得屏幕分辨率
       xScrn = GetDeviceCaps(hScrDC, HORZRES);
       yScrn = GetDeviceCaps(hScrDC, VERTRES);
       //确保选定区域是可见的
       if (nX < 0)
          nX = 0;
       if (nY < 0)
          nY = 0;
       if (nX2 > xScrn)
          nX2 = xScrn;
       if (nY2 > yScrn)
          nY2 = yScrn;
       nWidth = nX2 - nX;
       nHeight = nY2 - nY;
      

  22.   

    接上
    // 创建一个与屏幕设备描述表兼容的位图
    hBitmap = CreateCompatibleBitmap
     (hScrDC, nWidth, nHeight);
       // 把新位图选到内存设备描述表中
       hOldBitmap = SelectObject(hMemDC, hBitmap);
       // 把屏幕设备描述表拷贝到内存设备描述表中
    BitBlt(hMemDC, 0, 0, nWidth, nHeight, hScrDC, nX, nY, SRCCOPY);
       //得到屏幕位图的句柄
       hBitmap = SelectObject(hMemDC, hOldBitmap);
       //清除 
       DeleteDC(hScrDC);
       DeleteDC(hMemDC);
       // 返回位图句柄
       return hBitmap;
    }
      

  23.   

    yushulei(永远) :
    这些你都敢贴啊》》》》》
      

  24.   

    HBITMAP CopyScreenToBitmap(LPRECT lpRect)
    中lpRect是屏幕坐标还是客户区坐标
      

  25.   

    我的饼图画在对话框上,在对话框里
    m_hbitmap=CopyScreenToBitmap(lpRect);m_hbitmap是在程序的应用类里声明的HBITMAP m_hbitmap;这样我在程序的视图类里,p是CStatListApp*
    void CStatListView::OnPrint(CDC* pDC, CPrintInfo* pInfo) 
    {
    CStatisticsApp* p=(CStatisticsApp*)::AfxGetApp();
    CRect rectPage = pInfo->m_rectDraw;
    if(p->m_hbitmap)
    {
    BITMAP bm;
    ::GetObject(p->m_hbitmap, sizeof(BITMAP), &bm);
    CSize chartSize(bm.bmWidth, bm.bmHeight);

    CDC dcMemory,dcScreen;
    dcScreen.Attach(::GetDC(NULL));

    // create "from" device context and select the loaded bitmap into it
    dcMemory.CreateCompatibleDC(&dcScreen);
    dcMemory.SelectObject(p->m_hbitmap);

    // Print at 85% size within left/right margin 
    CSize printSize;
    printSize.cx=(int)(rectPage.right*.85);
    printSize.cy=printSize.cx/chartSize.cx*chartSize.cy;
    CRect rect(0,0,printSize.cx,printSize.cy);

    // Print chart centered
    pDC->StretchBlt( ((rectPage.right+rectPage.left)/2)-(printSize.cx/2), rectPage.top, printSize.cx, printSize.cy, &dcMemory, 0, 0, chartSize.cx, chartSize.cy, SRCCOPY);
    dcMemory.DeleteDC();
    } CListView::OnPrint(pDC, pInfo);
    }不能大出结果,为什么
      

  26.   

    我的饼图已经放在剪贴板里,按照上面的方法,而且在打印预览里也显示出来了,打印工作放在OnDraw里,
    pDC->SetMapMode( MM_TEXT);
    if(m_hbitmap)
    {
            BITMAP bm;
            ::GetObject(p->m_hbitmap, sizeof(BITMAP), &bm);
        CSize chartSize(bm.bmWidth, bm.bmHeight);

        CDC dcMemory,dcScreen;
        dcScreen.Attach(::GetDC(NULL));

       // create "from" device context and select the loaded bitmap into it        dcMemory.CreateCompatibleDC(&dcScreen);
        dcMemory.SelectObject(p->m_hbitmap);

    // Print at 85% size within left/right margin 
        CSize printSize;
        printSize.cx=(int)(rectPage.right*.85);
        
    printSize.cy=printSize.cx/chartSize.cx*chartSize.cy;
    CRect rect(0,0,printSize.cx,printSize.cy);// Print chart centered
    pDC->StretchBlt(500 ,rectPage.bottom-printSize.cy, printSize.cx,   printSize.cy, &dcMemory, 0, 0, chartSize.cx, chartSize.cy, SRCCOPY);
    dcMemory.DeleteDC();
    }
    为啥不能打印出来