(40)訪客_自動洗版機2009-11-24 20:48 · 122.254.51.1xvoid CShowfontView::OnBut1()
{
CFontDialog dlg;
FILE *pf;
pf=fopen("testxt","w");
int i,j;
int R,G,B;
COLORREF RGB1,RGB2;
if (dlg.DoModal() == IDOK)
{
// Create the font using the selected font from CFontDialog.
LOGFONT lf;
memcpy(&lf, dlg.m_cf.lpLogFont, sizeof(LOGFONT));
CFont font;
VERIFY(fontreateFontIndirect(&lf));
// Do something with the font just created...
CClientDC dc(this);
CFont* def_font = dcelectObject(&font);
dcextOut(5, 5, "End",3);
dcelectObject(def_font);
for(j=0;j<50;j++)
{
for(i=0;i<50;i++)
{
RGB1=dc.GetPixel(i,j);
R=GetRValue(RGB1);
G=GetGValue(RGB1);
B=GetBValue(RGB1);
if((B==255)&&(G==255) &&(R==255) )
{
RGB2=RGB(0,0,0);
fprintf(pf,"○");
}
else
{
RGB2=RGB(255,255,255);
fprintf(pf,"◎");
}
dcetPixel(i,j,RGB2);
}
fprintf(pf,"\n");
}
// Done with the font. Delete the font object.
font.DeleteObject();
}
fclose(pf);
}
///////////////////////////////////////////////