• 大小: 1.22MB
    文件类型: .rar
    金币: 1
    下载: 0 次
    发布日期: 2023-11-05
  • 语言: C/C++
  • 标签: 大众类  

资源简介

一个MFC编写的多人视频聊天程序源代码,可以供相关同学初步学习MFC

资源截图

代码片段和文件信息

// AdvButton.cpp : implementation file
//

#include “stdafx.h“
#include “instantmessaging.h“
#include “AdvButton.h“

#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif

#define NORMAL 1 /// 处于正常状态
#define HOVER 2 /// 处于焦点状态
#define DOWN 3 /// 处于按下状态
#define DISABLE 4 /// 处于无效状态

#define TRANSPARENTCOLOR RGB( 255 0 255 ) /// 定义透明位图的RGB值

#pragma comment( lib “C:\\Program Files\\Microsoft Visual Studio\\VC98\\Lib\\MSIMG32.LIB“ )

/////////////////////////////////////////////////////////////////////////////
// CAdvButton

static BOOL bTrackLeave = FALSE;

CAdvButton::CAdvButton()
{
m_nState = NORMAL;
}

CAdvButton::~CAdvButton()
{
DeleteBmp();
}


BEGIN_MESSAGE_MAP(CAdvButton CButton)
//{{AFX_MSG_MAP(CAdvButton)
ON_WM_MOUSEMOVE()
ON_WM_LBUTTONDOWN()
ON_WM_LBUTTONUP()
ON_MESSAGE( WM_MOUSELEAVE onmouseleave )
//}}AFX_MSG_MAP
END_MESSAGE_MAP()

/////////////////////////////////////////////////////////////////////////////
// CAdvButton message handlers

void CAdvButton::PreSubclassWindow() 
{
Modifystyle( 0 BS_OWNERDRAW );
CButton::PreSubclassWindow();

m_pToolTipCtrl.Create( this TTS_ALWAYSTIP );
m_pToolTipCtrl.SetDelayTime( 100 );
CString strText;
GetWindowText( strText );
m_pToolTipCtrl.AddTool( this strText ); 
}

void CAdvButton::onmousemove(UINT nFlags CPoint point) 
{
if( !bTrackLeave )
{
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof( TRACKMOUSEEVENT );
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE;
::_TrackMouseEvent( &tme );
bTrackLeave = TRUE;
m_nState = HOVER;
Invalidate();
}
CButton::onmousemove(nFlags point);
}

void CAdvButton::onmouseleave( WPARAM wParam LPARAM lParam )
{
bTrackLeave = FALSE;
m_nState = NORMAL;
Invalidate();
}

void CAdvButton::OnLButtonDown(UINT nFlags CPoint point) 
{
m_nState = DOWN;
Invalidate();
CButton::OnLButtonDown(nFlags point);
}

void CAdvButton::OnLButtonUp(UINT nFlags CPoint point) 
{
m_nState = HOVER;
Invalidate();
CButton::OnLButtonUp(nFlags point);
}

void CAdvButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct) 
{
if( lpDrawItemStruct->itemState & ODS_DISABLED )
{
m_nState = DISABLE;
}

switch( m_nState )
{
case NORMAL:
DrawNORMAL();
break;
case HOVER:
DrawHOVER();
break;
case DOWN:
DrawDOWN();
break;
case DISABLE:
DrawDISABLE();
break;
default:
break;
}
}

void CAdvButton::DrawNORMAL()
{
CDC *pDC = GetDC();
BITMAP bmp;
if( !m_bmpNormal.m_hobject )
{
return;
}
m_bmpNormal.GetBitmap( &bmp );
SetWindowPos( NULL 0 0 bmp.bmWidth bmp.bmHeight SWP_NOMOVE | SWP_NOZORDER);
CDC dcMem;
dcMem.CreateCompatibleDC( pDC );
CBitmap *pOldBmp;
pOldBmp = dcMem.Selectobject( &m_bmpNormal );
pOldBmp->Deleteobject();

TransparentBlt( pDC->m_hDC 0 0 bmp.bmWidth bmp.bmHeight 
dcMem.m_hDC 0 0 bmp

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

     文件       5799  2011-02-08 00:23  InstantMessaging\AdvButton.cpp

     文件       2098  2011-02-08 00:15  InstantMessaging\AdvButton.h

     文件        708  2011-01-30 11:51  InstantMessaging\AdvComboBox.cpp

     文件       1176  2011-01-30 11:51  InstantMessaging\AdvComboBox.h

     文件      10660  2011-02-27 17:57  InstantMessaging\CanvasStatic.cpp

     文件       2546  2011-02-20 18:32  InstantMessaging\CanvasStatic.h

     文件       5798  2011-02-28 21:39  InstantMessaging\ChatDlg.cpp

     文件       1979  2011-02-14 10:17  InstantMessaging\ChatDlg.h

     文件      13135  2011-02-27 16:22  InstantMessaging\ChatRoomClientDlg.cpp

     文件       2582  2011-02-27 16:20  InstantMessaging\ChatRoomClientDlg.h

     文件       1100  2011-02-09 23:46  InstantMessaging\ChatRoomClientSocket.cpp

     文件       1477  2011-02-09 23:45  InstantMessaging\ChatRoomClientSocket.h

     文件      17636  2011-02-27 15:25  InstantMessaging\ChatRoomServerDlg.cpp

     文件       2698  2011-02-27 15:14  InstantMessaging\ChatRoomServerDlg.h

     文件       1100  2011-02-09 22:31  InstantMessaging\ChatRoomServerSocket.cpp

     文件       1477  2011-02-09 22:29  InstantMessaging\ChatRoomServerSocket.h

     文件        785  2011-02-25 23:22  InstantMessaging\Debug.cpp

     文件        567  2011-02-23 23:32  InstantMessaging\Debug.h

     文件       3187  2011-05-12 16:34  InstantMessaging\DialogSetting.cpp

     文件       1619  2011-02-15 21:27  InstantMessaging\DialogSetting.h

     文件       2098  2011-02-12 19:09  InstantMessaging\font.cpp

     文件       1461  2011-02-12 19:09  InstantMessaging\font.h

     文件       9886  2011-03-02 15:08  InstantMessaging\FriendsListCtrl.cpp

     文件       2153  2011-02-28 15:38  InstantMessaging\FriendsListCtrl.h

     文件       9233  2011-03-04 22:27  InstantMessaging\Global.h

     文件     398972  2011-02-28 21:21  InstantMessaging\InstantMessaging.aps

     文件      13188  2011-05-13 08:25  InstantMessaging\InstantMessaging.clw

     文件       2209  2011-02-28 16:42  InstantMessaging\InstantMessaging.cpp

     文件      24210  2011-03-02 15:13  InstantMessaging\InstantMessaging.dsp

     文件        584  2011-02-12 19:09  InstantMessaging\InstantMessaging.dsw

............此处省略262个文件信息

评论

共有 条评论

相关资源