Recently wrote a small software, is MFC interface, combined with DUILIB do I need to use MFC color selection tool to select the color after DUILIB controls to let it show, but the color value of MFC in DUILIB is invalid, the MFC DWORD is to acquire the color value of type, I direct color extraction tool was used to extract directly the AS hexadecimal in will appear normal, could you tell me how to convert DWORD to AS, such AS red decimal is 255, the AS=0 xffff0000;
CodePudding user response:
COLORREF cf=RGB (,,)? this
CodePudding user response:
reference 1st floor VisualEleven response: COLORREF cf=RGB (,,)? The Can't say; COLORREF cf=RGB (0, 255), cf=255, AS=0 xffff0000, AS decimal is 4294901760, so the value difference a bit big, don't know how to convert CodePudding user response:
Look at the pure red pure green, pure blue data what law? CodePudding user response:
Computer memory or file content or transport it is just a one-dimensional binary byte array and its corresponding binary address; The human brain to a computer memory or file contents or transfer the content of the one-dimensional binary byte array and its corresponding binary address some parts as an integer, number of signed/unsigned number, floating point Numbers, complex Numbers, letters, digits, Chinese/Korean/French... Character/string, assembly instructions, functions, function parameters, heap, stack, arrays, Pointers, array pointer and pointer array, the array of arrays, pointer to pointer, two-dimensional arrays, character lattice, the coordinates of character strokes, black and white binary images and grayscale images, color images, audio, video, fingerprint information, id information... CodePudding user response:
In duilib, color is 4 bytes, is a DWORD. Windows, 4 bytes, respectively: ARGB is highest is transparency, and then the R, G, B three colors. The Windows are small end; So you AS=0 xffff0000 in memory B, G, R, A So you can obtain the data of all sorts of color like this: DWORD val=0 xffff0000 The CLR BYTE *=(BYTE *) & amp; Val. B=CLR [0]; G=the CLR [1]. R=the CLR [2]; A=the CLR [3]. CodePudding user response:
In turn packaging is the same. Just pay attention to the transparency. Must fill out into FF, otherwise it is completely transparent, lead to don't see color. COLORREF cf=RGB (0, 255); Cf |=0 xff000000; At this point, cf is the opaque red. CodePudding user response:
refer to the original poster ZGGZGW response: recently wrote a small software, is MFC interface, combined with DUILIB do I need to use MFC color selection tool to select the color after DUILIB controls to let it show, but the color value of MFC in DUILIB is invalid, the MFC DWORD is to acquire the color value of type, I direct color extraction tool was used to extract directly the AS hexadecimal in will appear normal, could you tell me how to convert DWORD to AS, such AS red decimal is 255, the AS=0 xffff0000; Microsoft color should be a high byte is not zero, use color in early Microsoft EGA, (0-15) 16 color, if it is 0, is the color value directly