Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations derfloh on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Rectangle

Status
Not open for further replies.

eramgarden

Programmer
Joined
Aug 27, 2003
Messages
279
Location
US
I want to create a canvas/rectangualr background, 500x700 and then put my image on top of the canvas

This is what I have but i only get a white rectangle with the font and NO IMAGE on top of it..

what am I missing?

Code:
Dim strFileToConvert As String
         strFileToConvert = "C:\source1.Tif"
        'Initialize the bitmap object by supplying the image file path
        Dim b As New Bitmap(strFileToConvert)

        Dim g As Graphics = Graphics.FromImage(b)

       [b] Dim rect = New Rectangle(0, 0, 500, 700)[/b]
        Dim bgBrush = New SolidBrush(System.Drawing.Color.White)

       [b] g.FillRectangle(bgBrush, rect)[/b]

        Dim bold As Font = New Font("Times New Roman", 14, FontStyle.Regular)
     
       [b] g.DrawString("Copyright © 1994-2004 ", bold, Brushes.Black, 10.0F, 350.0F) [/b]
      

      b.Save(strFileToConvert + ".jpeg", System.Drawing.Imaging.ImageFormat.Jpeg)
 
Try something like this:

Code:
Dim g as Graphics = Me.CreateGraphics()
Dim rect = New Rectangle(0, 0, 500, 700)
Dim bgBrush = New SolidBrush(System.Drawing.Color.White)
g.FillRectangle(bgBrush, rect)

strFileToConvert = "C:\ImagePath\Image.jpg"
Dim b As New Bitmap(strFileToConvert)
g.DrawImage(b, New Drawing.PointF(5, 5))
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top