📄 myselectbox.cpp
字号:
// MySelectBox.cpp: implementation of the CMySelectBox class.
//
//////////////////////////////////////////////////////////////////////
#include "stdafx.h"
#include "front.h"
#include "MySelectBox.h"
#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif
//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////
CMySelectBox::CMySelectBox()
{
}
CMySelectBox::~CMySelectBox()
{
delete list;
}
void CMySelectBox::draw(CDC *pDC)
{
if(bVisible)list->draw(pDC);
}
CMySelectBox::CMySelectBox(CWnd *parent,UINT id)
{
bVisible=false;
pParentWnd=parent;
list=new CMyList(pParentWnd,id,true);
list->bAnimate=true;
list->iFlag=-2; //文字条底色闪
}
void CMySelectBox::SetListRect()
{
int hight,itemsall=list->arItems.GetSize();
if(itemsall<4)
hight=itemsall*list->iGap;
else
hight=4*list->iGap;
list->setPos(CRect(label->LabelRect.left,label->LabelRect.bottom,label->LabelRect.right,label->LabelRect.bottom+hight));
SelectRect.SetRect(label->LabelRect.left,label->LabelRect.top,label->LabelRect.right,list->ListRect.bottom);
}
void CMySelectBox::OnRButtonDown(CPoint point)
{
bVisible=false;
list->bEnable=false;
}
void CMySelectBox::OnLButtonDown(CPoint point)
{
if(!list->UpButton->LabelRect.PtInRect(point)&&!list->DownButton->LabelRect.PtInRect(point))
if(list->ListRect.PtInRect(point))
{
list->OnLButtonDown(point);
list->OnLButtonUp(point);//因为按钮是弹起时才发消息
}
bVisible=false;
if(list->UpButton->LabelRect.PtInRect(point)||list->DownButton->LabelRect.PtInRect(point))
{
list->OnLButtonDown(point);
bVisible=true;
list->bEnable=true;
}
else list->bEnable=false;
}
void CMySelectBox::OnLButtonUp(CPoint point)
{
list->OnLButtonUp(point);
}
void CMySelectBox::OnMouseMove(CPoint point)
{
list->OnMouseMove(point);
}
void CMySelectBox::OutRect()
{
bVisible=false;
list->bEnable=false;
}
void CMySelectBox::OnTimer()
{
list->OnTimer();
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -