格式:
SetTextColor(hdc,RGB(0,0,0));//RGB(0,0,0)代表黑色
SetBkMode(hdc,TRANSPARENT);//设置文字背景为透明色
//StringCchPrintf(szBuffer,128,TEXT("需要改变颜色的文字"));
//StringCchLength(szBuffer,128,&iTarget);
//TextOut(hdc,100,100,szBuffer,iTarget);//文字
示例:
SetTextColor(hdc,RGB(r,g,b))
里设置rgb值,可以打开PhotoShop里的调色板选择颜色然后查看RGB值再填写到这个RGB函数
的参数里
SetBkMode(hdc,TRANSPARENT);//设置文字背景为透明色
SetTextColor(hdc,RGB(246,190,214));
StringCchPrintf(szBuffer,128,TEXT("How You Like That"));
StringCchLength(szBuffer,128,&iTarget);
TextOut(hdc,400,420,szBuffer,iTarget);
SetTextColor(hdc,RGB(231,156,194));
StringCchPrintf(szBuffer,128,TEXT("How You Like That"));
StringCchLength(szBuffer,128,&iTarget);
TextOut(hdc,400,440,szBuffer,iTarget);
SetTextColor(hdc,RGB(29,27,56));
StringCchPrintf(szBuffer,128,TEXT("How You Like That"));
StringCchLength(szBuffer,128,&iTarget);
TextOut(hdc,400,460,szBuffer,iTarget);
SetTextColor(hdc,RGB(51,109,136));
StringCchPrintf(szBuffer,128,TEXT("How You Like That"));
StringCchLength(szBuffer,128,&iTarget);
TextOut(hdc,400,480,szBuffer,iTarget);