{
GetDlgItem(IDC_frame)->ShowWindow(SW_SHOW);
.//IDC_frame图像控件ID,我想让图像显示几秒种,在将它隐藏起来,如何实现
.
GetDlgItem(IDC_frame)->ShowWindow(SW_HIDE);
.
.
}
void CSQUEEZERGAMEDLG::OnBUTTONnocard()
{
while(m_computercardtime<3 && ComputerPlayer.m_sum<6)
{
if(m_computercardtime==1)
{
i=rand()%m_array.GetSize();
GetDlgItem(IDC_frame)->ShowWindow(SW_SHOW);
SetTimer(1,2000,NULL);
ComputerPlayer.m_sum=ComputerPlayer.m_sum+((CCARDBITMAP*)(m_array.GetAt(i)))->m_scoring;
ComputerPlayer.m_bitmap[1].m_hObject=((CCARDBITMAP*)(m_array.GetAt(i)))->m_cardbitmap;
m_array.RemoveAt(i,1);
m_computercard2.SetBitmap(m_bitmap);
}
if(ComputerPlayer.m_sum>=6 && ComputerPlayer.m_sum<10.5)
break;
if(m_computercardtime==2)
{
i=rand()%m_array.GetSize();
GetDlgItem(IDC_frame1)->ShowWindow(SW_SHOW);
SetTimer(2,2000,NULL);
ComputerPlayer.m_sum=ComputerPlayer.m_sum+((CCARDBITMAP*)(m_array.GetAt(i)))->m_scoring;
ComputerPlayer.m_bitmap[2].m_hObject=((CCARDBITMAP*)(m_array.GetAt(i)))->m_cardbitmap;
m_array.RemoveAt(i,1);
m_computercard3.SetBitmap(m_bitmap);
}
}
.
.
}
void CSQUEEZERGAMEDLG::OnTimer(UINT nIDEvent)
{
// TODO: Add your message handler code here and/or call default
if(nIDEvent==1)
{
GetDlgItem(IDC_frame)->ShowWindow(SW_HIDE);
}
if(nIDEvent==2)
{
GetDlgItem(IDC_frame1)->ShowWindow(SW_HIDE);
}
KillTimer(nIDEvent);
CDialog::OnTimer(nIDEvent);
}
用OnTimer()我试过了,还是达不到我的要求,我用图像的显示来模似电脑的说话,当说话时,显示图像几秒,不执行其他的代码.有时候,条件成立,给出要显示的图像,在程序执行完成的时候,才全部显示出来. 可能是人太笨了,解决不了,版式主在指点一下.