-3

I have tried to google for hours in attempt to get a way to apply a texture picture in a string, like for example:

I have a string and I want to apply a pattern or a texture into the string. Is there any way to do it in VB 2012?

Thank you in advance :)

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188
ines
  • 117
  • 10
  • 1
    Start by looking at the `GraphicsPath` class. – jmcilhinney Jul 14 '18 at 16:01
  • You should give more information. What technology are you using (winforms, Unity, ...)? Are you drawing on a Form on a bitmap, something else? What have you tried so far? Please show some code. (Then maybe your question will be upvoted again) – Olivier Jacot-Descombes Jul 14 '18 at 16:32

1 Answers1

0

You can draw a string by using a texture brush.

This example draws into a label of a winforms form (could be any other control or the form itself

Private Sub Label1_Paint(sender As Object, e As PaintEventArgs) Handles Label1.Paint
    Dim fileName = "C:\somepath\myImage.png"

    Dim image1 = Image.FromFile(fileName, True)

    Dim texture As New TextureBrush(image1)
    texture.WrapMode = Drawing2D.WrapMode.Tile

    Dim font As New Font("Arial", 20, FontStyle.Bold)

    e.Graphics.DrawString("Hello", font, texture, 10, 10)
End Sub

Result:

enter image description here

Olivier Jacot-Descombes
  • 104,806
  • 13
  • 138
  • 188