Text with outine

  • Thread starter Thread starter Johnny Holland
  • Start date Start date
J

Johnny Holland

Hi,
I am working on a presentation tool (Powerpoint like) that allows the
user to display text over a picture background. One of the best ways
to make the text stand out would be to put a black outline around the
text if it is white (or white outline if black). I have been looking
at the DrawString method but it seems to just allow me to put some
text behind other text creating a shadow effect which is not what I
want.
Anyone got any other ideas about how I could achieve this.
Thanks in anticipation,
Johnny
 
* (e-mail address removed) (Johnny Holland) scripsit:
I am working on a presentation tool (Powerpoint like) that allows the
user to display text over a picture background. One of the best ways
to make the text stand out would be to put a black outline around the
text if it is white (or white outline if black). I have been looking
at the DrawString method but it seems to just allow me to put some
text behind other text creating a shadow effect which is not what I
want.

Quick and Dirty:

\\\
Dim gp As New Drawing2D.GraphicsPath( _
Drawing2D.FillMode.Alternate _
)
gp.AddString( _
"Hello World!", _
FontFamily.GenericSerif, _
FontStyle.Bold, _
28.0F, _
New Point(20, 20), _
StringFormat.GenericTypographic _
)
e.Graphics.DrawPath(Pens.Blue, gp)
gp.Dispose()
///
 
Sorry for being a bit stupid, but how do I implement this? When I
stick it behind a button, I get the error that e is not valid.
Thanks, J
 
* (e-mail address removed) (Johnny Holland) scripsit:
Sorry for being a bit stupid, but how do I implement this? When I
stick it behind a button, I get the error that e is not valid.

For example, in the form's 'Paint' event handler, or you can override
the form's 'OnPaint' method and place the code there.
 
Hi,

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click

Dim g As Graphics = PictureBox1.CreateGraphics
Dim gp As New Drawing2D.GraphicsPath
gp.AddString( _
"Hello World!", _
FontFamily.GenericSerif, _
FontStyle.Bold, _
28.0F, _
New Point(20, 20), _
StringFormat.GenericTypographic)

g.FillPath(Brushes.SkyBlue, gp)
g.DrawPath(Pens.Black, gp)

End Sub
Ken
 
Johnny said:
*Hi,
I am working on a presentation tool (Powerpoint like) that allow
the
user to display text over a picture background. One of the best ways
to make the text stand out would be to put a black outline aroun
the
text if it is white (or white outline if black). I have been looking
at the DrawString method but it seems to just allow me to put some
text behind other text creating a shadow effect which is not what I
want.
Anyone got any other ideas about how I could achieve this.
Thanks in anticipation,
Johnny *
I want to do the same thing, but found I have to create all my text t
wordart. I use a macro to convert the words in powerpoint to wordart.
This is for Church music, and have some formatting specific to ou
music format, but here is the code I wrote to convert each slide t
outlined text using wordart:
Sub Macro1()
'
'
'
Dim sld As Slide
Dim shp As Shape
Dim txt As String
Dim i As Integer
Dim blnns As Boolean

For i = 1 To ActivePresentation.Slides.Count
Set sld = ActivePresentation.Slides.Item(i)
sld.Select

If sld.Shapes.Count > 0 Then
If sld.Shapes.Item(1).HasTextFrame Then
txt = sld.Shapes.Item(1).TextFrame.TextRange.Text
txt = Replace(txt, Chr(11), Chr(13), 1, -1, vbTextCompare)
If Left(txt, 1) = Chr(13) Then
txt = Mid(txt, 2)
End If
If Right(txt, 1) = Chr(13) Then
txt = Mid(txt, 1, Len(txt) - 1)
End If
If txt <> "" Then

sld.Shapes.Item(1).Delete 'delete the original text box
Set shp = sld.Shapes.AddTextEffect(msoTextEffect1, txt
"Arial Black", 40, msoFalse, msoFalse, 67.88, 72)

With shp
.Line.Weight = 2
.Line.Visible = msoTrue
.Line.Style = msoLineSingle
.Shadow.ForeColor.SchemeColor = ppForeground
.Shadow.Visible = msoTrue
.ThreeD.Visible = msoFalse
.Top = 72
If .Width > 9.75 * 72 Then
.Width = 9.75 * 72
End If

.Select
ActiveWindow.Selection.ShapeRange.Distribut
msoDistributeHorizontally, msoCTrue
End With
If blnns Then
With sld.Shapes.AddLine(2 * 72, 99, 6 * 72, 99)
.Line.Weight = 3
.Line.ForeColor.RGB = vbWhite
.Shadow.ForeColor.SchemeColor = ppForeground
.Shadow.Visible = msoTrue
.ThreeD.Visible = msoFalse
.ZOrder msoSendToBack
End With
blnns = False
End If
End If
End If
Else
blnns = True

End If
Next
End Su


-
brieb
 
Johnny said:
*Hi,
I am working on a presentation tool (Powerpoint like) that allow
the
user to display text over a picture background. One of the best ways
to make the text stand out would be to put a black outline aroun
the
text if it is white (or white outline if black). I have been looking
at the DrawString method but it seems to just allow me to put some
text behind other text creating a shadow effect which is not what I
want.
Anyone got any other ideas about how I could achieve this.
Thanks in anticipation,
Johnny *
I want to do the same thing, but found I have to create all my text t
wordart. I use a macro to convert the words in powerpoint to wordart.
This is for Church music, and have some formatting specific to ou
music format, but here is the code I wrote to convert each slide t
outlined text using wordart:
Sub Macro1()
'
'
'
Dim sld As Slide
Dim shp As Shape
Dim txt As String
Dim i As Integer
Dim blnns As Boolean

For i = 1 To ActivePresentation.Slides.Count
Set sld = ActivePresentation.Slides.Item(i)
sld.Select

If sld.Shapes.Count > 0 Then
If sld.Shapes.Item(1).HasTextFrame Then
txt = sld.Shapes.Item(1).TextFrame.TextRange.Text
txt = Replace(txt, Chr(11), Chr(13), 1, -1, vbTextCompare)
If Left(txt, 1) = Chr(13) Then
txt = Mid(txt, 2)
End If
If Right(txt, 1) = Chr(13) Then
txt = Mid(txt, 1, Len(txt) - 1)
End If
If txt <> "" Then

sld.Shapes.Item(1).Delete 'delete the original text box
Set shp = sld.Shapes.AddTextEffect(msoTextEffect1, txt
"Arial Black", 40, msoFalse, msoFalse, 67.88, 72)

With shp
.Line.Weight = 2
.Line.Visible = msoTrue
.Line.Style = msoLineSingle
.Shadow.ForeColor.SchemeColor = ppForeground
.Shadow.Visible = msoTrue
.ThreeD.Visible = msoFalse
.Top = 72
If .Width > 9.75 * 72 Then
.Width = 9.75 * 72
End If

.Select
ActiveWindow.Selection.ShapeRange.Distribut
msoDistributeHorizontally, msoCTrue
End With
If blnns Then
With sld.Shapes.AddLine(2 * 72, 99, 6 * 72, 99)
.Line.Weight = 3
.Line.ForeColor.RGB = vbWhite
.Shadow.ForeColor.SchemeColor = ppForeground
.Shadow.Visible = msoTrue
.ThreeD.Visible = msoFalse
.ZOrder msoSendToBack
End With
blnns = False
End If
End If
End If
Else
blnns = True

End If
Next
End Su


-
brieb
 
Back
Top