【问题标题】:win32 drawing function plot with brushwin32用画笔绘图功能绘图
【发布时间】:2016-03-12 06:06:33
【问题描述】:

我应该使用绘制函数 f(x)= x^2 绘图的 win32 API 编写应用程序。为此,我被要求使用 HBRUSH 结构,但在 win32 API 中似乎没有适当的过程。它们有很多,主要用于绘制完整的形状。

有没有我可以用来逐点绘制情节的?

【问题讨论】:

    标签: winapi drawing


    【解决方案1】:

    Brush 用于绘制曲面、矩形区域、填充等;你真的需要笔

    试试这个:

    HDC hdc = /* init this */;
    HPEN pen = CreatePen(PS_SOLID, 0, RGB(0, 0, 0));
    HGDIOBJ old_pen = SelectObject(hdc, pen);
    
    // move to first poing in plot
    MoveToEx(hdc, startingpoint_x, statingpoint_y, NULL);
    
    // executes for each point in plot
    LineTo(hdc, pointx, pointy);
    
    // clean up
    SelectObject(hdc, old_pen);
    DeleteObject(pen);
    

    【讨论】:

      猜你喜欢
      • 2015-02-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-08-03
      • 2015-09-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多