AutoCAD 3DMAX C语言 Pro/E UG JAVA编程 PHP编程 Maya动画 Matlab应用 Android
Photoshop Word Excel flash VB编程 VC编程 Coreldraw SolidWorks A Designer Unity3D
 首页 > VC编程

Visual C++中位图按钮的新颖设计

51自学网 2015-08-30 http://www.wanshiok.com

 

pWnd= GetDlgItem(IDC_BUTTON_POWER);

pWnd->SetFocus(); 

SetCapture();

InputEdit().SetWindowText(ShowString0);

InputEdit().ShowWindow(TRUE); 

//将鼠标光标变成小手形状

MyCursor = AfxGetApp()->LoadCursor(IDC_MYCURSOR); 

::SetCursor(MyCursor);

VERIFY(m_Play.LoadBitmaps("PLAYU","PLAYD","PLAYF","PLAYX"));

m_bPressedPlay = FALSE;

return;

}

if (m_regionPlay.PtInRegion(point)) //鼠标落在位图按钮之上 



if (m_bPowerOn) { //如果电源已被开启

m_bPlay = TRUE; 

pWnd= GetDlgItem(IDC_BUTTON_PLAY);

pWnd->SetFocus(); 

SetCapture();

InputEdit().SetWindowText(ShowString0);

InputEdit().ShowWindow(TRUE);

MyCursor = AfxGetApp()->LoadCursor(IDC_MYCURSOR);

::SetCursor(MyCursor); 

VERIFY(m_Power.LoadBitmaps("POWERONU","POWEROND","POWERONF"));

}

else { //如果电源已被关闭

ReleaseCapture();

InputEdit().SetWindowText(ShowString0+ShowString2);

InputEdit().ShowWindow(TRUE); 

VERIFY(m_Power.LoadBitmaps("POWEROFU","POWEROFD","POWEROFF"));



m_bPressedPower= FALSE;

return;

}

//鼠标落在所有的位图按钮之外 

ReleaseCapture();

InputEdit().SetWindowText(ShowString1);

InputEdit().ShowWindow(TRUE); 

pWnd= GetDlgItem(IDOK);

pWnd->SetFocus(); 

VERIFY(m_Play.LoadBitmaps("PLAYU","PLAYD","PLAYF","PLAYX"));

if (m_bPowerOn)

VERIFY(m_Power.LoadBitmaps("POWERONU","POWEROND","POWERONF"));

else

VERIFY(m_Power.LoadBitmaps("POWEROFU","POWEROFD","POWEROFF"));

m_bPressedPlay = FALSE;

m_bPressedPower= FALSE;

CDialog::OnMouseMove(nFlags, point);

}

void CBmpDlg::OnLButtonDown(UINT nFlags, CPoint point)

{

CWnd *pWnd;

if (m_bPlay && m_bPowerOn) { 

// Change Focus so as to Change the bitmap of m_Play

pWnd= GetDlgItem(IDOK);

pWnd->SetFocus(); 

VERIFY(m_Play.LoadBitmaps("PLAYD"));

m_Play.UpdateWindow();

m_Play.Invalidate(TRUE);

OnButtonPlay(); 

m_bPressedPlay = TRUE;



if (m_bPower== TRUE) { 

// Change Focus so as to Change the bitmap of m_Power

pWnd= GetDlgItem(IDOK);

pWnd->SetFocus(); 

if (m_bPowerOn)

VERIFY(m_Power.LoadBitmaps("POWEROND"));

else

VERIFY(m_Power.LoadBitmaps("POWEROFD")); 

m_Power.UpdateWindow();

m_Power.Invalidate(TRUE);

OnButtonPower(); 

m_bPressedPower = TRUE;



CDialog::OnLButtonDown(nFlags, point);

}

 

void CBmpDlg::OnLButtonUp(UINT nFlags, CPoint point)

{

CWnd * pWnd; 

if (m_bPressedPlay == TRUE) {

pWnd= GetDlgItem(IDOK);

pWnd->SetFocus(); 

VERIFY(m_Play.LoadBitmaps("PLAYF"));

m_Play.UpdateWindow();

m_Play.Invalidate(TRUE);

m_bPressedPlay = FALSE;



if (m_bPressedPower == TRUE) {

pWnd= GetDlgItem(IDOK);

pWnd->SetFocus(); 

if (m_bPowerOn)

VERIFY(m_Power.LoadBitmaps("POWERONF"));

else

VERIFY(m_Power.LoadBitmaps("POWEROFF")); 

m_Power.UpdateWindow();

m_Power.Invalidate(TRUE);

m_bPressedPower = FALSE;



CDialog::OnLButtonUp(nFlags, point);

}

 
 
说明
:本教程来源互联网或网友上传或出版商,仅为学习研究或媒体推广,wanshiok.com不保证资料的完整性。

上一篇:为CListBox加上智能水平滚动条  下一篇:在VC中怎样实现软件的注册机制