Click here to Skip to main content
15,914,820 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionHow to change the button's text color? Pin
chenbuaa26-Dec-04 14:02
chenbuaa26-Dec-04 14:02 
GeneralEnums alignment Pin
TheSharkOfDil26-Dec-04 8:57
sussTheSharkOfDil26-Dec-04 8:57 
GeneralRe: Enums alignment Pin
John R. Shaw26-Dec-04 12:04
John R. Shaw26-Dec-04 12:04 
GeneralProblem with changing color of a pixel in a bitmap! Pin
Dani10000126-Dec-04 7:29
Dani10000126-Dec-04 7:29 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
John R. Shaw26-Dec-04 12:35
John R. Shaw26-Dec-04 12:35 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
Dani10000126-Dec-04 15:16
Dani10000126-Dec-04 15:16 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
John R. Shaw27-Dec-04 6:04
John R. Shaw27-Dec-04 6:04 
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
PJ Arends26-Dec-04 22:06
professionalPJ Arends26-Dec-04 22:06 
In a 24 bit bitmap, every pixel is stored in 24 bits but every row is aligned on a DWORD (32 bit) boundary. So in your loop when you reach the end of a row, you have to reset your pointer to the next 32 bit offset from the start of the bitmap data.
BYTE *dst=(BYTE*)pBits;
 
for (int dh = 0; dh < bm.bmHeight; dh++)
{
   for (int dw = 0; dw < bm.bmWidth; dw++)
   {
      dst[0]=(BYTE)nBlue;
      dst[1]=(BYTE)nGreen;
      dst[2]=(BYTE)nRed;
      dst += 3;
   }
 
   // each row is DWORD aligned, so when we reach the end of a row, we
   // have to realign the pointer to point to the start of the next row
   dst = (BYTE *)(((DWORD)dst + 3) & ~3);
}




"You're obviously a superstar." - Christian Graus about me - 12 Feb '03

"Obviously ???  You're definitely a superstar!!!" mYkel - 21 Jun '04

Within you lies the power for good - Use it!
GeneralRe: Problem with changing color of a pixel in a bitmap! Pin
John R. Shaw27-Dec-04 6:16
John R. Shaw27-Dec-04 6:16 
Generalquestion Pin
gamitech26-Dec-04 6:14
gamitech26-Dec-04 6:14 
GeneralRe: question Pin
Yulianto.26-Dec-04 13:54
Yulianto.26-Dec-04 13:54 
GeneralRe: question Pin
PJ Arends26-Dec-04 22:27
professionalPJ Arends26-Dec-04 22:27 
GeneralReplacing the mmemory allocator for &quot;CoGetMalloc&quot; function Pin
impeham26-Dec-04 5:34
impeham26-Dec-04 5:34 
GeneralHelp in Editing Icon Pin
Azghar Hussain26-Dec-04 4:07
professionalAzghar Hussain26-Dec-04 4:07 
GeneralNeed a fancy name for a 'combined' variable Pin
TrueTom26-Dec-04 2:42
TrueTom26-Dec-04 2:42 
GeneralRe: Need a fancy name for a 'combined' variable Pin
User 665826-Dec-04 7:52
User 665826-Dec-04 7:52 
GeneralRe: Need a fancy name for a 'combined' variable Pin
TrueTom27-Dec-04 1:35
TrueTom27-Dec-04 1:35 
GeneralRe: Need a fancy name for a 'combined' variable Pin
TrueTom27-Dec-04 2:16
TrueTom27-Dec-04 2:16 
Generalupload files Pin
StoreErin26-Dec-04 1:26
StoreErin26-Dec-04 1:26 
GeneralRe: upload files Pin
Neville Franks26-Dec-04 9:56
Neville Franks26-Dec-04 9:56 
GeneralRe: upload files Pin
StoreErin26-Dec-04 13:26
StoreErin26-Dec-04 13:26 
GeneralpictureBox question. Pin
Link260025-Dec-04 22:31
Link260025-Dec-04 22:31 
QuestionHow to use message handler in MFC regular Dll? Pin
tttyip25-Dec-04 20:25
tttyip25-Dec-04 20:25 
AnswerRe: How to use message handler in MFC regular Dll? Pin
User 665825-Dec-04 22:56
User 665825-Dec-04 22:56 
QuestionWhere can I get the Microsoft Windows .NET DDK? Pin
momer25-Dec-04 20:04
momer25-Dec-04 20:04 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.