Draw text on a image and save the result

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Rob Willaar

    Draw text on a image and save the result

    Hi All,

    I try to draw text on a picturebox.
    The text appears but it is drawn on top of the picture.
    when i try to save the result the text is gone.



  • Cor Ligthert

    #2
    Re: Draw text on a image and save the result

    Rob,

    You should draw in my opinon that text on the underlaying bitmap. You can
    draw on any place on a form text.

    Cor


    Comment

    • Herfried K. Wagner [MVP]

      #3
      Re: Draw text on a image and save the result

      "Rob Willaar" <r.willaar@xs4a ll.nl> schrieb:[color=blue]
      > I try to draw text on a picturebox.
      > The text appears but it is drawn on top of the picture.
      > when i try to save the result the text is gone.[/color]

      Instead of drawing onto the picturebox, draw onto the bitmap directly:

      \\\
      Dim b As New Bitmap(...) ' Take a look at the overloaded constructor.
      Dim g As Graphics = Graphics.FromIm age(b)
      g.DrawImage(... )
      g.DrawString(.. .)
      g.Dispose()
      b.Save(...)
      b.Dispose()
      ///

      --
      M S Herfried K. Wagner
      M V P <URL:http://dotnet.mvps.org/>
      V B <URL:http://classicvb.org/petition/>

      Comment

      • Bob Powell [MVP]

        #4
        Re: Draw text on a image and save the result

        Read the #1 GDI+ FAQ article then browse to the article that explains how to
        draw text on an image.

        --
        Bob Powell [MVP]
        Visual C#, System.Drawing

        Find great Windows Forms articles in Windows Forms Tips and Tricks


        Answer those GDI+ questions with the GDI+ FAQ


        All new articles provide code in C# and VB.NET.
        Subscribe to the RSS feeds provided and never miss a new article.





        "Rob Willaar" <r.willaar@xs4a ll.nl> wrote in message
        news:425b5e5f$0 $152$e4fe514c@n ews.xs4all.nl.. .[color=blue]
        > Hi All,
        >
        > I try to draw text on a picturebox.
        > The text appears but it is drawn on top of the picture.
        > when i try to save the result the text is gone.
        >
        >
        >[/color]


        Comment

        Working...