Thomas Krumbein wrote:
Hey,

I am working on a project, in which I display embedded graphics of a
writer-document in a dialog.

With some help of this list (spezial thanks to Fernand ;-) ) I can now
show the embedded graphics dirct on the dialog.

I use for this the following code:

        REM URL des Bildes auslesen
        oBild = oDoc.getGraphicObjects().getByName(sName)
        sBildURL = Mid(oBild.GraphicURL, 28, len(oBild.GraphicURL))
        REM Bild aus Datei als Objekt laden
        for i = 0 to uBound(aBildNamen())
                if InStr(1, aBildNamen(i), sBildURL, 0) then
                        oVorschauGrafik =
getGraphFromStream(oPictures.getByName(aBildNamen(i)).getInputStream())
                        exit For
                end if
        next
        REM Porportionfaktor Laden
        nProp =
oVorschauGrafik.sizepixel.width/oVorschauGrafik.sizepixel.height  ' < 1
= Hochkant, >1 -Querformat, = 1 Quadrat

'       oRenderer = createUnoService("com.sun.star.graphic.GraphicRendererVCL")
        Dim sRect as new com.sun.star.awt.Rectangle
        sRect.X = 335
        sRect.Y = 40
        sRect.Width = 150
        sRect.Height = 150
        if nProp < 1 then   'Hochkant
          sRect.Width = 150 * nProp
          sRect.X = 335 + (150 - sRect.Width)/2
        elseif nProp > 1 then  'Querformat
                sRect.Height = 150 / nProp
                sRect.Y = 40 + (150 - sRect.Height)/2
        end if
        
        oPaintListener = CreateUnoListener("MyDialog_",
"com.sun.star.awt.XPaintListener")

        oDlg.Peer.addPaintListener( oPaintListener )

        oRenderer.Device = oDlg.Peer.createGraphics.Device
        oRenderer.DestinationRect = sRect
        oRenderer.render(oVorschauGrafik)

The renderer is defined in a seperat Part of the macro:

        oRenderer = createUnoService("com.sun.star.graphic.GraphicRendererVCL")


The Problem is now, that I use the same part of the dialog to show
selected graphics. That is no problem, when all graphics have the same
size and do not have transparent Pixels. The renderer will change the
used Pixels.

But it is a problem, when I read a smaler graphic - or a transparent
gif-graphic - then you will see the prior graphic on not used pixels of
the rectangular area.

So my question: How can I remove the rendered graphic from diolog? Or is
there a posbility, to overwirte the whole area with the
background-pixelcolour?
/i struggeld also long time to solve this problem
then a clever gui on the forum who learned us to use a peer dow to render a graphic, found also the solution: "invalidate" the window for "invalidating" there are several way's depending on what part of the window hes to been refresched .OO uses rheir famous constants for it (I uses "2" ) who works fine

gives you dialog a unique name as "dialog1"   and uses thisi code:

oWin =GetWindowOpen("Dialog1") 'the titel of the dialog must be "Dialog1' oWin.invalidate(2) ' 2 works fine but there are other constants ans combinations posibla

function GetWindowOpen(sTitle as String) as Object
oToolkit = Stardesktop.ActiveFrame.ContainerWindow.Toolkit
lCount = oToolkit.TopWindowCount
' xray otoolkit
for k=0 to lCount -1
 oWin = oToolkit.getTopWindow(k)
 if HasUnoInterfaces(oWin, "com.sun.star.awt.XDialog") then
   if left(oWin.Title, len(sTitle)) = sTitle then '
     GetWindowOpen = oWin
     exit function
     endif
   endif
 next k
end function

hope it helps
Fernand



/
"
Thanks or your help

Thomas



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to