:Start of olepic
![]() | ![]() |
|---|
If you are viewing this script in your browser you can save it as a VDS 5.x source file (*.dsc) to run it.
#
# DragonSphere Software's Home Page
#
# All Source Files for this demo
#
# This demo shows how to use the OLE Picture commands and functions
#
Title Ole Picture View
If @Greater(@Name(@SYSINFO(DSVER)),4)
External GadgetX.dll,@SysInfo(DSVER)
#DEFINE COMMAND,OLE,SET,DEFINE,SETWIN,FIREEVENT
#DEFINE FUNCTION,OLE,GET,GETWIN,HIMETRICTOPIXEL,PIXELTOHIMETRIC,GETLASTERROR
Else
Warn This demo was designed to work with@CR()VDS 5.x from http://www.dialogscript.com
Stop
End
Define variable,Object,objbmp
Ole Init
%%ClassName = #OPV
DIALOG CREATE,Ole Picture View,-1,0,640,480,CLASS OPV,PAINT,RESIZABLE
REM *** Modified by Dialog Designer on 10/24/2006 - 14:26 ***
DIALOG ADD,MENU,&File,&Open,E&xit
DIALOG ADD,STATUS,STATUS1,
DIALOG SHOW
Set objbmp,@Ole(Picture,Load,Morning Star.jpg)
:evloop
wait event
%E = @Event()
If %E
goto %E
End
goto evloop
:OPENMENU
%F = @filedlg("Image files (*.jpg, *.bmp, *.gif, *.ico)|*.jpg;*.bmp;*.gif;*.ico|All files (*.*)|*.*",Choose an Image)
If @Ok()
if @Get(objbmp)
Ole Free,Object,objbmp
end
Set objbmp,@Ole(Picture,Load,%F)
SetWin Background,UPDATE,%%ClassName
End
goto evloop
:RESIZE
:PAINT
If @Get(objbmp)
%%hmWidth = @Ole(Picture,Width,objbmp)
%%hmHeight = @Ole(Picture,Height,objbmp)
%%PixWidth = @HiMetricToPixel(X,%%hmWidth)
%%PixHeight = @HiMetricToPixel(Y,%%hmHeight)
%%HDC = @GetWin(HDC,CLIENT,%%ClassName)
Ole Picture,Render,objbmp,%%HDC,0,0,%%PixWidth,%%PixHeight,0,%%hmHeight,%%hmWidth,-%%hmHeight
SetWin HDC,Released,%%ClassName,%%HDC
Dialog SetPos,,,,%%PixWidth,@Sum(%%PixHeight,20)
Dialog Set,STATUS1,HMWidth = %%hmWidth HMHeight = %%hmHeight PixWidth = %%PixWidth PixHeight = %%PixHeight
End
goto evloop
:EXITMENU
:CLOSE
if @Get(objbmp)
Ole Free,Object,objbmp
end
Ole UnInit
Exit
copyright © DragonSphere Software 2000-2006
Terms and Conditions