ft + m_textrect.width()/2 ;
drawtext(&m_dctext,nmidx,nbasey, 1,
"楷体_gb2312",20, rgb(0,0,255) ,"研制单位");
drawtext(&m_dctext,nmidx,nbasey+30, 1,
"楷体_gb2312",15, rgb(0,255,255) ,"武警指挥学院模拟中心");
dc.bitblt(0, 0, bm.bmwidth, bm.bmheight,&m_dctext, 0,0, srccopy);
}
8.改变文字垂向位置,出现循环滚动效果:
void csplashwnd::ontimer(uint nidevent)
{ m_ncurpos++;
if( m_ncurpos>300 ) //循环
{ m_ncurpos = 0 ;
}
invalidate(true);
}
9. 演示软件封面时,隐藏主框架窗口:
bool ctestapp::initinstance()
{ m_pmainwnd->showwindow(sw_hide);
m_pmainwnd->updatewindow();
}
10.按任意键或点击鼠标键结束封面演示:
lresult csplashwnd::windowproc(uint message, wparam wparam, lparam lparam)
{ if (c_psplashwnd)
{
if (message == wm_keydown ||message == wm_syskeydown ||
message == wm_lbuttondown ||message == wm_rbuttondown ||
message == wm_mbuttondown ||message == wm_nclbuttondown ||
message == wm_ncrbuttondown ||message == wm_ncmbuttondown)
{ c_psplashwnd->hidesplashscreen();
afxgetmainwnd()->showwindow(sw_maximize);
return true;
}
}
return cwnd::windowproc(message, wparam, lparam);
}
11.封面窗口销毁后,释放有关对象:
void csplashwnd::postncdestroy()
{ m_dcimage.selectobject(m_poldbitmap);
m_dctext.selectcliprgn(null);
m_dctext.selectobject(m_poldbitmaptext);
m_bitmap.deleteobject();
m_rgn.deleteobject();
delete this;
}
文中
程序在windows9、visual c++ 6.0下运行通过。