我用atl做一个d3d的组件,微软的例子用的是ddraw,
我想用d3dgraphic,我按照m$的例子,通过HDC得到了hwnd,
但是d3ddevice在渲染使总是控制整个客户区,就是
会占用整个窗口,创口的其他组件就无法正常显示了,
不知有没有办法创建一个带hwnd的组件或者是能让
d3ddevice只渲染指定区域。

解决方案 »

  1.   

    If your control is resizable, you might want to use the container's client area as the size of your back buffer and restrict rendering to the control's RECT by using the viewport.This way if your control is resized within the container's client area you dont' have to Reset the device, you just change the viewport.
      

  2.   

    可以的,在ATL ctl 的构造函数中
    m_bWindowOnly = TRUE;