Skip to content
View in the app

A better way to browse. Learn more.

The AVSIM Community

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

GDI+ text display

Featured Replies

  • Commercial Member

Guys, I have a real basic question about GDI+ and DrawString. I am trying to make a string to display the pitch value of the aircraft as a number ex: 10 = 10 degrees pitch up, or -5 = minus five degrees pitch down. I am having problem doing this. I made my own variable, pitch that is a double, and that reads the pitch value from FS. Here is the code.g->DrawString(L"pitch", -1, &Arialf, PointF(110, 15), &whiteBrush); In this snip, pitch is written, but if I take the quotes and the L(I don't know what that is, but I know that it has to be there), I can't compile. Can anybody help me out? Thank you very much in adcance.Sincerely,Tiberiu Brasov

L converts "normal" char strings to wide-character (WCHAR) versions. Graphics::DrawString needs the string in the form of WCHAR, for printing a WCHAR use swprintf. E.g. WCHAR string[5] = L"";... swprintf(string,L"%02d",pitch); m_graphics->DrawString(string,wcslen(string),...);Arne Bartels

  • Commercial Member

Arne, Thank you very much for your super prompt answer! I am having a problem compiling your code. I apologise not understanding your example, but I can't get code to compile.WCHAR string[5] = L"";swprintf(string,L"%02d",pitch);g->DrawString(string, wcslen(string), -1, &Arialf, PointF(110, 15), &whiteBrush); Thank you very much for taking your time to help me! I really appreciate it!Sincerely,Tibeiru Brasov

What are the problems (warnings, errors etc.)? "Can't get to compile" is not much info. See also the DrawString definition in the C++ documentation, it's either -1 or wcslen(string) but not both.Arne Bartels

Hey Tiberiu,Like Arne says, either wcslen or -1. I always use -1 since that is easier to write and it automatically adjusts for the string length, but only if the string is null terminated.Your first snippet is right, you need the L"your text" format, if the text is constant. For dynamic strings, just write to a variabe what you wish with swprintf, then use DrawString(&your_string_buffer, -1, .........);

Create an account or sign in to comment

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.