2005年5月アーカイブ

bitmap

void DrawLed() { bool rev = (m_nDispMode == 3 || m_nDispMode == 4);

int w = rc2.right-rc2.left;
int h = rc2.bottom-rc2.top;
int dx = w / m_sizDispSize.cx;
int dy = h / m_sizDispSize.cy;


// 高速型
HDC mem_dc = CreateCompatibleDC(hdc);
HBITMAP bmp_led = CreateCompatibleBitmap(hdc, dx*2,dy);
SelectObject(mem_dc, bmp_led);

// on
SelectObject(mem_dc, ledPen);
SelectObject(mem_dc, ledBrush);
Ellipse(mem_dc, 0,0, dx-1,dy-1);
// off
SelectObject(mem_dc, hPen);
SelectObject(mem_dc, armBrush);
Ellipse(mem_dc, dx,0, dx*2-1,dy-1);

for (int y=0; y int py = rc2.top + (y * h / m_sizDispSize.cy);
for (int x=0; x int px = rc2.left + (x * w / m_sizDispSize.cx);
if ((GetPixel(txtDC, x, y) > 0) ^ rev) {
BitBlt(hdc, px,py, dx,dy, mem_dc, 0,0, SRCCOPY);
} else {
BitBlt(hdc, px,py, dx,dy, mem_dc, dx,0, SRCCOPY);
}
}
}

DeleteObject(bmp_led);
DeleteDC(mem_dc);
}

CToolTipCtrl

CWnd* wnd;
	m_pTip = new CToolTipCtrl;
	m_pTip->Create(this);	// , TTS_ALWAYSTIP);

	wnd = GetDlgItem(IDC_CHECK1);
	m_pTip->AddTool(wnd, "自動スクロール");

	wnd = GetDlgItem(IDC_SLIDER1);
	m_pTip->AddTool(wnd, "フォントの横幅");

	m_pTip->Activate(TRUE);



// ToolTipの RelayEventのため
BOOL CLedH4View::PreTranslateMessage(MSG* pMsg) 
{
	if (NULL != m_pTip)
		m_pTip->RelayEvent(pMsg);
	
	return CFormView::PreTranslateMessage(pMsg);
}

連絡先

nakanohito