VC sculptor small technology set (7)
He Zhidan
1, picture control
Right click Properties TYPE: Bitmap
You choose image directly
IDB_bitmap1 bitmap ID
M_ctrl is a control variable associated with the picture control
Void cdlg2dlg :: onbutton1 ()
{
CBITMAP Bitmap1;
Bitmap1.loadBitmap (IDB_bitmap1);
m_ctrl.setBitmap (Bitmap1);
}
Void cdlg2dlg :: onbutton2 ()
{
CBITMAP Bitmap2;
Bitmap2.LoadBitmap (IDB_bitmap2);
m_ctrl.setBitmap (Bitmap2);
}
2, what I can't see the CORTROL ID when I give the control?
1, radio button, hook the group.
2, static control changes the ID to non-IDC_STATIC.
3, size keyboard ASCLL code
0-9 Different, but , - the same.
4, display the characters entered by the keyboard, try to avoid flashing
Void csdiView :: onchar (uint nchar, uint nrepcnt, uint nflags)
{
CDC * PDC = Getdc ();
StringData = nchar;
CRECT R (0,0,0,0);
PDC-> DrawText (StringData, & R, DT_LEFT | DT_CALCRECT);
InvalidateERECT (R);
CView :: OnChar (nchar, nrepcnt, nflags);
}
Void CsdiView :: OnDraw (CDC * PDC)
{
PDC-> DrawText (StringData, CRECT (0, 0, 1000, 1000), DT_LEFT);
}
5. Dialog box A Domodal () Out of a dialog B. After clicking B, you can request a function in the class of A.
Processing in the response function of B:
((A *) getParent ()) -> fun ();
Files in INLCUDE A in B
6, delete folders and contain files
#include
Void deletedirfile (CString Spath)
{
WIN32_FIND_DATA FD;
Handle Hfind = :: FindfirstFile (Spath "*. *", & Fd);
IF (HFIND! = INVALID_HANDLE_VALUE)
{
While (: FindNextFile (HFIND, & FD))
{
// Judgment is a directory
IF (fd.dwfileAttributes & file_attribute_directory)
{
CString name;
Name = fd.cfilename;
// Judgment is whether it is. And ..
IF ((Name! = ") && (name! =". "))))
{
// If it is a real directory, recursive
DELETEDIRFILE (Spath fd.cfilename "//");
}
}
Else
Deletefile (Spath fd.cfilename);
}
:: FindClose (Hfind);
}
RemoveDirectory (SPATH);
}
7, change the size of the control font
Logfont logfont;
CFont * pfont = m_ctrshowMessage.getFont ();
PFONT-> GetLogFont; & logfont;
Logfont.lfheight = logfont.lfheight * 1.5;
Logfont.lfwidth = logfont.lfwidth * 1.5; cfont font;
Font.createFontIndirect (& logfont);
M_CTRSHOWMESSAGE.SETFONT (& font);
8, want to create a category with ClassWizard, but found that there is no base class I want in the baseclass column (Coblist class)
Class Type: Generic
Yourself
9, ctypedptrlist
LINELIST;
Why VC error:
C: / Program / Scribble/ScribbleDoc.h (50): Error C2143: Syntax Error: missing ';' Before '<'
# include "afxtempl.h"
Is character L, not a number 1
10, do not prompt member functions, what should I do?
CString S1 = "DFDSF";
S1.
Try the following three methods:
1, build-> clean, build-> refuildall.
2, manual delete * .ncb
3, install auxiliary tool VC_Assist6
11, I have 6 Radio Box how to divide 3 groups
Put the three Radio Box's Group
It is divided into three groups.
Related to the order of focus