Good afternoon.
A customer had the "shining idea...". To show to graphs right-handers in the screen of a program progress.
I made the following one:
1º I declared gdi as one procedure external:
.
PROCEDURE Rectangle EXTERNAL “GDI.dll” :
DEFINE INPUT PARAMETER nLeftRectx AS LONG .
DEFINE INPUT PARAMETER nLeftRect AS LONG .
DEFINE INPUT PARAMETER nTopRect AS LONG .
DEFINE INPUT PARAMETER nRightRect AS LONG .
DEFINE INPUT PARAMETER nBottomRect AS LONG .
END PROCEDURE.
PROCEDURE PAINT :
/*----------------------------------------------------
------------------------------------------------------ */
DEFINE VARIABLE hdc AS INTEGER NO-UNDO.
DEFINE VARIABLE Okay AS INTEGER NO-UNDO.
RUN GetDC IN h-prog (INPUT FRAME {&frame-name}:HWND,
OUTPUT hdc).
RUN Rectangle IN h-prog (hdc,
0,
0,
FRAME {&frame-name}:WIDTH-PIXELS,
FRAME {&frame-name}:HEIGHT-PIXELS,
OUTPUT Okay ).
RUN ReleaseDC IN h-prog (INPUT FRAME {&frame-name}:HWND,
INPUT hdc,
OUTPUT Okay).
END PROCEDURE.
Everything functioned that is a wonder, but ai comes the problem as I make to paint the rectangle, for example, red, therefore the objective is to create a bar chart in screen.
Or as to each action of ‘choose’ in the button to generate graphs it cleans the screen and it generates the graph again.
Debtor for the attention.
Re: help GDI
Hi Carlos,
So you figured out how to draw a rectangle, and now you want to know how to make a red rectangle.
Drawing with GDI is just like drawing with pen and paper: first you select a red pen, then you draw the rectangle, then you unselect the red pen (or select the default pen).
If there is no red pen, you first have to create one. Don't forget to delete everything you create. You cannot delete a pen when it is selected, that is why you have to unselect it after use.
The pen is only used to draw the border. If you want the entire rectangle filled with red (or some other color), then you also have to select a brush. Brushes are used to fill the space inside the border. The procedure is similar: create a brush, select the brush, draw, unselect the brush (by selecting a different brush) and delete the brush.
You do not always have to create pens and brushes, because Windows has a few "stock objects" like a simple black pen and a simple solid fill brush.
But, although this is fun, I would recommend to NOT try this in Progress. I would buy a chart ActiveX control, or write an ActiveX control myself. I would certainly not do any advanced GDI in Progress, because with Progress you don't get sufficient access to Windows messages.
At some point in the future you will need to scale, scroll, print to paper, add series, user-defined colors, you know how customers are: when you give them one candy they want the whole bag. So, don't go near charting, get an ActiveX control.
Bye,
Jurjen.
Help
Good afternoon. The problem is exactly the customer not to want to buy a component OCX. I will have that to not only paint the interior of retangulo and the contour. He would have an example in progress, to pass? My English forgives the errors is not very good. I am very grateful.
re: Help GDI
Example: put a frame on your window and give that frame the name "frame-bargraph".
Then run procedure DrawRandomBargraph.
Good luck.
Help GDI
Good afternoon. The problem is exactly the customer not to want to buy a component OCX. I will have that to not only paint the interior of retangulo and the contour. He would have an example in progress, to pass? My English forgives the errors is not very good. I am very grateful.