Re: Adding an Edge to Text

From: Mike D Sutton _at_ Work (_at_)
Date: 06/07/04


Date: Mon, 7 Jun 2004 16:28:16 +0100


> i need to add edges and shodows to my text. I seem to get drop showdows but
> can't figure out edging?
<code snipped>

A simple shadow effect can be achieved by drawing the string offset horizontally and vertically beneath the text, however for a soft
shadow effect you'd need to create a back buffer, blur it and overlay this beneath the text - there's a demo of this on my site if
you need it.
As for the outline there's two ways you can go about it, the first is to draw the text either 4 or 8 times with different offsets
around the original position before drawing the final text string as Larry mentioned. The benefit of this technique is that it
gives you a nice anti-aliased edge (as long as the font you're drawing with is set to anti-alias) however for larger borders and on
very tin text the effect is quite quickly lost.
In these cases you may wish to opt for the GDI path technique instead; open a path bracket on the target DC and draw your text to
it, then close the path bracket and your path now has an outline of the text string which can be stroked and/or filled using the
StrokePath()/FillPath()/StrokeAndFillPath() API calls.
The benefit of this method is that the edge can be any thickness you wish, however you're limited to aliased drawing since GDI's pen
objects will be handling the drawing rather than the text engine.
Hope this helps,

    Mike

 - Microsoft Visual Basic MVP -
E-Mail: EDais@mvps.org
WWW: http://www.mvps.org/EDais/



Relevant Pages

  • Re: API - how to unhide all sketches of an assembly in drawing views
    ... Dim strFullSketcName As String ... swApp.SendMsgToUser ("Document is not drawing") ... Exit Sub ... Set oView = oDrwDoc.GetFirstView 'first view is the drwing sheet sketch ...
    (comp.cad.solidworks)
  • Re: Check If Drawing Page Is Loaded
    ... Try cycling through the drawing pages and doing a GraphicsRedraw2 call ... The problem is that the PDF sometimes has empty views. ... String, ByVal lpParameters As String, ByVal lpDirectory As String, ... Exit Sub ...
    (comp.cad.solidworks)
  • Check If Drawing Page Is Loaded
    ... It saves a PDF of a Solidworks drawing on our network ... The problem is that the PDF sometimes has empty views. ... String, ByVal lpParameters As String, ByVal lpDirectory As String, ... Exit Sub ...
    (comp.cad.solidworks)
  • Re: Next Issue?!
    ... Optional IsLastDwg As Boolean = False) As String ... 'Create an alphanumerically incremented drawing number for the ... Dim iCtr As Integer ... that it would create a new entry in that table at the next logical issue. ...
    (microsoft.public.access.modulesdaovba)