Is there anyway I can derive a picture box's pixel height and width from a hDC?
Printable View
Is there anyway I can derive a picture box's pixel height and width from a hDC?
VB Code:
Private Declare Function WindowFromDC Lib "user32" ( _ ByVal hdc As Long) As Long Private Declare Function GetWindowRect Lib "user32" ( _ ByVal hwnd As Long, _ lpRect As RECT) As Long Private Type RECT Left As Long Top As Long Right As Long Bottom As Long End Type Private Sub Command1_Click() Dim winRECT As RECT GetWindowRect WindowFromDC(Picture1.hdc), winRECT With winRECT Debug.Print "Width: " & .Right - .Left Debug.Print "Height: " & .Bottom - .Top End With End Sub
Thanks :thumb: