void wxOwnerDrawnComboBox::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text; if ( !ShouldUseHintText() ) { text = GetValue(); } else { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } dc.DrawText( text, rect.x + GetMargins().x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2, rect.y ); } }
void ODIconCombo::OnDrawItem( wxDC& dc, const wxRect& rect, int item, int flags ) const { int offset_x = bmpArray.Item(item).GetWidth(); int bmpHeight = bmpArray.Item(item).GetHeight(); dc.DrawBitmap(bmpArray.Item(item), rect.x, rect.y + (rect.height - bmpHeight)/2, true); if ( flags & wxODCB_PAINTING_CONTROL ) { wxString text = GetValue(); int margin_x = 2; #if wxCHECK_VERSION(2, 9, 0) if ( ShouldUseHintText() ) { text = GetHint(); wxColour col = wxSystemSettings::GetColour(wxSYS_COLOUR_GRAYTEXT); dc.SetTextForeground(col); } margin_x = GetMargins().x; #endif dc.DrawText( text, rect.x + margin_x + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } else { dc.DrawText( GetVListBoxComboPopup()->GetString(item), rect.x + 2 + offset_x, (rect.height-dc.GetCharHeight())/2 + rect.y ); } }
int Transaction::ReqOrderInsert(AirTradeFtdcInputOrderField* pInputOrder, int nRequestID) { // 尝试获取资金信息,发送Ctrl+C m_stockTreeView.ClickItem(TEXT("中签")); // 需要先切换到不常用的界面然后再点需要的界面才工作正常 m_stockTreeView.ClickItem(TEXT("资金股票")); RefreshDialogsAndControls(); m_sendKeys.Send("^C", m_controls[CONTROL_CHAXUN_ZJGP]); // 加载买入股票界面 m_stockTreeView.ClickItem(TEXT("中签")); m_stockTreeView.ClickItem(TEXT("买入[F1]")); RefreshDialogsAndControls(); // 填写买入信息 ::PostMessage(m_controls[CONTROL_MAIRU_DAIMA], EM_SETSEL, 0, -1); m_sendKeys.Send("000793", m_controls[CONTROL_MAIRU_DAIMA]); ::PostMessage(m_controls[CONTROL_MAIRU_JIAGE], EM_SETSEL, 0, -1); m_sendKeys.Send("9.99", m_controls[CONTROL_MAIRU_JIAGE]); ::PostMessage(m_controls[CONTROL_MAIRU_SHULIANG], EM_SETSEL, 0, -1); m_sendKeys.Send("20000", m_controls[CONTROL_MAIRU_SHULIANG]); // 执行买入操作 m_sendKeys.Send("B", m_controls[CONTROL_MAIRU_DAIMA]); // 确认买入操作 ConfirmDialog(true); // 获取提示信息 GetHint(); return 0; }
void CXTPReportFilterEditControl::OnPaint() { if (GetWindowTextLength() == 0 && ::GetFocus() != m_hWnd) { CPaintDC dc(this); // device context for painting CXTPFontDC autoFont(&dc, GetFont(), GetXtremeColor(COLOR_GRAYTEXT)); // show hint text CString strText = GetHint(); CRect rc; GetClientRect(&rc); dc.FillSolidRect(rc, GetXtremeColor(COLOR_WINDOW)); CRect rcText; GetRect(&rcText); dc.DrawText(strText, rcText, DT_SINGLELINE | DT_VCENTER | DT_NOPREFIX | DT_EDITCONTROL); } else { Default(); } }
LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static HBITMAP hBitmap; static BYTE oldpai = (BYTE)-1; static BYTE oldx; static BYTE oldy; static BYTE autoiti1, autoiti2; static BYTE zansuu; switch (msg) { case WM_COMMAND: switch (LOWORD(wParam)) { case ID_HINT: if (zansuu) { iti2pai[autoiti1] += 72; iti2pai[autoiti2] += 72; InvalidateRect(hWnd, 0, 0); UpdateWindow(hWnd); if2Space(autoiti1, autoiti2, 1); for (int i = 0; i<4; ++i) { if (pai2iti[4 * (iti2pai[autoiti1] - 72) + i] == autoiti1) { pai2iti[4 * (iti2pai[autoiti1] - 72) + i] = 0; } if (pai2iti[4 * (iti2pai[autoiti1] - 72) + i] == autoiti2) { pai2iti[4 * (iti2pai[autoiti1] - 72) + i] = 0; } } iti2pai[autoiti1] = (BYTE)-1; iti2pai[autoiti2] = (BYTE)-1; --zansuu; if (!zansuu){ g_hHook = SetWindowsHookEx( WH_CBT, CBTProc, 0, GetCurrentThreadId() ); MessageBox( hWnd, TEXT("完了。"), TEXT("四川省"), 0); } else if (!GetHint(&autoiti1, &autoiti2)) { zansuu = 0; g_hHook = SetWindowsHookEx( WH_CBT, CBTProc, 0, GetCurrentThreadId() ); MessageBox( hWnd, TEXT("手詰まりです。"), TEXT("四川省"), 0); } } break; case ID_NEWGAME: { int i, j = 0; for (i = 0; i<MAX_KOMASUU; ++i) { if (i<X_NUM || i>X_NUM*(Y_NUM - 1) || i%X_NUM == 0 || i%X_NUM == X_NUM - 1) { iti2pai[i] = (BYTE)-1; continue; } iti2pai[i] = j / 4; pai2iti[j] = i; j++; } for (i = 0; i<MAX_KOMASUU; ++i) { if (i<X_NUM || i>X_NUM*(Y_NUM - 1) || i%X_NUM == 0 || i%X_NUM == X_NUM - 1) continue; do{ j = rand() % MAX_KOMASUU; } while (j<X_NUM || j>X_NUM*(Y_NUM - 1) || j%X_NUM == 0 || j%X_NUM == X_NUM - 1); koukan(i, j); } zansuu = 72; if (!GetHint(&autoiti1, &autoiti2)) { zansuu = 0; g_hHook = SetWindowsHookEx( WH_CBT, CBTProc, 0, GetCurrentThreadId() ); MessageBox( hWnd, TEXT("手詰まりです。"), TEXT("四川省"), 0); } InvalidateRect(hWnd, 0, 0); } break; } break; case WM_LBUTTONDOWN: if (zansuu) { InvalidateRect(hWnd, NULL, 0); UpdateWindow(hWnd); RECT rect; int xPos = GET_X_LPARAM(lParam) / PAI_WIDTH; int yPos = GET_Y_LPARAM(lParam) / PAI_HEIGHT; if (iti2pai[xPos%X_NUM + yPos*X_NUM] == (BYTE)-1) break;//空白をクリックしても何も起こらない if (oldpai == (BYTE)-1) { iti2pai[xPos%X_NUM + yPos*X_NUM] += 72; SetRect( &rect, PAI_WIDTH*xPos, PAI_HEIGHT*yPos, PAI_WIDTH + PAI_WIDTH*xPos, PAI_HEIGHT + PAI_HEIGHT*yPos ); InvalidateRect(hWnd, &rect, 0); oldpai = iti2pai[xPos%X_NUM + yPos*X_NUM]; oldx = xPos; oldy = yPos; } else { if (xPos == oldx&&yPos == oldy)//1番目と同じ座標 { iti2pai[xPos%X_NUM + yPos*X_NUM] -= 72; SetRect( &rect, PAI_WIDTH*xPos, PAI_HEIGHT*yPos, PAI_WIDTH + PAI_WIDTH*xPos, PAI_HEIGHT + PAI_HEIGHT*yPos); InvalidateRect(hWnd, &rect, 0); } else { iti2pai[xPos%X_NUM + yPos*X_NUM] += 72; SetRect( &rect, PAI_WIDTH*xPos, PAI_HEIGHT*yPos, PAI_WIDTH + PAI_WIDTH*xPos, PAI_HEIGHT + PAI_HEIGHT*yPos); InvalidateRect(hWnd, &rect, 0); UpdateWindow(hWnd); if (oldpai == iti2pai[xPos%X_NUM + yPos*X_NUM] && if2Space( xPos%X_NUM + yPos*X_NUM, oldx%X_NUM + oldy*X_NUM, 1)) { BOOL b = FALSE; for (int i = 0; i<4; ++i) { if (pai2iti[4 * (oldpai - 72) + i] == oldx%X_NUM + oldy*X_NUM) { if (!b && (pai2iti[4 * (oldpai - 72) + i] == autoiti1 || pai2iti[4 * (oldpai - 72) + i] == autoiti2)) b = TRUE; pai2iti[4 * (oldpai - 72) + i] = 0; } if (pai2iti[4 * (oldpai - 72) + i] == xPos%X_NUM + yPos*X_NUM) { if (!b && (pai2iti[4 * (oldpai - 72) + i] == autoiti1 || pai2iti[4 * (oldpai - 72) + i] == autoiti2)) b = TRUE; pai2iti[4 * (oldpai - 72) + i] = 0; } } iti2pai[xPos%X_NUM + yPos*X_NUM] = (BYTE)-1; iti2pai[oldx%X_NUM + oldy*X_NUM] = (BYTE)-1; zansuu--; if (!zansuu){ g_hHook = SetWindowsHookEx( WH_CBT, CBTProc, 0, GetCurrentThreadId()); MessageBox( hWnd, TEXT("完了。"), TEXT("四川省"), 0); } else if (b&& !GetHint(&autoiti1, &autoiti2)) { zansuu = 0; g_hHook = SetWindowsHookEx( WH_CBT, CBTProc, 0, GetCurrentThreadId() ); MessageBox( hWnd, TEXT("手詰まりです。"), TEXT("四川省"), 0); } } else { iti2pai[xPos%X_NUM + yPos*X_NUM] -= 72; iti2pai[oldx%X_NUM + oldy*X_NUM] -= 72; SetRect( &rect, PAI_WIDTH*xPos, PAI_HEIGHT*yPos, PAI_WIDTH + PAI_WIDTH*xPos, PAI_HEIGHT + PAI_HEIGHT*yPos); InvalidateRect(hWnd, &rect, 0); SetRect( &rect, PAI_WIDTH*oldx, PAI_HEIGHT*oldy, PAI_WIDTH + PAI_WIDTH*oldx, PAI_HEIGHT + PAI_HEIGHT*oldy); InvalidateRect(hWnd, &rect, 0); } } oldpai = (BYTE)-1; } } break; case WM_TIMER: KillTimer(hWnd, 0x1234); InvalidateRect(hWnd, 0, 0); break; case WM_CREATE: srand(GetTickCount()); hBitmap = LoadBitmap( GetModuleHandle(0), MAKEINTRESOURCE(IDB_BITMAP1)); SNDMSG(hWnd, WM_COMMAND, ID_NEWGAME, 0); break; case WM_ERASEBKGND: return 1; case WM_PAINT: { PAINTSTRUCT ps; HDC hdc = BeginPaint(hWnd, &ps); HDC hdc_mem = CreateCompatibleDC(hdc); SelectObject(hdc_mem, hBitmap); for (int i = 0; i<MAX_KOMASUU; ++i) { if (iti2pai[i] == (BYTE)-1) { RECT rect; SetRect( &rect, PAI_WIDTH*(i%X_NUM), PAI_HEIGHT*(i / X_NUM), PAI_WIDTH + PAI_WIDTH*(i%X_NUM), PAI_HEIGHT + PAI_HEIGHT*(i / X_NUM)); COLORREF clrPrev = SetBkColor(hdc, RGB(0, 128, 0)); ExtTextOut(hdc, 0, 0, ETO_OPAQUE, &rect, 0, 0, 0); SetBkColor(hdc, clrPrev); } else { BitBlt( hdc, (i%X_NUM)*PAI_WIDTH, (i / X_NUM)*PAI_HEIGHT, PAI_WIDTH, PAI_HEIGHT, hdc_mem, iti2pai[i] % 72 * PAI_WIDTH, (iti2pai[i]<36) ? 0 : PAI_HEIGHT, SRCCOPY); } } DeleteDC(hdc_mem); EndPaint(hWnd, &ps); } break; case WM_DESTROY: DeleteObject(hBitmap); PostQuitMessage(0); break; default: return DefWindowProc(hWnd, msg, wParam, lParam); } return 0; }