Results 1 to 3 of 3

Threaded View

  1. #1

    Thread Starter
    Join Date
    Jun 2013

    VB6 Rendering of Nodes in a Graph (with Hover over Connections)

    This cairo-(vbRichClient5)-dependent Demo will show (as the Title says) - how to efficiently
    implement a scenario, where you have to manage "connectable, draggable Boxes"
    (as in the Graph in the following screenshot):

    There's a green highlighted Connection (with an appropriate ToolTip), which can - (especially
    when the Path is complex) - often cause headaches with regards to: "how-to-implement".

    With cairo we have two nice calls available, which can help a great deal, when solving
    such more challenging "HitTest-problems":

    - cCairoContext.InFill(x, y)
    - cCairoContext.InStroke(x, y) <-- this one was used in the Demo

    So, what one basically has to do to accomplish a complex HitTest is, to simply apply the Path
    in question onto a CairoContext with the appropriate coordinates "as when truly rendered".

    Even better, such a cairo-context doesn't have to be derived from "something physically"
    (as e.g. a larger ImageSurface), a "virtual one" is already sufficient for that task.

    For that purpose (when working with the WidgetEngine, as in this Demo) - each cWidgetBase
    already offers such a context over W.MeasureContext.

    A slight problem I found was, that whilst CC.InFill always worked reliably, CC.InStroke was only
    delivering reliable Hits in 80-90% on the length of a complex Path (as e.g. the Beziers I used here,
    due to rounding-errors in the cairo-C-Source).

    Though I found a patch for that in the cairo-repo and backported that to the version (vb_cairo_sqlite.dll)
    which comes with the RichClient - in consequence CC.InStroke will now work equally reliable as CC.InFill.

    So the version of the RichClient (including the latest compile of vb_cairo_sqlite.dll) which will work
    well with the zipped Demo-Archive below, needs to be at least 5.0.24
    - please visit the Download-
    page at vbRichClient.com and update your package appropriately before running it.

    Here's the Demo-Zip:

    Have fun...

    Last edited by Schmidt; Apr 15th, 2015 at 07:35 PM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts


Click Here to Expand Forum to Full Width