本文整理汇总了C++中DrawIcon函数的典型用法代码示例。如果您正苦于以下问题:C++ DrawIcon函数的具体用法?C++ DrawIcon怎么用?C++ DrawIcon使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DrawIcon函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _ns_subsample_dialog_draw_icons
void _ns_subsample_dialog_draw_icons( NsSubsampleDialog *ssd )
{
HWND wnd;
HDC dc;
RECT rc;
wnd = GetDlgItem( ssd->dlg, IDS_SUB_LOCK_XY );
dc = GetDC( wnd );
GetClientRect( wnd, &rc );
if( ____ns_ssd_curr_fixed_all || ____ns_ssd_curr_fixed_width_height )
DrawIcon( dc, 0, 0, LoadIcon( ssd->instance, "LOCK_ICON" ) );
else
FillRect( dc, &rc, ( HBRUSH )( COLOR_3DFACE + 1 ) );
ReleaseDC( wnd, dc );
wnd = GetDlgItem( ssd->dlg, IDS_SUB_LOCK_YZ );
dc = GetDC( wnd );
GetClientRect( wnd, &rc );
if( ____ns_ssd_curr_fixed_all )
DrawIcon( dc, 0, 0, LoadIcon( ssd->instance, "LOCK_ICON" ) );
else
FillRect( dc, &rc, ( HBRUSH )( COLOR_3DFACE + 1 ) );
ReleaseDC( wnd, dc );
}
示例2: DrawiconWinProc
static int DrawiconWinProc(HWND hWnd, int message, WPARAM wParam, LPARAM lParam)
{
static HICON myicon_small, myicon_large;
HDC hdc;
switch (message) {
case MSG_CREATE:
myicon_small = LoadIconFromFile(HDC_SCREEN, "myicon.ico", 0);
if (myicon_small == 0)
fprintf (stderr, "Load icon file failure!");
myicon_large = LoadIconFromFile(HDC_SCREEN, "myicon.ico", 1);
if (myicon_large == 0)
fprintf (stderr, "Load icon file failure!");
break;
case MSG_PAINT:
hdc = BeginPaint(hWnd);
if (myicon_small != 0)
DrawIcon(hdc, 10, 10, 0, 0, myicon_small);
if (myicon_large != 0)
DrawIcon(hdc, 60, 60, 0, 0, myicon_large);
EndPaint(hWnd, hdc);
return 0;
case MSG_CLOSE:
DestroyIcon(myicon_small);
DestroyIcon(myicon_large);
DestroyMainWindow (hWnd);
PostQuitMessage (hWnd);
return 0;
}
return DefaultMainWinProc(hWnd, message, wParam, lParam);
}
示例3: main
void main() {
int x0, y0;
int i = 0, j = 0;
int receive_block;
int image_to_draw;
receive_block = -1;
USBIP0_bit = 1;
USBIP1_bit = 1;
USBIP2_bit = 1;
USBIE_bit = 1;
EnableInterrupts();
Start_TP();
TFT_Fill_Screen(CL_WHITE);
TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);
ClearBuffer(ReadBuffer, USB_LENGTH);
ClearBuffer(WriteBuffer, USB_LENGTH);
HID_Enable(ReadBuffer, &WriteBuffer);
for(i=0; i<2; i++) {
for(j=0; j<4; j++) {
DrawIcon(j, i);
}
}
while (1) {
Check_TP();
if (HID_Read()) {
ClearBuffer(WriteBuffer, USB_LENGTH);
if (strstr(ReadBuffer, "AT+SEND_IMAGE")) {
strcpy(WriteBuffer, "READY");
HID_Write(WriteBuffer,USB_LENGTH);
receive_block = 0;
}
else if ((receive_block>=0)&&(receive_block<2048)) {
memcpy((char *)Image_icon+receive_block, ReadBuffer, USB_LENGTH);
strcpy(WriteBuffer, "OK");
HID_Write(WriteBuffer,USB_LENGTH);
receive_block+=USB_LENGTH;
}
else if (strstr(&ReadBuffer, "AT+DRAW_IMAGE=")) {
image_to_draw = ReadBuffer[strlen("AT+DRAW_IMAGE=")]-'0';
DrawIcon(image_to_draw%4, image_to_draw/4);
strcpy(WriteBuffer, "OK");
HID_Write(WriteBuffer,USB_LENGTH);
}
}
ClearBuffer(&ReadBuffer, USB_LENGTH);
if(receive_block > 2048-USB_LENGTH) receive_block = -1;
}
}
示例4: DrawIcon
void DemoState::DrawIcons() {
for (size_t i = 0; i < channel_icons_.size(); ++i) {
DrawIcon(channel_icons_[i], channel_texture_);
}
for (size_t i = 0; i < listener_icons_.size(); ++i) {
DrawIcon(listener_icons_[i], listener_texture_);
}
}
示例5: CreateMaterial
//-----------------------------------------------------------------------------
// Purpose:
// Input : pDC -
// dstRect -
// detectErrors -
//-----------------------------------------------------------------------------
void CMaterial::DrawBrowserIcons( CDC *pDC, RECT& dstRect, bool detectErrors )
{
static CMaterial* pTranslucentIcon = 0;
static CMaterial* pOpaqueIcon = 0;
static CMaterial* pSelfIllumIcon = 0;
static CMaterial* pBaseAlphaEnvMapMaskIcon = 0;
static CMaterial* pErrorIcon = 0;
if (!pTranslucentIcon)
{
pTranslucentIcon = CreateMaterial("editor/translucenticon", true);
pOpaqueIcon = CreateMaterial("editor/opaqueicon", true);
pSelfIllumIcon = CreateMaterial("editor/selfillumicon", true);
pBaseAlphaEnvMapMaskIcon = CreateMaterial("editor/basealphaenvmapmaskicon", true);
pErrorIcon = CreateMaterial("editor/erroricon", true);
Assert( pTranslucentIcon && pOpaqueIcon && pSelfIllumIcon && pBaseAlphaEnvMapMaskIcon && pErrorIcon );
}
bool error = false;
IMaterial* pMaterial = GetMaterial();
if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_TRANSLUCENT ) )
{
DrawIcon( pDC, pTranslucentIcon, dstRect );
if (detectErrors)
{
error = error || !m_TranslucentBaseTexture;
}
}
else
{
DrawIcon( pDC, pOpaqueIcon, dstRect );
}
if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_SELFILLUM ))
{
DrawIcon( pDC, pSelfIllumIcon, dstRect );
if (detectErrors)
{
error = error || !m_TranslucentBaseTexture;
}
}
if ( pMaterial->GetMaterialVarFlag( MATERIAL_VAR_BASEALPHAENVMAPMASK ))
{
DrawIcon( pDC, pBaseAlphaEnvMapMaskIcon, dstRect );
if (detectErrors)
{
error = error || !m_TranslucentBaseTexture;
}
}
if (error)
{
DrawIcon( pDC, pErrorIcon, dstRect );
}
}
示例6: DrawShadow
void CImage::Draw()
{
Math::Point uv1,uv2, corner, pos, dim;
float dp;
if ( (m_state & STATE_VISIBLE) == 0 ) return;
if ( m_state & STATE_SHADOW )
{
DrawShadow(m_pos, m_dim);
}
dp = 0.5f/256.0f;
if ( m_icon == 0 ) // hollow frame?
{
m_engine->SetTexture("button2.png");
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
uv1.x = 160.0f / 256.0f;
uv1.y = 192.0f / 256.0f; // u-v texture
uv2.x = 192.0f / 256.0f;
uv2.y = 224.0f / 256.0f;
uv1.x += dp;
uv1.y += dp;
uv2.x -= dp;
uv2.y -= dp;
corner.x = 10.0f / 640.0f;
corner.y = 10.0f / 480.0f;
DrawIcon(m_pos, m_dim, uv1, uv2, corner, 8.0f/256.0f);
}
if ( m_filename[0] != 0 ) // displays an image?
{
m_engine->LoadTexture(m_filename);
m_engine->SetTexture(m_filename);
m_engine->SetState(Gfx::ENG_RSTATE_NORMAL);
pos = m_pos;
dim = m_dim;
pos.x += 5.0f / 640.0f;
pos.y += 5.0f / 480.0f;
dim.x -= 10.0f / 640.0f;
dim.y -= 10.0f / 480.0f;
uv1.x = 0.0f;
uv1.y = 0.0f;
uv2.x = 1.0f;
uv2.y = 1.0f;
DrawIcon(pos, dim, uv1, uv2);
}
}
示例7: OnPaint
void OnPaint(HWND hWnd)
{
HDC dialogDC;
PAINTSTRUCT paint;
RECT cRC, textRC;
int i;
HBRUSH hBrush;
HPEN hPen;
HFONT dcFont;
COLORREF cr;
int nch = GetWindowTextW(windowList[selectedWindow], windowText, 1023);
dialogDC = BeginPaint(hWnd, &paint);
{
GetClientRect(hWnd, &cRC);
FillRect(dialogDC, &cRC, GetSysColorBrush(COLOR_MENU));
for(i=0; i< windowCount; i++)
{
HICON hIcon = iconList[i];
int xpos = xOffset + 40 * (i % nCols);
int ypos = yOffset + 40 * (i / nCols);
if (selectedWindow == i)
{
hBrush = GetSysColorBrush(COLOR_HIGHLIGHT);
}
else
{
hBrush = GetSysColorBrush(COLOR_MENU);
}
#if TRUE
cr = GetSysColor(COLOR_BTNTEXT); // doesn't look right! >_<
hPen = CreatePen(PS_DOT, 1, cr);
SelectObject(dialogDC, hPen);
SelectObject(dialogDC, hBrush);
Rectangle(dialogDC, xpos-2, ypos-2, xpos+32+2, ypos+32+2);
DeleteObject(hPen);
// Must NOT destroy the system brush!
#else
RECT rc = { xpos-2, ypos-2, xpos+32+2, ypos+32+2 };
FillRect(dialogDC, &rc, hBrush);
#endif
DrawIcon(dialogDC, xpos, ypos, hIcon);
}
dcFont = SelectObject(dialogDC, dialogFont);
SetTextColor(dialogDC, GetSysColor(COLOR_BTNTEXT));
SetBkColor(dialogDC, GetSysColor(COLOR_BTNFACE));
textRC.top = itemsH;
textRC.left = 8;
textRC.right = totalW - 8;
textRC.bottom = totalH - 8;
DrawTextW(dialogDC, windowText, nch, &textRC, DT_CENTER|DT_END_ELLIPSIS);
SelectObject(dialogDC, dcFont);
}
EndPaint(hWnd, &paint);
}
示例8: WndProc
LRESULT WINAPI WndProc (HWND hWnd, UINT uMsg, WPARAM wp, LPARAM lp)
{
switch (uMsg)
{
case WM_PAINT:
PAINTSTRUCT ps;
HDC dc = BeginPaint (hWnd, &ps);
SelectObject (dc, GetStockObject (WHITE_BRUSH));
SelectObject (dc, GetStockObject (WHITE_PEN));
RECT rc;
GetClientRect (hWnd, &rc);
Rectangle (dc, rc.left, rc.top, rc.right, rc.bottom);
DrawIcon (dc, 5, 5, _Icon);
LPCSTR pszMsg = "Download was transferred to Free Download Manager...\nPlease use \"Back\" button to go back";
RECT rcT = rc;
rcT.left = 40; rcT.top = 5;
DrawText (dc, pszMsg, lstrlen (pszMsg), &rcT, DT_LEFT | DT_TOP);
EndPaint (hWnd, &ps);
return 0;
}
return DefWindowProc (hWnd, uMsg, wp, lp);
}
示例9: GetAmbientUserMode
HRESULT CDTDisplay::OnDrawAdvanced(ATL_DRAWINFO& di)
{
// TODO: Add your specialized code here and/or call the base class
BOOL bRunTime;
GetAmbientUserMode(bRunTime);
if(bRunTime)
{//Draw Picture here Display the image data in the
if(!m_DisplayImage.IsNull())
{
m_DisplayImage.Draw(di.hdcDraw,m_DrawRect,m_SrcRect);
}
}
else
{
OLE_COLOR colorOle;
GetAmbientBackColor(colorOle);
COLORREF colorRgb;
::OleTranslateColor(colorOle,0,&colorRgb);
HBRUSH hBrush;
hBrush=CreateSolidBrush(colorRgb);
RECT& rc = *(RECT*)di.prcBounds;
FillRect(di.hdcDraw,&rc,hBrush);
DeleteObject(hBrush);
SetBkMode(di.hdcDraw,TRANSPARENT);
HICON hIcon=LoadIcon(_AtlBaseModule.GetResourceInstance(),MAKEINTRESOURCE(IDI_DISPLAY));
DrawIcon(di.hdcDraw,rc.left,rc.top,hIcon);
DeleteObject(hIcon);
}
return 0;
//return __super::OnDrawAdvanced(di);
}
示例10: draw_cursor
static void draw_cursor(struct dc_capture *capture, HDC hdc)
{
HICON icon;
ICONINFO ii;
CURSORINFO *ci = &capture->ci;
if (!(capture->ci.flags & CURSOR_SHOWING))
return;
icon = CopyIcon(capture->ci.hCursor);
if (!icon)
return;
if (GetIconInfo(icon, &ii)) {
POINT pos;
pos.x = ci->ptScreenPos.x - (int)ii.xHotspot - capture->x;
pos.y = ci->ptScreenPos.y - (int)ii.yHotspot - capture->y;
DrawIcon(hdc, pos.x, pos.y, icon);
DeleteObject(ii.hbmColor);
DeleteObject(ii.hbmMask);
}
DestroyIcon(icon);
}
示例11: WndProc
LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam){
static HICON hIcon;
static int cxIcon, cyIcon, cxClient, cyClient;
HDC hdc;
HINSTANCE hInstance;
PAINTSTRUCT ps;
int x, y;
switch (message){
case WM_CREATE:
hInstance = ((LPCREATESTRUCT)lParam)->hInstance;
hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_ICON));
cxIcon = GetSystemMetrics(SM_CXICON);
cyIcon = GetSystemMetrics(SM_CYICON);
return 0;
case WM_SIZE:
cxClient = LOWORD(lParam);
cyClient = HIWORD(lParam);
return 0;
case WM_PAINT:
hdc = BeginPaint(hwnd, &ps);
for(y=0; y<cyClient; y+=cyIcon)for(x=0; x<cxClient; x+=cxIcon)
DrawIcon(hdc, x, y, hIcon);
EndPaint(hwnd, &ps);
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return 0;
}
return DefWindowProc(hwnd, message, wParam, lParam);
}
示例12: ASSERT
void
BPose::DeselectWithoutErasingBackground(BRect, BPoseView* poseView)
{
ASSERT(poseView->ViewMode() != kListMode);
ASSERT(!IsSelected());
BPoint location(Location(poseView));
// draw icon directly
if (fPercent == -1)
DrawIcon(location, poseView, poseView->IconSize(), true);
else
UpdateIcon(location, poseView);
BColumn* column = poseView->FirstColumn();
if (column == NULL)
return;
BTextWidget* widget = WidgetFor(column->AttrHash());
if (widget == NULL || !widget->IsVisible())
return;
// just invalidate the background, don't draw anything
poseView->Invalidate(widget->CalcRect(location, 0, poseView));
}
示例13: DoDrawBolt
/*
* Draws an icon at the coordinates x,y, after copying a saved bitmap back
* onto the screen at the coordinates where the last icon was drawn and
* saving the area under the icon to a DC in memory
*/
void DoDrawBolt( int x, int y, icon_mover * mover)
/************************************************/
{
/*
* to make this look fast, even on slow machines, only redraw the icon
* when the x coordinate is a multiple of the bolt speed
* thus if speed = 5, the icon will be redrawn every 5th pixel it moves
*/
if( x % mover->speed != 0 ) return;
/* if it is not the first iteration */
if( mover->last.x != -1 || mover->last.y != -1 ) {
/* redraw the area that the last icon covered */
BitBlt( mover->screen_dc, mover->last.x, mover->last.y, mover->size.x,
mover->size.y, mover->storage_dc, 0, 0, SRCCOPY);
}
/* save the area that will be under the icon to a DC in memory */
BitBlt( mover->storage_dc, 0, 0, mover->size.x, mover->size.y,
mover->screen_dc, x, y, SRCCOPY);
DrawIcon( mover->screen_dc, x, y, mover->icon );
/* save the coordinates for next time */
mover->last.x = x;
mover->last.y = y;
} /* DoDrawBolt */
示例14: DrawIcon
void CRBookmarkMenuItem::Draw( LVDrawBuf & buf, lvRect & rc, CRRectSkinRef skin, CRRectSkinRef valueSkin, bool selected )
{
_itemDirty = false;
if ( !_bookmark ) {
CRMenuItem::Draw( buf, rc, skin, valueSkin, selected );
return;
}
lvRect itemBorders = skin->getBorderWidths();
skin->draw( buf, rc );
buf.SetTextColor( 0x000000 );
buf.SetBackgroundColor( 0xFFFFFF );
int imgWidth = DrawIcon( buf, rc, itemBorders );
lvRect textRect = rc;
textRect.left += imgWidth;
lvRect posRect = textRect;
lString16 text = _bookmark->getPosText();
if ( !text.empty() ) {
posRect.bottom = posRect.top + skin->getFont()->getHeight() + itemBorders.top + itemBorders.bottom;
textRect.top = posRect.bottom - itemBorders.bottom;
}
lString16 postext(_("Page $1 ($2%)"));
postext.replaceIntParam(1, _page+1);
postext.replaceParam(2, lString16::itoa( _bookmark->getPercent()/100 ) << "." << fmt::decimal(_bookmark->getPercent()%100));
postext << " " << _bookmark->getTitleText();
skin->drawText( buf, posRect, postext );
if ( !text.empty() )
valueSkin->drawText( buf, textRect, text );
}
示例15: AddMouse
void AddMouse(HDC hMemDC, LPRECT lpRect, HDC hScrDC, HWND hwnd) {
POINT p;
// GetCursorPos(&p); // get current x, y 0.008 ms
CURSORINFO globalCursor;
globalCursor.cbSize = sizeof(CURSORINFO); // could cache I guess...
::GetCursorInfo(&globalCursor);
HCURSOR hcur = globalCursor.hCursor;
if(hwnd)
ScreenToClient(hwnd, &p); // 0.010ms
else
GetCursorPos(&p);
ICONINFO iconinfo;
BOOL ret = ::GetIconInfo(hcur, &iconinfo); // 0.09ms
if(ret) {
p.x -= iconinfo.xHotspot; // align mouse, I guess...
p.y -= iconinfo.yHotspot;
// avoid some memory leak or other...
if (iconinfo.hbmMask) {
::DeleteObject(iconinfo.hbmMask);
}
if (iconinfo.hbmColor) {
::DeleteObject(iconinfo.hbmColor);
}
}
DrawIcon(hMemDC, p.x-lpRect->left, p.y-lpRect->top, hcur); // 0.042ms
}