I cannot stretch picture loaded in a picturebox according to picturebox scale. I don't know what is the problem with this code. Can anybody help me find the problem?
VB Code:
  1. Private Sub picPatient_Click()
  2. On Error Resume Next
  3. Dim sPathPic As String, currentID As Long
  4. If rec("img_path") = "" Then
  5.     If MsgBox("Do you want to add picture?", vbYesNo + vbQuestion, "Add picture") = vbYes Then
  6.         'Add picture here
  7.         cdOpen.Filter = "JPEG |*.jpg"
  8.         cdOpen.ShowOpen
  9.         sPathPic = Replace(cdOpen.FileName, "\", "\\")
  10.         con.Execute "UPDATE maklumat_pesakit img_path SET img_path = '" & sPathPic & "' WHERE id = " & rec(0) & ";"
  11.         currentID = CLng(rec(0))
  12.         Form_Load
  13.         rec.Find "[ID] = " & currentID
  14.         Exit Sub
  15.     End If
  16. Else
  17.     If MsgBox("Do you want to remove this picture?", vbYesNo + vbQuestion, "Remove picture") = vbYes Then
  18.         con.Execute "UPDATE maklumat_pesakit img_path SET img_path = '' WHERE id = " & rec(0) & ";"
  19.         Set picPatient.Picture = Nothing
  20.         currentID = CLng(rec(0))
  21.         Form_Load
  22.         rec.Find "[ID] = " & currentID
  23.         Exit Sub
  24.     End If
  25. End If
  26. End Sub
  27.  
  28. Private Sub picPatient_Resize()
  29.     picPatient.PaintPicture picPatient.Picture, 0, 0, picPatient.ScaleWidth, picPatient.ScaleHeight
  30. End Sub