Home > Software engineering >  Have a VC MFC problem and give a method
Have a VC MFC problem and give a method

Time:09-17

A 3 row 6 column form, how to put the 3 * 6 pictures randomly on the table? Ever give a thought

CodePudding user response:

1. Listctrl implementation into picture phone reply to you find a ready-made https://blog.csdn.net/qq_40993793/article/details/84649186
2. Random, you can generate a random number, appended to the picture id string behind such as idc_jpg % d, random number according to the number of generated through decreasing, prevent repeated images, used to generate the id of the string and the actual id string comparison, set up pictures

CodePudding user response:

Random data is random.
There is a simple algorithm.
First put image index in the array in sequence.
Cycle, then the remaining in the array randomly selected an index to the end.
Example:
First is the rand () % 18 with a number of random 0-17. And then randomly to the serial number and index of 17 exchange.
The second is the rand () % 17 get random a number from 0 to 16, in the same way with 16 exchange index.
The third is the rand () % get random number from 0 to 15, 16 and 15 exchange.
.
Eventually the whole order array, random disrupted.

CodePudding user response:

Upstairs, mainly USES the rand () and know value of two dimensional data, NUM [do] [list] this is not a problem

CodePudding user response:

OnPaint/ontouch () function to use the LineTo/MoveTo line drawing, BitBlt/StrectBlt ()/TransparentBlt () map
  • Related