• Which the release of FS2020 we see an explosition of activity on the forun and of course we are very happy to see this. But having all questions about FS2020 in one forum becomes a bit messy. So therefore we would like to ask you all to use the following guidelines when posting your questions:

    • Tag FS2020 specific questions with the MSFS2020 tag.
    • Questions about making 3D assets can be posted in the 3D asset design forum. Either post them in the subforum of the modelling tool you use or in the general forum if they are general.
    • Questions about aircraft design can be posted in the Aircraft design forum
    • Questions about airport design can be posted in the FS2020 airport design forum. Once airport development tools have been updated for FS2020 you can post tool speciifc questions in the subforums of those tools as well of course.
    • Questions about terrain design can be posted in the FS2020 terrain design forum.
    • Questions about SimConnect can be posted in the SimConnect forum.

    Any other question that is not specific to an aspect of development or tool can be posted in the General chat forum.

    By following these guidelines we make sure that the forums remain easy to read for everybody and also that the right people can find your post to answer it.

Filled Rectangle

Messages
76
Is there a simple function to fill a rectangle? I've checked about everywhere and I'm not sure how to do this. FillRectangle is apparently a Visual C++ function, but my 2008 Studio Express doesn't seem to have it.

There is a PaintRgn which requires a HRGN handle. But I don't understand where it is going to get the region. It doesn't ask for the HDC as a parameter, so how do I fill in a rectangle in a gauge? I suppose I could just do a for loop drawing lines, but I'd hope there would be something more efficient.

And BTW is there some place/book that describes all the functions in WinGDI.h ?
 
Hello Geoff,


There are enties like this in the FS9 500 series GPS;

<Rectangle Width="54" Height="13" FillColor="#2A76E8" Bright="Yes"/>

So it looks like a 'fillcolor' flag will fill it.



Bill
 
There certainly is...

Most of what you need may be found in the Help files. Here is a description for FillRectangle method:

Code:
   Graphics graphics(hdc);

   // Create a SolidBrush object.
   SolidBrush blackBrush(Color(255, 0, 0, 0));

   // Define the rectangle.
   int x = 0;
   int y = 0;
   int width = 100;
   int height = 100;

   // Fill the rectangle.
   graphics.FillRectangle(&blackBrush, x, y, width, height);

Here is an example pulled from one of my gauges. In the following, I'm drawing a display box with a limegreen border, then filling it with black, prior to filling it with text:

Code:
		graphics.DrawRectangle(limegreenPen, 103, 113, 12, 18);
		graphics.FillRectangle(blackNoDimBrush, 103, 113, 12, 18);
                graphics.DrawString(L"ATC/TCAS",-1,Arial15,PointF(8, 110), whiteBrush);
 
Last edited:
Curious Indeed - there is no FillRectangle in my Visual C++ 2008 studio express. So I'm doing it the old fashioned way - with lines. I've searched the includes with no luck. And there is no FillRectangle in either the sd27gau, the Panel SDK manual, nor the sdk examples. At least not that I could find.

Bill would you do me a favor and find where the FillRectangle is defined - which include file? Maybe I'm missing something in my install.
 
Make certain that you have the following in your main.cpp file:

#include "..\inc\fs9gauges.h"
#include <MMsystem.h>
#include <math.h>
#include <stdio.h>
#include <wchar.h>
#include <Gdiplus.h>
#define ULONG_PTR DWORD
#define UNICODE
using namespace Gdiplus;
GdiplusStartupInput gdiplusStartupInput;
ULONG_PTR gdiplusToken;


From the "Help" file:

Method Information

Header Declared in Gdiplusgraphics.h, include gdiplus.h
Import library gdiplus.lib
Minimum availability GDI+ 1.0
Minimum operating systems Windows 98/Me, Windows XP, Windows 2000, Windows NT 4.0 SP6
 
Last edited:
I do have the Gdiplus.h include file, however, it looks like my setup/configuration needs some work as the compiler is going nuts with error messages.

Thanks for the info!
 
Back
Top