画图问题.
画出的笔划就是一副位图.
不能用LOGBRUSH结构体,
忘记怎么搞了,记得就几句代码的.
请把代码写给我吧.别讲太原理的东西.我知道关键是那支画笔.谢谢

解决方案 »

  1.   

    void DrawARectangle(HDC hdc) 
    {
        HPEN hpen, hpenOld;
        HBRUSH hbrush, hbrushOld;    // Create a green pen.
        hpen = CreatePen(PS_SOLID, 10, RGB(0, 255, 0));
        // Create a red brush.
        hbrush = CreateSolidBrush(RGB(255, 0, 0));    // Select the new pen and brush, and then draw.
        hpenOld = SelectObject(hdc, hpen);
        hbrushOld = SelectObject(hdc, hbrush);
        Rectangle(hdc, 100,100, 200,200);    // Do not forget to clean up.
        SelectObject(hdc, hpenOld);
        DeleteObject(hpen);
        SelectObject(hdc, hbrushOld);
        DeleteObject(hbrush);
    }能满意不?
      

  2.   

    TO:pomelown,你的仍然是填充矩形,画出来的笔划仍然只有那支green pen.
    TO: vcmute,是dc.SelectObject(hBitmap)吗,如果这样的话,怎么一点反应也没有?
      

  3.   

    不是画笔是刷子把?你的意思是把Brush设置成一个位图?
      

  4.   

    算是看懂了。你去看深入浅出MFC的例程吧。不过你对“位图”的概念有问题,至少表述得有问题
      

  5.   

    谢谢大家,还是搞不定.
    我用一种投机取巧的方法实现了.
    在鼠标移动事件中,不断地调用FillRect方法,看上去有点别扭,但也勉强凑合了.
    无奈之举,呵呵