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.

Map with GDI+ or something

Featured Replies

Hello I need to do a Map where I can reload an image (.bmp) any time I would want to, so does anyone know about a tutorial for this??thank u in advance!!Rafa

The "guide" for GDI+ programming for many of us has been, "Graphics Programming with GDI+" by Mahesh Chand, but beware, it gives examples in C#. For the most part this is not a problem if you are a c++ programmer, but from time to time you may need to consult MSDN.

Hi!!Thanks for ur help!!!, I wrote this post 'cuz I've been trying to get some decent manual for this, and I've been getting pieces of things. The problem is that Macros are made in ANSI C and GDI+ is for C++ so tht's the first thing mixed this 2 languages, but I think that is not a problem the main thing is that for example to get a handler to draw an image into a gauge it's kind of complicated, I will buy that book! and see what can I do !! but still if anyone haa something (ANYTHING) please let me know!Rafa

You are correct, you will first have to learn how to setup your Gauge or Multi-gauge to be able to compile some files in C and others in C++. The SDK example is in C, and will be of little help if you are not an experienced programmer.If you are not an experienced C++ programmer, I would recommend looking at someone else's code to help you figure it out. One that is easily available is Arne's traffic radar gauge, which I believe you can find here at AVSIM.Basically, it is rather involved as you have to split things into two headers... one that is C compliant, and the other for your C++ stuff, or you have to use conditional compilation.I find the first approach cleaner the way I have things setup, and have no need for conditional compilation. Save your self a headache and comment the C headers at the top // Only ANSI C stuff hereso you don't forget and stick stuff in there like includes which include classes.Good luck

Thank you Patrick, I'll try to work it out! and let u know about what I have found!.Rafa

Ok Patrick, first let me tell you that I know a little bit of c++ but even if i would know a lot of things i think i would never take off my "dummie" title 'cuz we learn things every single day!! hehe.Well, can u explain this more for me "Basically, it is rather involved as you have to split things into two headers... one that is C compliant, and the other for your C++ stuff"'cuz I just added some #include's and functions to the files im using to make the gauge (which i already have working with MAKE_ICON and MAKE_STATIC from a sample i found. I use this --> Bitmap bitmap(L"respicture.bmp"); to try to make the var for the bitmap, then I need a handler here ---> //Graphics graphics(Handle); Graphics bmp_graphics(&NEED A HANDLER);so I can load the .bmp, so what do u think??Rafa

  • Author
  • Moderator

Write to me at [email protected] and I'll send you GDI Project Template.zip which is a sample project layout for GDI+ development.This was developed on the MSVC++ .NET 2003 IDE, so if you cannot load the .sln (Solution) in whatever you use, all the files are there for you to construct your own project solution. Simply add "gdiplus.lib" to your Linker.It is a trivial example of a basic GDI+ project, and will illustrate how to use GDI+ to create a simple "engine power display," using a 'wedge" that is rotated around the center axis according to the throttle lever's movement, producing a "circular fan" type of digital display... ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Hi!, i've been working all the weekend with the files u sent. I made all that says there with my gauge, but still cannot load the .bmp I want to load. I'm using something like this:- Bitmap bitmap(L"aslink.bmp");But i think thats like a reference, isnt it??I have a tutorial for GDI+ which says this:// load the bitmap from a file bitmap_.reset( new gdp::Bitmap(fname.c_bstr()) );but when I use that it says that my GdiPlus doesnt have that method (reset), and I cannot use a var of type WSTRING.So anyone has a clue of this??, just load a bmpThank you

  • Author
  • Moderator

Here is how I load a bitmap from resources:In my project's .h file... Image *rtu_base_bitmap = NULL; HINSTANCE gaugeInstance = 0; /////////////////////////////////////////////////////////////////////////////// RTU Controller Bitmaps/////////////////////////////////////////////////////////////////////////////#define RTU_Text 0x1000In my project's .rc file -RTU_Text BITMAP DISCARDABLE "resXLS_RTU_Text.BMP"In my gauge's .cpp file - case PANEL_SERVICE_PRE_INSTALL: if (!gaugeInstance) gaugeInstance = GetModuleHandle("Honeywell_RTU.gau"); // Windows API call if (gaugeInstance && !rtu_base_bitmap) rtu_base_bitmap = new Bitmap(gaugeInstance, (WCHAR*)MAKEINTRESOURCE(RTU_Text)); // GDI+ call break;Now, anytime I need to use the bitmap, I can refer to it as rtu_base_bitmap: { Rect destinationRect(0, 0, 400, 500); graphics.DrawImage(rtu_base_bitmap,destinationRect,0, 0, 400, 500, UnitPixel); }

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Hi! thank you! but what if I want to load another .bmp image whereas Im flying, i mean like a map!, understand?.Im asking 'cuz with .rc the .gau file compiles everything, so I need to load another thing, is that possible??thank you Bill

  • Author
  • Moderator

>Hi! thank you! but what if I want to load another .bmp image>whereas Im flying, i mean like a map!, understand?.>>Im asking 'cuz with .rc the .gau file compiles everything, so>I need to load another thing, is that possible??It probably is possible, but I sure don't know how! ;)

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

Hi!!! I could load the picture!!, it works!! thank you!:DI will find out the next step and will tell what did i do!Rafa

  • Author
  • Moderator

>It probably is possible, but I sure don't know how! ;)Rats! I knew how but had forgotten it since I haven't used it in over a year... ;)Bitmap *MyImage;MyImage = Bitmap::FromFile(L"aircraftMyAircrafttextureMyImage.bmp"); RectF destination(0.0f, 0.0f, 394.0f, 91.0f); graphics.DrawImage(MyImage, destination);

Fr. Bill    

AOPA Member: 07141481 AARP Member: 3209010556


     Avsim Board of Directors | Avsim Forums Moderator

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.