ehsan_op 0 Newbie Poster

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.

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");
}

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

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.