LineCtrl.cpp
资源名称:视频会议系统.rar [点击查看]
上传用户:popouu88
上传日期:2013-02-11
资源大小:2894k
文件大小:2k
源码类别:
IP电话/视频会议
开发平台:
Visual C++
- // LineCtrl.cpp : implementation file
- //
- #include "stdafx.h"
- #include "LineCtrl.h"
- #ifdef _DEBUG
- #define new DEBUG_NEW
- #undef THIS_FILE
- static char THIS_FILE[] = __FILE__;
- #endif
- /////////////////////////////////////////////////////////////////////////////
- // CLineCtrl
- CLineCtrl::CLineCtrl()
- {
- this->select = 0;
- }
- CLineCtrl::~CLineCtrl()
- {
- }
- BEGIN_MESSAGE_MAP(CLineCtrl, CStatic)
- //{{AFX_MSG_MAP(CLineCtrl)
- ON_WM_PAINT()
- ON_WM_LBUTTONDOWN()
- //}}AFX_MSG_MAP
- END_MESSAGE_MAP()
- /////////////////////////////////////////////////////////////////////////////
- // CLineCtrl message handlers
- void CLineCtrl::PreSubclassWindow()
- {
- CStatic::PreSubclassWindow( );
- CRect rect;
- this->GetClientRect( &rect );
- int h = rect.Height( ) / 4;
- for( int i = 0; i < 4; i ++ )
- {
- this->rc[ i ].left = rect.left;
- this->rc[ i ].right = rect.right;
- this->rc[ i ].top = i * h;
- this->rc[ i ].bottom = ( i + 1 ) * h;
- }
- }
- void CLineCtrl::SetWidth( int width )
- {
- this->select = width / 2 - 1;
- this->Invalidate( );
- }
- void CLineCtrl::OnPaint()
- {
- CPaintDC dc( this );
- CRect rect;
- this->GetClientRect( &rect );
- dc.FillSolidRect( &rect , RGB( 214 , 239 , 255 ) );
- for( int i = 0; i < 4; i ++ )
- {
- rect = this->rc[ i ];
- rect.top = this->rc[ i ].top + this->rc[ i ].Height( ) / 2 - ( i + 1 );
- rect.bottom = this->rc[ i ].top + this->rc[ i ].Height( ) / 2 + ( i + 1 );
- if( this->select == i )
- dc.FillSolidRect( &this->rc[ i ] , RGB( 255 , 255 , 255 ) );
- dc.FillSolidRect( &rect , RGB( 0 , 0 , 0 ) );
- }
- }
- void CLineCtrl::OnLButtonDown(UINT nFlags, CPoint point)
- {
- this->select = 0;
- for( int i = 0; i < 4; i ++ )
- {
- if( this->rc[ i ].PtInRect( point ) )
- {
- this->select = i ;
- this->Invalidate( );
- break;
- }
- }
- CStatic::OnLButtonDown( nFlags, point );
- }