![]() |
|
|||||||
| Home | Register | FAQ | Members List | Search | Today's Posts | Mark Forums Read |
| Share Your Creations Show your developed application to Basic4ppc community. Please include source code if possible. |
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
Hi
Until there are controls in the shape of gauges, I used poligons (Erel's suggestion) as demonstrated here: ..... triangle(track,40) Form5.FPolygon(alX,0,alY,0,4,Rgb(TRK.R,TRK.G,TRK.B ),f) Form5.FPolygon(alX,0,alY,0,4,cBlack) .... Sub Triangle(angle,k) angle = angle * cPI / 180 s = Sin(angle) c = Cos(angle) alX.Item(0) = center_x + k * s alY.Item(0) = center_y - k * c alX.Item(1) = center_x + 6 * c + 7 *s alY.Item(1) = center_y - 7 * c + 6 * s alX.Item(2) = center_x + 10 * s alY.Item(2) = center_y - 10 * c alX.Item(3) = center_x - 6 * c + 7 * s alY.Item(3) = center_y - 7 * c - 6 * s End Sub ..... and it is drawn on the background of an image of a map, so an image of the instrument is the same.
__________________
David Erez Ramat Hasharon, Israel |
|
||||
|
Very nice, David,
Your method allows scaling, thick lines, etc. A true alternative. A control would require a vector graphic as background image rather than a bitmap to allow virtually limitless scaling of the control's dimensions. |
|
||||
|
Being inspired by seeing alfcens' gauges I've been playing with pictures and polygons to make analogue gauges. To make it easier I've taken derez' code above, added a bit to it and parameterized it to make playing with different pointer shapes easier. Someone might be interested so I've posted it below. You can make a surprising number of different pointer styles by playing with different parameters!
|
![]() |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|