Solidworks/VB.NET SaveBMP() Not Saving Bitmap Consistently -


i have vb.net program redimensions parts , assemblies in solidworks , shows image of assembly drawing in panel using savebmp(). issue not showing image - whenever user moves location of dimension in solidworks drawing, entire location , size of bitmap changes , need go code readjust crop , resize values.

saving drawing bitmap image:

      swmodel.savebmp(bmpname, 1700, 1100) '17x11 aspect ratio 

cropping image remove white space:

  function cropdrawing(byval oldimage image) image     cropdrawing = nothing     dim x integer = getvalue(frmimagescale.txtcropx.text)     dim y integer = getvalue(frmimagescale.txtcropy.text)     dim width integer = getvalue(getvalue(frmimagescale.txtcropw.text))     dim height integer = getvalue(frmimagescale.txtcroph.text)     dim croprect new rectangle(x, y, width, height)     try         dim cropimage bitmap = new bitmap(croprect.width, croprect.height)         using grp = graphics.fromimage(cropimage)             grp.drawimage(oldimage, new rectangle(0, 0, cropimage.width, cropimage.height), croprect, graphicsunit.pixel)             oldimage.dispose()             'resave             cropimage.save(bmpname)         end using         return cropimage     catch ex exception         'caught if width , height = 0     end try end function 

resizing image fit panel:

public function resizeimage(byval oldimage image, byval targetwidth integer, byval targetheight integer) system.drawing.image     return new bitmap(oldimage, targetwidth, targetheight) end function 

once bitmap created, crop image , resize fill panel.

any suggestions on why happening appreciated!


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -