Home > Software engineering >  MFC in how smart select multiple controls (variable names in sequence) in a certain
MFC in how smart select multiple controls (variable names in sequence) in a certain

Time:10-25

Existing MFC project, including the 100 space images, set a variable called m_l1 m_l100,
A string of data, such as
{
0,0,0,0,13,0,56,73,0...
}
0 means don't do any processing, digital representation in the first number control display images, such as 13 said m_l13 control display images, it intends to use the code
{
CBitmap bm.
HBITMAP hB.
Bitmap. LoadBitmapW (IDB_RED);
HB=(HBITMAP) bitmap. GetSafeHandle ();
M_lnumber. SetBitmap (hB);
}
Consult a great god how to put the number in the data and control variable name, had better have the code examples, thank you!

CodePudding user response:

These controls your ID is set to continuous not good processing,
GetDlgItem (IDC_PICTURE_BASE + INDEX) way to get the control, including IDC_PICUTRE_BASE as constants, the INDEX for the INDEX variable ~

CodePudding user response:

reference 1st floor VisualEleven response:
these controls your ID is set to continuous not good processing,
GetDlgItem (IDC_PICTURE_BASE + INDEX) way to get the control, including IDC_PICUTRE_BASE as constants, the INDEX for the INDEX variable ~

If I give 100 photo control ID is set to IDC_PICTURE1 IDC_PICTURE100, then I through GetDlgItem (IDC_PICTUREnumber) way to get to the image control handle, how to make the control display bitmap,
Beginners will only through add variables to control how to display images and then set, please forgive me, whether can the following methods
{
CBitmap bm.
HBITMAP hB.
Bitmap. LoadBitmapW (IDB_RED);
HB=(HBITMAP) bitmap. GetSafeHandle ();
M_picture=GetDlgItem (IDC_PICTUREnumber);
M_picture. SetBitmap (hB);
}
Now can't open program test, thank you! If not, a great god, please give a reference code

CodePudding user response:

reference 1st floor VisualEleven response:
these controls your ID is set to continuous not good processing,
GetDlgItem (IDC_PICTURE_BASE + INDEX) way to get the control, including IDC_PICUTRE_BASE as constants, the INDEX for the INDEX variable ~

In addition could you tell me how to set the control ID into a continuous, I set IDC_PICTURE1 to IDC_PICTURE100 directly, index variables for the I, as with GetDlgItem (IDC_PICTURE + I) and can't find the controls,

CodePudding user response:

GetDlgItem parameters only need one of your digital ID
You look at your IDC_PICTURE in Resource. H is how much, if is 2001

Other ID, then you define in the Resource. H must be 2002-2102

GetDlgItem (IDC_PICTURE + I) to find the

You don't single debug, look at your IDC_PICTURE + I this number in the Resource. H is there, so sure to find

CodePudding user response:

Manually add to go on your own, control types are recommended as an array
  • Related