Example #1
0
void SProgress::OnPaint(IRenderTarget *pRT)
{
    SPainter painter;

    BeforePaint(pRT, painter);

    SASSERT(m_pSkinBg && m_pSkinPos);
    
    CRect rcClient;
    GetClientRect(&rcClient);
    m_pSkinBg->Draw(pRT, rcClient, WndState_Normal);
    CRect rcValue=rcClient;

    if(IsVertical())
    {
        rcValue.bottom=rcValue.top+(int)(((__int64)rcValue.Height())*(m_nValue-m_nMinValue)/(__int64)(m_nMaxValue-m_nMinValue));
    }
    else
    {
        rcValue.right=rcValue.left+(int)(((__int64)rcValue.Width())*(m_nValue-m_nMinValue)/(__int64)(m_nMaxValue-m_nMinValue));
    }
    if(m_nValue>m_nMinValue)
    {
        m_pSkinPos->Draw(pRT, rcValue, WndState_Normal);
    }


    if (m_bShowPercent && !IsVertical())
    {
        SStringT strPercent;
        strPercent.Format(_T("%d%%"), (int)((m_nValue-m_nMinValue) * 100/(m_nMaxValue-m_nMinValue)));
        pRT->DrawText(strPercent, strPercent.GetLength(), GetWindowRect(), DT_SINGLELINE | DT_CENTER | DT_VCENTER);
    }
    AfterPaint(pRT, painter);
}
Example #2
0
void CMainDlg::OnListBoxExEvent( EventArgs *pEvt )
{
    EventOfPanel *pEvtOfPanel = (EventOfPanel*)pEvt;
    if(pEvtOfPanel->pOrgEvt->GetID() == EventCmd::EventID
            && pEvtOfPanel->pOrgEvt->sender->IsClass(SButton::GetClassName()))
    {
        int iItem = pEvtOfPanel->pPanel->GetItemIndex();
        SStringT strMsg;
        strMsg.Format(_T("收到列表项:%d中的name为%s的窗口点击事件"),iItem,S_CW2T(pEvtOfPanel->pOrgEvt->nameFrom));
        SMessageBox(m_hWnd,strMsg,_T("EVENTOFPANEL"),MB_OK|MB_ICONEXCLAMATION);
    }
}
Example #3
0
void CMainDlg::OnTreeBoxEvent( EventArgs *pEvt )
{
    EventOfPanel *pEvtOfPanel = (EventOfPanel*)pEvt;
    if(pEvtOfPanel->pOrgEvt->GetID() == EventCmd::EventID
            && pEvtOfPanel->pOrgEvt->sender->IsClass(SButton::GetClassName()))
    {
        HSTREEITEM hItem = (HSTREEITEM)pEvtOfPanel->pPanel->GetItemIndex();
        SStringT strMsg;
        strMsg.Format(_T("收到treebox item:0x%08x中的name为%s的窗口点击事件"),hItem,S_CW2T(pEvtOfPanel->pOrgEvt->nameFrom));
        SMessageBox(m_hWnd,strMsg,_T("EVENTOFPANEL"),MB_OK|MB_ICONEXCLAMATION);
    }

    if(pEvtOfPanel->pOrgEvt->GetID() >= EVT_ITEMPANEL_CLICK && pEvtOfPanel->pOrgEvt->GetID() <= EVT_ITEMPANEL_RCLICK)
    {
        HSTREEITEM hItem = (HSTREEITEM)pEvtOfPanel->pPanel->GetItemIndex();
        STRACE(_T("OnTreeBoxEvent: EVT_ITEMPANEL_X, itemid=0x%08x,evtid=%d"),hItem,pEvtOfPanel->pOrgEvt->GetID());
    }
}
Example #4
0
	SStringT CAccelerator::GetKeyName( WORD vk )
    {
        SStringT str;
        switch(vk)
        {
        case VK_ESCAPE:
            str=_T("ESC");
            break;
        case VK_RETURN:
            str=_T("Enter");
            break;
        case VK_UP:
            str=_T("Up");
            break;
        case VK_DOWN:
            str=_T("Down");
            break;
        case VK_LEFT:
            str=_T("Left");
            break;
        case VK_RIGHT:
            str=_T("Right");
            break;
        case VK_HOME:
            str=_T("Home");
            break;
        case VK_END:
            str=_T("End");
            break;
        case VK_PRIOR:
            str=_T("PageUp");
            break;
        case VK_NEXT:
            str=_T("PageDown");
            break;
        case VK_INSERT:
            str=_T("Insert");
            break;
		case VK_SPACE:
			str = _T("Space");
			break;
		case VK_DELETE:
			str = _T("Delete");
			break;
		case VK_PRINT:
			str = _T("Print");
			break;
		default:
            if((vk>='0' && vk<='9')||(vk>='A' && vk<='Z'))
                str=(TCHAR)vk;
            else if(vk>=VK_NUMPAD0 && vk<=VK_NUMPAD9)
                str.Format(_T("Num %d"),vk-VK_NUMPAD0);
            else if(vk==VK_MULTIPLY)
                str=_T("Num *");
            else if(vk==VK_ADD)
                str=_T("Num +");            
            else if(vk==VK_DECIMAL)
                str=_T("Num Del");            
            else if(vk>=VK_F1 && vk<=VK_F12)
                str.Format(_T("F%d"),vk-VK_F1+1);
            else
            {
                char c=MapVirtualKeyA(vk,2);
                switch(c)
                {
                case '-':
                case '=':
                case '[':
                case ']':
                case '\\':
                case ';':
                case '\'':
                case ',':
                case '.':
                case '/':
                case '`':
                    str+=TCHAR(c);
                    break;
                }
            }
            break;
        }
        return str;
    }