Re: Common Interface for objects that expose VB-drawing-API
- From: Alexander Mueller <millerax@xxxxxxxxxxx>
- Date: Wed, 24 May 2006 18:28:25 +0200
Mike D Sutton schrieb:
[..]VB.Form, VB.PictureBox and VB.Printer .. share these VB-Drawing methods
like PaintPicture, PSet, Line, Circle, Print, Cls
and props like CurrentX, CurrentY, DrawMode, DrawWidth, FillColor
and some more.
Is there a name for a common COM-interface that these VB-objects implement, so that if i can specify this interface-type for an
argument of a method, rather then the generic 'Object'-type?
My current signature is:
Public Sub GetMaxTextEntend _
( _
oCtrl As Object, _
oNewContainer As Object, _
ByRef sngMaxTextWidth As Single, _
ByRef sngMaxTextHeight As Single _
)
where >> oNewContainer As Object, >> >> should by replaced by
oNewContainer As IVBContainerForDrawing,
Now does this interface exist and does it have a name?
Simple answer is no, there is no (public) interface defined that exposes these methods.
You could however write a reasonably simple little class which exposes these methods, and internally stores an Object. In the Property Set for the internal object, validate the object you're being passed to make sure it implements the required methods (either by calling them and trapping errors, or just use TypeOf.)
Not quite as elegant, but it is type safe and will offer intellisense at design time.
Hi Mike,
Thanks for your response, writing a class is
probably a good idea, will give it try.
MfG,
Alex
.
- References:
- Common Interface for objects that expose VB-drawing-API
- From: Alexander Mueller
- Re: Common Interface for objects that expose VB-drawing-API
- From: Mike D Sutton
- Common Interface for objects that expose VB-drawing-API
- Prev by Date: Re: Common Interface for objects that expose VB-drawing-API
- Next by Date: Endpoint from AngleArc
- Previous by thread: Re: Common Interface for objects that expose VB-drawing-API
- Next by thread: Endpoint from AngleArc
- Index(es):
Loading