Sign in to follow this  
Guest

GDI Problems - FS2002

Recommended Posts

I am experimenting and/or trying to learn how to use the vector interface when making panel gauges for FS2002. Could someone take a look at the following code and tell me if I'm doing something wrong?void FSAPI EicasOneCallback(PGAUGEHDR pgauge, SINT32 service_id, UINT32 extra_data){ // Determine service call switch(service_id) { // Pre-draw routine case PANEL_SERVICE_PRE_DRAW: { // Get a drawing surface and confirm its existance PELEMENT_STATIC_IMAGE pElement = (PELEMENT_STATIC_IMAGE)(pgauge->elements_list[0]->next_element[0]); if(pElement) { // Get a drawing mechanism and determine its existance HDC hDraw = pElement->hdc; if(hDraw) { // Create brush and pen HBRUSH hbrush = CreateSolidBrush(RGB(255,0,0)); HPEN hpen = CreatePen(PS_SOLID, 4, RGB(0,255,0)); // Setup colors SelectObject (hDraw, hbrush); SelectObject (hDraw, hpen); // Draw and finish Rectangle(hDraw, 40, 40, 80, 80); REDRAW_IMAGE(pElement); } } // Break break; } }}I appreciate any suggestions, please help.-Matt

Share this post


Link to post
Share on other sites
Help AVSIM continue to serve you!
Please donate today!

How is your drawing element structure? An MAKE_STATIC placed on the background MAKE_STATIC or do you try to draw directly on the background MAKE_STATIC with the GDI routines?For the first case you have to usePELEMENT_STATIC_IMAGE pElement = (PELEMENT_STATIC_IMAGE)(pgauge->elements_list&l;0&r;->next_element&l;0&r;);for the second case:PELEMENT_STATIC_IMAGE pElement = (PELEMENT_STATIC_IMAGE)(pgauge->elements_list&l;0&r;);Arne Bartels

Share this post


Link to post
Share on other sites

Arne,I am using the first case in which I am drawing on a second macro layed on top of the background. They are configured as follows://///////////////////////////////////////////////////////////////////////////// SurfaceMAKE_STATIC ( eicas1_surface, IMG_EICAS1_SURFACE, eicas_1_fail, NULL, IMAGE_USE_ERASE | IMAGE_CREATE_DIBSECTION, 0, 0,0)PELEMENT_HEADER eicas_surface_list[] ={ &eicas1_surface.header, NULL};/////////////////////////////////////////////////////////////////////////////// BackgroundMAKE_STATIC ( eicas1_background, IMG_EICAS1_BACKGROUND, NULL, eicas_surface_list, IMAGE_USE_TRANSPARENCY, 0, 0,0)PELEMENT_HEADER eicas1_list = &eicas1_background.header;The drawing surface bitmap is an 8-bit for maximum compatibility and the drawing code mentioned in the very first message remains unchanged including the PELEMENT_STATIC_IMAGE declaration. Any further ideas?-Matt

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this