我正在尝试同时显示 2 个随机骰子。我知道我需要将模具编号转换为资源 ID,但如何?这是我到目前为止的代码......
对此进行编码的好方法是什么?
void CMFCApplication5Dlg::OnBnClickedButton1()
{
// randomize random number generator using current time
srand( (unsigned)time( NULL ) );
// pick random die values
int die1 = 1 + rand() % 6; // first die roll
int die2 = 1 + rand() % 6; // second die roll
pPCAvatar = (CStatic *) GetDlgItem(PC_AVATAR);
pIDCPicture = (CStatic *) GetDlgItem(IDC_PICTURE2);
//image for the avatar
CString Image1;
CString Image2;
CString Image3;
CString Image4;
CString Image5;
CString Image6;
//initialize entity from the constructor
Image1 = "pcture1.bmp"; // die face # 1
Image2 = "pcture2.bmp"; // die face # 2
Image3 = "pcture3.bmp"; // die face # 3
Image4 = "pcture4.bmp"; // die face # 4
Image5 = "pcture5.bmp"; // die face # 5
Image6 = "pcture6.bmp"; // die face # 6
// TODO: Add your control notification handler code here
}