PlaceFromHDC (Depth as long) as long

Description

Method converts drawings from built-in .hDC (sceen/printer drawing handle emulation for drawing in flash movie using WinGDI API functions) into the sprite (movieclip) and places this new sprite(movieclip) to the given depth on the scene.

You can draw directly on .hDC or play metafiles (EMF, WMF) to .hDC using PlayMetaFileToHDC method. Most WinGDI commands and EMF files are supported but to get high-quality rendering that is required for complex metafiles and drawings (reports with many objects and gradients, metafiles made by virtual printers etc) you should set HDC_HighQuality and HDC_HighQuality_UseBuffer to True (usage of high quality EMF2SWF mode requires additional "HDC High Quality License" in registered version of library)

To get size of EMF metafile (if you need to fit metafile to the movie size) please use IEMFFileInfo interface object

Only one single visual object can be placed into the given depth. To remove object set PLACE_AutoRemoveDepth to True to automatically replace object with new when new object is placed into the same depth or remove object from depth using RemoveObject method



See also:


Parameters

ObjectIndex - index of existing image object to be used to create new shape and place this image to the scene
Depth - depth on the scene to place image into. In most cases you can use .CurrentMaxDepth to automatically set max available depth. Up to 65000 depths are available. If you need to create animation then you should store .CurrentMaxDepth
to variable and then use sequence: create visual object, place to the scene, show frames, remove from scene, place it again, move object using PLACE_ methods and properties, show frames again

Example on moving visual object in the movie:

Shape = Movie.AddShape
Movie.SHAPE_Rectangle 0, 40, 150, 165
Movie.SHAPE_SetSolidColor 145,245,245,true,255

StoredDepth = Movie.CurrentMaxDepth

For i=0 to 100
       Movie.RemoveObject StoredDepth
       Movie.PlaceShape Shape, StoredDepth
       Movie.PLACE_SetPosition 10+i*2, 10+2*i
       Movie.ShowFrame 1
Next


Result

Returns index of new PLACE_ object in zero-based PLACE objects collection

Example:

Visual Basic / VBScript / ASP:



C#:



C++:

       // initialize library
       Movie->InitLibrary("demo", "demo");

       // start movie generation
       Movie->BeginMovie(0,0,640,480,sscTwips, 12,6);
       // drawing on a rectangle via WinAPI GDI functions

       RECT rRect;
       rRect.top = 0; rRect.left= 0; rRect.right= 640; rRect.bottom=480;
       long SymbolsCount = 42; // number of symbols in "Hello! Test using .hDC and WinGDI's DrawText" string
       DrawText((HDC)Movie->HDC,"Hello! Test using .hDC and WinGDI DrawText",SymbolsCount,&rRect,DT_CENTER);

       Movie->PlaceFromHDC(1); // place shape into current depth
       Movie->ShowFrame(1); // show 10 frames
       Movie->EndMovie(); // end movie generation
       Movie->SaveToFile("c:\\Hello_WithhDC.swf"); // save generated SWF into file

Also Check Examples