problem in Drawing a Unicode string on an Bitmap image in VC++

Please support our C++ advertiser: Intel Parallel Studio Home
Reply

Join Date: Aug 2008
Posts: 11
Reputation: ehsan_op is an unknown quantity at this point 
Solved Threads: 0
ehsan_op ehsan_op is offline Offline
Newbie Poster

problem in Drawing a Unicode string on an Bitmap image in VC++

 
0
  #1
Jan 15th, 2009
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
Last edited by ehsan_op; Jan 15th, 2009 at 6:13 am.
Reply With Quote Quick reply to this message  
Reply

This thread is more than three months old.
Perhaps start a new thread instead?
Message:



Other Threads in the C++ Forum
Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC