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:
Private Sub picPatient_Click() On Error Resume Next Dim sPathPic As String, currentID As Long If rec("img_path") = "" Then If MsgBox("Do you want to add picture?", vbYesNo + vbQuestion, "Add picture") = vbYes Then 'Add picture here cdOpen.Filter = "JPEG |*.jpg" cdOpen.ShowOpen sPathPic = Replace(cdOpen.FileName, "\", "\\") con.Execute "UPDATE maklumat_pesakit img_path SET img_path = '" & sPathPic & "' WHERE id = " & rec(0) & ";" currentID = CLng(rec(0)) Form_Load rec.Find "[ID] = " & currentID Exit Sub End If Else If MsgBox("Do you want to remove this picture?", vbYesNo + vbQuestion, "Remove picture") = vbYes Then con.Execute "UPDATE maklumat_pesakit img_path SET img_path = '' WHERE id = " & rec(0) & ";" Set picPatient.Picture = Nothing currentID = CLng(rec(0)) Form_Load rec.Find "[ID] = " & currentID Exit Sub End If End If End Sub Private Sub picPatient_Resize() picPatient.PaintPicture picPatient.Picture, 0, 0, picPatient.ScaleWidth, picPatient.ScaleHeight End Sub




Reply With Quote