VC skill set (7)
He zhidan
1. Image Control
Right-click the property type: bitmap
You can select image directly.
ID of the idb_bitmap1 bitmap
M_ctrl is the control variable associated with the image 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. Why can't I see the cortrol ID when I assign a variable to the control?
1. Click the single-choice button to hook the group.
2. The static control changes the ID to non-idc_static.
3. ascll code of the keyboard
0-9 is different, but +,-is the same.
4. display the characters entered on the keyboard to avoid blinking.
Void csdiview: onchar (uint nchar, uint nrepcnt, uint nflags)
{
CDC * PDC = getdc ();
Stringdata + = nchar;
Crect R (0, 0, 0 );
PDC-> drawtext (stringdata, & R, dt_left | dt_calcrect );
Invalidaterect (R );
Cview: onchar (nchar, nrepcnt, nflags );
}
Void csdiview: ondraw (CDC * PDC)
{
PDC-> drawtext (stringdata, crect (0,0, 1000,1000), dt_left );
}
5. In dialog box a domodal (), a dialog box B is displayed. After clicking a button of B, you must call a function in Class.
Process in the response function of B:
(A *) getparent ()-> fun ();
Inlcude A's file in B
6. delete folders and files
# Include
Void deletedirfile (cstring Spath)
{
Win32_find_data FD;
Handle hfind =: findfirstfile (Spath + "*. *", & FD );
If (hfind! = Invalid_handle_value)
{
While (: findnextfile (hfind, & FD ))
{
// Determine whether it is a directory
If (FD. dwfileattributes & file_attribute_directory)
{
Cstring name;
Name = FD. cfilename;
// Determine whether it is a. And ..
If (name! = ".") & (Name! = ".."))
{
// Perform recursion for a real directory
Deletedirfile (Spath + FD. cfilename + "//");
}
}
}
Else
Deletefile (Spath + FD. cfilename );
: Findclose (hfind );
}
Removedirectory (Spath );
}
7. Change the font size of the control.
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. I want to use classwizard to create a class, but I found that the baseclass column does not contain the base class I want (coblist class)
Class type: Generic
Input by yourself
9, ctypedptrlist linelist;
Why does VC report the following error:
C :/Program/Scribble/scribbledoc. H (50): Error c2143: syntax error: Missing '; 'before' <'
# Include "afxtempl. H"
It is the character l, not the number 1
10. What should I do if a member function is not prompted?
Cstring S1 = "dfdsf ";
S1.
Try the following three methods:
1. Build-> clean, Build-> rebuildall.
2. manually delete *. NCB
3. Install the auxiliary tool vc_00006
11. How do I divide six radio boxes into three groups?
Group the three radio boxes
It is divided into three groups.
Related to focus Sequence