Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Drawing a line on a rectangle
#1
With the following macros I can draw a line on a rectangle :
Function test_BRect
Code:
Copy      Help
int x0 y0 xsc ysc
x0=50; y0=40; xsc=0.8*xres; ysc=0.7*yres
int h=OnScreenDraw(x0 y0 xsc ysc &OSD_BRect 0 0 0 0 h)
OnScreenLine(250 250 400 400 175 2)
3
OnScreenDrawEnd h
3

Function OSD_BRect
Code:
Copy      Help
function hwnd hdc cx cy param
int hpen oldpen hbrush oldbrush oldfont
int x0 y0 ipen
ipen=8
x0=5; y0=5

hbrush=CreateSolidBrush(14614245); oldbrush=SelectObject(hdc hbrush)
hpen=CreatePen(0 ipen 14614245); oldpen=SelectObject(hdc hpen)
RoundRect hdc x0+ipen y0+ipen cx-(2*x0)-ipen cy-(2*y0)-ipen 3 3

DeleteObject SelectObject(hdc oldbrush)
DeleteObject SelectObject(hdc oldpen)
ret

However, OnScreenDrawEnd closes only the rectangle. If I use "h" as last argument in OnScreenLine, then rectangle is erased before the line appears, as actually expected. Any advice is mostly welcome. I understand I can close these two graphs (rectangle and line) separately.

Let me extend a bit my question. If I need to add some text on this rectangle, I experienced that I can do it inside OSD_BRect, no problem. However, I am wondering whether I have the flexibility to do it in the main module (test_BRect).

Many thanks in advance.


Messages In This Thread
Drawing a line on a rectangle - by ssimop - 03-18-2020, 08:37 PM
RE: Drawing a line on a rectangle - by Gintaras - 03-18-2020, 09:21 PM
RE: Drawing a line on a rectangle - by ssimop - 03-18-2020, 09:36 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)