首页上一页 1 下一页尾页 1 条记录 1/1页
vc+=范例完全自学手册问题
发表在C语言图书答疑
2010-05-04
是否精华
是
否
版块置顶:
是
否
第1个范例,自绘对话框的DrawDialog里面代码:
//绘制对话框右边框
if (nFlag & RIGHTBAR)
{
Bmp.LoadBitmap(IDB_RIGHTBAND);
memDC.SelectObject(&Bmp);
Bmp.GetObject(sizeof(BITMAPINFO), &bmpInfo);
int nBmpCX = bmpInfo.bmiHeader.biWidth;
int nBmpCY = bmpInfo.bmiHeader.biHeight;
[font color=#FF0000]nLeftBmpCX = nBmpCX;
[/font] WindowDC.StretchBlt(FactRC.Width()-m_nBorderCX, m_nTitleBarCY, m_nBorderCX,
FactRC.Height()-m_nTitleBarCY, &memDC, 0, 0, nBmpCX, nBmpCY, SRCCOPY);
Bmp.DeleteObject();
}
//绘制对话框底边框
if (nFlag & BOTTOMBAR)
{
Bmp.LoadBitmap(IDB_BOTTOMBAND);
memDC.SelectObject(&Bmp);
Bmp.GetObject(sizeof(BITMAPINFO), &bmpInfo);
int nBmpCX = bmpInfo.bmiHeader.biWidth;
int nBmpCY = bmpInfo.bmiHeader.biHeight;
[font color==#FF0000]nLeftBmpCX = nBmpCX;[/font]
WindowDC.StretchBlt(m_nBorderCX, FactRC.Height()-m_nBorderCY, FactRC.Width()-2*m_nBorderCX,
m_nBorderCY, &memDC, 0, 0, nBmpCX, nBmpCY, SRCCOPY);
Bmp.DeleteObject();
}
红色字体部分,这2行什么用?
2、OnNcMouseMove
MinRC.CopyRect(CRect(m_MinRC.left + ClientRC.left, ClientRC.top + m_MinRC.top,
m_MinRC.right + ClientRC.left,
m_MinRC.bottom + m_MinRC.top
+ ClientRC.top));
MaxRC.CopyRect(CRect(m_MaxRC.left + ClientRC.left, ClientRC.top + m_MaxRC.top,
m_MaxRC.right + ClientRC.left,
m_MaxRC.bottom + m_MaxRC.top
+ ClientRC.top));
CloseRC.CopyRect(CRect(m_CloseRC.left + ClientRC.left, ClientRC.top + m_CloseRC.top,
m_CloseRC.right + ClientRC.left,
m_CloseRC.bottom + m_CloseRC.top
+ ClientRC.top));
为什么加上m_MinRC.top 、m_MaxRC.top 、m_CloseRC.top ,加上这个是不是会造成鼠标还没放到图标上图标颜色就改变?
希望能解决疑问
//绘制对话框右边框
if (nFlag & RIGHTBAR)
{
Bmp.LoadBitmap(IDB_RIGHTBAND);
memDC.SelectObject(&Bmp);
Bmp.GetObject(sizeof(BITMAPINFO), &bmpInfo);
int nBmpCX = bmpInfo.bmiHeader.biWidth;
int nBmpCY = bmpInfo.bmiHeader.biHeight;
[font color=#FF0000]nLeftBmpCX = nBmpCX;
[/font] WindowDC.StretchBlt(FactRC.Width()-m_nBorderCX, m_nTitleBarCY, m_nBorderCX,
FactRC.Height()-m_nTitleBarCY, &memDC, 0, 0, nBmpCX, nBmpCY, SRCCOPY);
Bmp.DeleteObject();
}
//绘制对话框底边框
if (nFlag & BOTTOMBAR)
{
Bmp.LoadBitmap(IDB_BOTTOMBAND);
memDC.SelectObject(&Bmp);
Bmp.GetObject(sizeof(BITMAPINFO), &bmpInfo);
int nBmpCX = bmpInfo.bmiHeader.biWidth;
int nBmpCY = bmpInfo.bmiHeader.biHeight;
[font color==#FF0000]nLeftBmpCX = nBmpCX;[/font]
WindowDC.StretchBlt(m_nBorderCX, FactRC.Height()-m_nBorderCY, FactRC.Width()-2*m_nBorderCX,
m_nBorderCY, &memDC, 0, 0, nBmpCX, nBmpCY, SRCCOPY);
Bmp.DeleteObject();
}
红色字体部分,这2行什么用?
2、OnNcMouseMove
MinRC.CopyRect(CRect(m_MinRC.left + ClientRC.left, ClientRC.top + m_MinRC.top,
m_MinRC.right + ClientRC.left,
m_MinRC.bottom + m_MinRC.top
+ ClientRC.top));
MaxRC.CopyRect(CRect(m_MaxRC.left + ClientRC.left, ClientRC.top + m_MaxRC.top,
m_MaxRC.right + ClientRC.left,
m_MaxRC.bottom + m_MaxRC.top
+ ClientRC.top));
CloseRC.CopyRect(CRect(m_CloseRC.left + ClientRC.left, ClientRC.top + m_CloseRC.top,
m_CloseRC.right + ClientRC.left,
m_CloseRC.bottom + m_CloseRC.top
+ ClientRC.top));
为什么加上m_MinRC.top 、m_MaxRC.top 、m_CloseRC.top ,加上这个是不是会造成鼠标还没放到图标上图标颜色就改变?
希望能解决疑问