Upload an image in a form window control in MSD axapta

Upload an image in a form window control

 str filename;  
 FileNameFilter filter = ['JPG files','*.jpg'];  
 Bindata binData;  
 Image signatureImage = new Image();  
 super();  
 filename = Winapi::getOpenFileName(element.hWnd(), filter, '', "Upload your image", '', '');  
 binData = new BinData();  
 if (binData.loadFile(filename))  
 {  
 signatureImage = binData.getData();  
 FormWindowCOntrol.image(signatureImage);  
 FormWindowCOntrol.widthValue(signatureImage.width());  
 FormWindowCOntrol.heightValue(signatureImage.height());  
 element.resetSize();  
 element.unLock();  
 }