Entry screeshot current window to a file
Posted: Sun Jul 16, 2017 3:41 pm
How to record, screeshot current window to a file? After use, the operation of the image rotation function: DC_Scrn2ImageFile() saves a black screen
Donnay Software Web Forums
http://bb.mobile.donnay-software.com/Donnay/
http://bb.mobile.donnay-software.com/Donnay/viewtopic.php?f=2&t=2224
Code: Select all
***** Надписи наименований шкал Y и X
oFont := XbpFont():new():create("12.Arial Bold")
GraSetFont(oPS , oFont) // установить шрифт
aAttrF := ARRAY( GRA_AS_COUNT )
aAttrF [ GRA_AS_COLOR ] := GRA_CLR_BLACK
aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_CENTER // Выравнивание символов по горизонтали по центру относительно точки начала вывода
aAttrF [ GRA_AS_VERTALIGN ] := GRA_VALIGN_HALF // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
GraSetAttrString( oPS, aAttrF ) // Установить символьные атрибуты
AxName = '['+ALLTRIM(STR(mOpSc))+']-'+mNameOpSc
aTxtPar = DC_GraQueryTextbox(AxName, oFont) // {101,16} Определяет длину и высоту текста в пикселях для некоторых шрифтов
GraStringAt( oPS, { dXcf+(mMaxXcf-dXcf)/2-aTxtPar[1]/2, 10}, AxName ) // Надпись оси Х
AyName = '['+ALLTRIM(STR(mClSc))+']-'+mNameClSc
aTxtPar = DC_GraQueryTextbox(AyName, oFont) // {101,16} Определяет длину и высоту текста в пикселях для некоторых шрифтов
aMatrix := GraInitMatrix()
GraRotate( oPS, aMatrix, 90, { 15, dYcf+(mMaxYcf-dYcf)/2-aTxtPar[1]/2 }, GRA_TRANSFORM_ADD )
oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )
GraStringAt( oPS, { 15, dYcf+(mMaxYcf-dYcf)/2-aTxtPar[1]/2 }, AyName ) // Надпись оси Y
*** Наименования значений фактора писать с поворотом на 90 градусов
oFont := XbpFont():new():create("9.Arial Bold")
GraSetFont(oPS , oFont) // установить шрифт
aAttrF := ARRAY( GRA_AS_COUNT )
aAttrF [ GRA_AS_COLOR ] := GRA_CLR_BLACK
aAttrF [ GRA_AS_HORIZALIGN ] := GRA_HALIGN_RIGHT // Выравнивание символов по горизонтали по правому краю относительно точки начала вывода
aAttrF [ GRA_AS_VERTALIGN ] := GRA_VALIGN_HALF // Выравнивание символов по вертикали по средней линии относительно точки начала вывода
GraSetAttrString( oPS, aAttrF ) // Установить символьные атрибуты
FOR j=1 TO LEN(aAvrGrIntAtr)
AxName = '['+ALLTRIM(STR(j))+']-'+aNameAtr[j]
aMatrix := GraInitMatrix()
GraRotate( oPS, aMatrix, 90, { aAvrGrIntAtr[j], dYcf-20 }, GRA_TRANSFORM_ADD )
oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )
GraStringAt( oPS, { aAvrGrIntAtr[j], dYcf-20 }, AxName ) // Надпись градации по оси X
NEXT
****** Не получается отключить режим вращения изображения
****** Вместо отключения можно докрутить до 360 градусов
X_Max := 1800
Y_Max := 850 // Размер графического окна для самого графика в пикселях
aMatrix := GraInitMatrix()
GraRotate( oPS, aMatrix, 360, {900, 425}, GRA_TRANSFORM_ADD )
oPS:setGraTransform( aMatrix, GRA_TRANSFORM_REPLACE )
*** Масштабирование: Kx = 1920/1280, Ky = 1080/720: GraScale( oPS, aMatrix, {Kx,Ky}, {X_Max/2, X_Max/2} )
* GraScale( oPS, aMatrix, {1920/1280,1080/720}, {X_Max/2, X_Max/2} )
*** 7. Записать файл изображения с именем: "Модель-код опис.шкалы-код клас.шкалы"
DIRCHANGE(M_PathAppl) // Перейти в папку текущего приложения
IF FILEDATE("Cogn_fun",16) = CTOD("//")
DIRMAKE("Cogn_fun")
Mess = 'В папке текущего приложения: "#" не было директории "Cogn_fun" для когнитивных функций и она была создана!'
Mess = STRTRAN(Mess, "#", UPPER(ALLTRIM(M_PathAppl)))
LB_Warning(Mess, '4.8. Когнитивные функции. (C) Система "Эйдос-Х++"' )
ENDIF
DIRCHANGE(M_PathAppl+"\Cogn_fun\") // Перейти в папку Cogn_fun
cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'.bmp'
DO CASE
CASE mCognFun = 1
cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-Pos.bmp'
CASE mCognFun = 2
cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-Neg.bmp'
CASE mCognFun = 3
cFileName = Ar_Model[mCurrInf]+'-'+STRTRAN(STR(mOpSc,4),' ','0')+'-'+STRTRAN(STR(mClSc,4),' ','0')+'-PosNeg.bmp'
ENDCASE
ERASE(cFileName)
DC_Scrn2ImageFile( oStatic1, cFileName )
* DIRCHANGE(M_PathAppl) // Перейти в папку текущего приложения
DIRCHANGE(Disk_dir) // Перейти в папку с системой
What is oStatic1?DC_Scrn2ImageFile( oStatic1, cFileName )
The code is very high, because it's all in the system I develop. Once You told me how you can open a graphical window to make a button and display it in different image, erasing the previous one. It was very convenient. I'm using it. Previously, I have formed the zero output of each of graphic form. Now just erase Board and draw on it something new, and the Board to create every time is not necessary.rdonnay wrote:What is oStatic1?DC_Scrn2ImageFile( oStatic1, cFileName )
I dono't see that in your code.
Code: Select all
DCREAD GUI FIT TITLE mTitle OPTIONS GetOptions ;
EVAL {||GraTest(oStatic1)} SETAPPWINDOW
Code: Select all
FUNCTION GraTest( oStatic )
PUBLIC oFont, oPS := oStatic:lockPs()
oFont := XbpFont():new( oPS ):create()
oFont:configure('16.Arial Bold')
GraSetFont( oPS, oFont )
RETURN nil
I think variable is fine, because everything works fine if you do not use rotation. Full actual code of the system Eidos is always here:rdonnay wrote:It could be that oStatic1 has been destroyed by the time you get to DC_Scrn2ImageFile().
I would have to see much more of your code before I could understand what oStatic1 is.
LC_CognFun().rdonnay wrote:What is the name of the function that contains the DC_Scrn2ImageFile() call?