Results 1 to 40 of 41

Thread: [RESOLVED] How to RESIZE a Picturebox with only TEXT in it?

Hybrid View

  1. #1
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: How to RESIZE a Picturebox with only TEXT in it?

    Quote Originally Posted by Antithesus
    Any thoughts on why I am getting a -1 back from your routine?
    Even when I start at 1 or greater... it still comes back with -1 for the very first GetPixel call.
    I finally broke down, made a test project and simplified the FindTop function.
    I've tested it and it works fine on a pic box, with or without the boarder.
    Code:
    Public Function FindTop(ByRef Pic As PictureBox, ByRef BackClr As Long) As Long
        Dim lX As Long
        Dim lY As Long
        Dim cMode As ScaleModeConstants
        
    '    'store the scalemode
        cMode = Pic.ScaleMode
        'set the picbox to pixels
        Pic.ScaleMode = vbPixels
        For lY = 0 To Pic.ScaleHeight - 1
            For lX = 0 To Pic.ScaleWidth - 1
                'search across the row to find a diff colored pixel
                If GetPixel(Pic.hDC, lX, lY) <> BackClr Then
                    FindTop = lY
                    Exit Function
                End If
            Next
        Next
    End Function
    I don't know why your getting that -1 on the 1st pixel :/
    try this one and see if it works

    Edit: spotted a bug, that FindTop = lX needed to be FindTop = lY
    I'm always getting my X's and Y's mixed up
    Last edited by longwolf; Oct 17th, 2008 at 12:28 PM.

  2. #2
    Frenzied Member longwolf's Avatar
    Join Date
    Oct 2002
    Posts
    1,343

    Re: How to RESIZE a Picturebox with only TEXT in it?

    Antithesus,
    just had a thought, are you using a PictureBox or an Image control?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width