Again SnapShot3 issue

Nov 23, 2012 at 5:30 PM

Hello everybody,

I use the folowing vba-code to print a snapshot to scale. The Problem is  my jpg file is always White. I think I've made a Logical error - but don't know which. Can anybody help?

' calculate upper right coordinate - in metres
    Forms!frmMap.mapMain.PixelToProj Forms!frmMap.mapMain.Width / 10, 0, dblX, dblY
    varRechtsOben(0) = dblX
    varRechtsOben(1) = dblY
    ' calculate lower left coordinate
    Forms!frmMap.mapMain.PixelToProj 0, Forms!frmMap.mapMain.Height / 10, dblX, dblY
    varLinksUnten(0) = dblX
    varLinksUnten(1) = dblY
    
    ' calculate the centre coordinate - again in metres
    dblMiddleX = (varRechtsOben(0) + varLinksUnten(0)) / 2
    dblMiddleY = (varRechtsOben(1) + varLinksUnten(1)) / 2
    
    ' calculate width an height of the window
    ' dblMassstab is the scale i.e. 1000 
    dblWidth = dblWidth / 100 * dblMassstab
    dblHeight = dblHeight / 100 * dblMassstab
    
    ' calculate new lower left coordinate in metres
    varLinksUnten(0) = dblMiddleX + dblWidth / 2
    varLinksUnten(1) = dblMiddleY - dblHeight / 2
    ' coordinate to pixel   
    Forms!frmMap.mapMain.ProjToPixel varLinksUnten(0), varLinksUnten(1), dblX, dblY
    varLinksUnten(0) = dblX
    varLinksUnten(1) = dblY
    
    ' same for upper right coordinate
    varRechtsOben(0) = dblMiddleX - dblWidth / 2
    varRechtsOben(1) = dblMiddleY + dblHeight / 2
    ' Koordinate in Pixel umrechnen
    Forms!frmMap.mapMain.ProjToPixel varRechtsOben(0), varRechtsOben(1), dblX, dblY
    varRechtsOben(0) = dblX
    varRechtsOben(1) = dblY
    
    ' calculate width of jpg
    dblWidth = objRec!AbbildungBreite / 2.54 * 300
    
    ' create snapshot
    Set imgMapImage = Forms!frmMap.mapMain.SnapShot3(varLinksUnten(0), varRechtsOben(0), _
    varRechtsOben(1), varLinksUnten(1), dblWidth)
Nov 23, 2012 at 7:54 PM

Hello again,

I'm so sorry - typical me! The first mistake was that I don't have to use ProjToPixel but to hand real-world coordinates to the SnapShot3-Function, as I did in my first version. The second mistake (so typical of me): I swaped left and right!

If anybody likes it, I could provide the correct code.

Thanks again and I'm sorry for being that stupid.