Bottom of Image

eramgarden

Well-known member
Joined
Mar 8, 2004
Messages
579
I have a 500x700 canvas, have an image on top of it...

I want to find where the image ends on the canvas and add a line of text to the bottom ...images can be of different height and width

I tried to use Height of canvas, height of image , subtract...but i dont think that would work because i need the values in pixels...not sure...

This is what i have-
Code:
Dim strFileToConvert As String

        strFileToConvert = "C:\source2.Tif"
        Initialize the bitmap object by supplying the image file path
        Dim b As New Bitmap(strFileToConvert)
       [b] Dim Canvas As New Bitmap(500, 700) [/b]

        Dim g As Graphics = Graphics.FromImage(b)
        Dim gr As Graphics = Graphics.FromImage(Canvas)

        get size of the image
      [b]  Dim ImageHieght = b.Height()
        Dim CanvasHeight = Canvas.Height() [/b]

        Dim bgBrush = New SolidBrush(System.Drawing.Color.White)

        gr.FillRectangle(bgBrush, New Rectangle(0, 0, 500, 700))
        gr.DrawImage(b, 0.0F, 0.0F)

              Dim copy As Font = New Font("Times New Roman", 9, FontStyle.Regular)


        gr.DrawString("Copyright
 
Whats wrong with
Convert.ToSingle(b.Height)
?
It has always returned height in pixels for me. :)
Also, use & for string concatenation in VB instead of +.
 
Back
Top