Does FireFly currently support drawing lines or boxes?
John[/u]
Unfortunately not really.... However, you can simulate lines and boxes using the Frame control. A Shape control is in the works for FireFly as well as several other controls.
Here is some code I put in the FORM PAINT event that draws boxes. I am posting it in case somebody is looking.
LOCAL hBrushInfo1 AS LOGBRUSH, hBrush1&, hPen1&, hDC1&
LOCAL ps1 AS PAINTSTRUCT
'RX
hBrushInfo1.lbColor=RGB(166,166,255) :'periwinkle
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
hDC1& = BEGINPAINT(hWndForm,ps1)
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 12, 28, 452, 76, 10, 10
'PATIENT
hBrushInfo1.lbColor=RGB(142,230,173) :'light green
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 12, 97, 706, 220, 10, 10
'DOCTOR
hBrushInfo1.lbColor=RGB(254,169,182) :'buff pink
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 12, 244, 380, 344, 10, 10
'DRUG
hBrushInfo1.lbColor=RGB(251,247,174) :'buff yellow
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 396, 244, 708, 344, 10, 10
'RX FILL
hBrushInfo1.lbColor=RGB(218,191,165) :'buff
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 12, 367, 708, 509, 10, 10
'PRICE
hBrushInfo1.lbColor=RGB(225,179,253) :'light purple
CREATEBRUSHINDIRECT hBrushInfo1 TO hBrush1&
SELECTOBJECT hDC1&, hBrush1&
ROUNDRECT hDC1&, 724, 97, 972, 509, 10, 10
hDC1& = ENDPAINT(hWndForm,ps1)
DELETEOBJECT hBrush1&
It is a bit hard to figure out where to put the box. Draw a frame and calculate the upper right / lower left then draw something inside of that with the position info in the property box. Once you have it set then delete the frame.
You will have to make your labels OPAQUE and set the color to the color of what you draw.
This make a pretty cool effect to group fields.
Enjoy.
Hi Mark,
Thanks for the code. You should note that you have a pretty severe GDI resource leak. Look at the Windows Task Manager as you resize your application. You will see the GDI object count skyrocket. The problem is that you are creating 6 brushes but only deleting it once at the end of the function. You also need to de-select the objetc from hDC prior to deleting it.
Try this code as an alternative:
Local hDC As Dword
Local hDC_Save As Dword
Local hBrush As Dword
Local ps1 As PAINTSTRUCT
hDC = BeginPaint(hWndForm,ps1)
hDC_Save = SaveDC( hDC )
'RX
hBrush = CreateSolidBrush( RGB(166,166,255) ) 'periwinkle
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 12, 28, 452, 76, 10, 10
' Delete the brush. Must put the old brush back into the hDC
' because you can not delete a brush if it is already in selected.
DeleteObject SelectObject( hDC, hBrush )
'PATIENT
hBrush = CreateSolidBrush( RGB(142,230,173) ) 'light green
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 12, 97, 706, 220, 10, 10
DeleteObject SelectObject( hDC, hBrush )
'DOCTOR
hBrush = CreateSolidBrush( RGB(254,169,182) ) 'buff pink
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 12, 244, 380, 344, 10, 10
DeleteObject SelectObject( hDC, hBrush )
'DRUG
hBrush = CreateSolidBrush( RGB(251,247,174) ) 'buff yellow
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 396, 244, 708, 344, 10, 10
DeleteObject SelectObject( hDC, hBrush )
'RX FILL
hBrush = CreateSolidBrush( RGB(218,191,165) ) 'buff
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 12, 367, 708, 509, 10, 10
DeleteObject SelectObject( hDC, hBrush )
'PRICE
hBrush = CreateSolidBrush( RGB(225,179,253) ) 'light purple
hBrush = SelectObject( hDC, hBrush )
RoundRect hDC, 724, 97, 972, 509, 10, 10
DeleteObject SelectObject( hDC, hBrush )
EndPaint hWndForm, ps1
RestoreDC hDC, hDC_Save
I thought I might have a problem because I could not delete the brush. It seems the SELECTOBJECT was the "trick".
Remember to do it for each brush that you create, otherwise you will leak a resource everytime you assign a new brush to your brush variable. Win2K and WinXP can tolerate these kinds of leaks for quite a while but Win98 will blow up very quickly when your application runs and the WM_PAINT messages are generated.