| | |
problem in Drawing a Unicode string on an Bitmap image in VC++
Please support our C++ advertiser: Intel Parallel Studio Home
![]() |
•
•
Join Date: Aug 2008
Posts: 11
Reputation:
Solved Threads: 0
Hi, i'm writing a simple function which Draws a string on a bitmap image, but i have problem with unicode strings , they change to ?
Notice : i write my code in brief actually i do not attention to all faces of right programming.
[code = c++]
main(){
CreatImage("سلام، حالتون چطوره");
}
void CreatImage(String* sImageText)
{
Bitmap *objBmpImage = new Bitmap(width, height, PixelFormat::Format32bppArgb);
Font *objF = new Font("Arial", 22, FontStyle::Bold, GraphicsUnit:: Pixel);
Graphics *objGraph = Graphics::FromImage(objBmpImage);
SolidBrush *whiteBrush = new SolidBrush(Color::White);
SolidBrush *blackBrush = new SolidBrush(Color::Black);
RectangleF canvas = Drawing::RectangleF(0, 0, width, height);
objGraph->FillRectangle(whiteBrush, canvas);
objGraph->DrawString(sImageText, objF, blackBrush, canvas);
objGraph->Flush();
objBmpImage->Save("C:\\images\\bitmap.bmp");
}
[/code]
this is my code but after calling the function CreatImage in main and passing that unicode string when i watch the value of sImageText into the function it contains just '?' fo each character of my string, i mean "سلام،حالتون چطوره"-> "????? ?????? ????",what shuld i do , please help me , i have wrote exactly this code in C# but i do not have this problem , and it works properly , but i need the code in C++ . thanks in advance
Notice : i write my code in brief actually i do not attention to all faces of right programming.
[code = c++]
main(){
CreatImage("سلام، حالتون چطوره");
}
void CreatImage(String* sImageText)
{
Bitmap *objBmpImage = new Bitmap(width, height, PixelFormat::Format32bppArgb);
Font *objF = new Font("Arial", 22, FontStyle::Bold, GraphicsUnit:: Pixel);
Graphics *objGraph = Graphics::FromImage(objBmpImage);
SolidBrush *whiteBrush = new SolidBrush(Color::White);
SolidBrush *blackBrush = new SolidBrush(Color::Black);
RectangleF canvas = Drawing::RectangleF(0, 0, width, height);
objGraph->FillRectangle(whiteBrush, canvas);
objGraph->DrawString(sImageText, objF, blackBrush, canvas);
objGraph->Flush();
objBmpImage->Save("C:\\images\\bitmap.bmp");
}
[/code]
this is my code but after calling the function CreatImage in main and passing that unicode string when i watch the value of sImageText into the function it contains just '?' fo each character of my string, i mean "سلام،حالتون چطوره"-> "????? ?????? ????",what shuld i do , please help me , i have wrote exactly this code in C# but i do not have this problem , and it works properly , but i need the code in C++ . thanks in advance
Last edited by ehsan_op; Jan 15th, 2009 at 6:13 am.
![]() |
Other Threads in the C++ Forum
- Previous Thread: Cant solve this
- Next Thread: Please help
| Thread Tools | Search this Thread |
api array based beginner binary c++ c/c++ calculator char char* class classes code compile compiler console conversion count delete deploy desktop directshow dll download dynamic dynamiccharacterarray email encryption error file forms fstream function functions game givemetehcodez google graph gui homeworkhelp homeworkhelper iamthwee ifstream input int integer java lib linkedlist linker linux list loop looping loops map math matrix memory news numbertoword output parameter pointer problem program programming project proxy python random read recursion recursive reference return rpg sorting string strings struct temperature template templates test text text-file tree unix url variable vector video visual visualstudio win32 windows winsock wordfrequency wxwidgets





