'File source from Holyguard.net
'=======================================================
' Type Objet
' Classe QAbout version 1.1
'=======================================================
$IFNDEF TRUE
$DEFINE True 1
$ENDIF
$IFNDEF FALSE
$DEFINE False 0
$ENDIF
Declare Function AboutExecute Lib "shell32.dll" Alias "ShellExecuteA" (hwnd As Long,lpOperation As String,lpFile As String,lpParameters As String,lpDirectory As String,nShowCmd As Long) As Long
Type QAbout EXTENDS QOBJECT
private:
form as QFORM
BtOk as QBUTTON
cadre as QGROUPBOX
label1 as QLABEL
label2 as QLABEL
label3 as QLABEL
label4 as QLABEL
width as short
send as string
public:
image as QIMAGE
Caption as string
AppName as string
AppVersion as string
text as string
Email as string
Web as string
'==================================
' Méthode affichage boite dialogue
'==================================
Sub Show
with QAbout
'definition image
.image.parent=.cadre
.image.top=15
.image.left=10
.image.autosize=true
'definition label1
.label1.autosize=true
.label1.left=.image.left+.image.width+20
.label1.caption=.AppName
if .AppVersion<>"" then
if .AppName<>"" then .label1.caption=.label1.caption+chr$(13)
.label1.caption=.label1.caption+"Version "+.AppVersion
end if
.label1.top=int((.image.height-.label1.height)/2)+.image.top
.label1.parent=.cadre
'definition label2
if .text<>"" then
.label2.autosize=true
.label2.left=10
.label2.top=.image.top+.image.height+10
.label2.caption=.text
.label2.parent=.cadre
end if
'definition label3
if .Email<>"" then
.label3.autosize=true
.label3.left=10
if .text<>"" then
.label3.top=.label2.top+.label2.height+10
else
.label3.top=.image.top+.image.height+10
end if
.label3.Font.Color=&HFF0000
.label3.Cursor=-21
.label3.caption="Email:"+.Email
.label3.parent=.cadre
end if
'definition label4
if .Web<>"" then
.label4.autosize=true
.label4.left=10
if .Email<>"" then
.label4.top=.label3.top+.label3.height+10
else
.label4.top=.label2.top+.label2.height+10
end if
.label4.Font.Color=&HFF0000
.label4.Cursor=-21
.label4.caption="Web:"+.Web
.label4.parent=.cadre
end if
'definition cadre
.cadre.top=5
.cadre.left=10
.width=(.label1.left+.label1.width)
if .text<>"" then
if (.label2.left+.label2.width)>.width then .width=(.label2.left+.label2.width)
end if
if .Email<>"" then
if (.label3.left+.label3.width)>.width then .width=(.label3.left+.label3.width)
end if
if .Web<>"" then
if (.label4.left+.label4.width)>.width then .width=(.label4.left+.label4.width)
end if
.width=.width+20
.cadre.width=.width
.cadre.height=.label2.top+.label2.height+10
if .Email<>"" then .cadre.height=.label3.top+.label3.height+10
if .Web<>"" then .cadre.height=.label4.top+.label4.height+10
.cadre.parent=.form
.label2.left=(.width-.label2.width)/2
.label3.left=(.width-.label3.width)/2
.label4.left=(.width-.label4.width)/2
'definition form
.form.width=.cadre.left+.cadre.width+15
.form.height=.cadre.top+.cadre.height+60
.form.borderstyle=3
.form.caption=.caption
.form.center
'definition bouton
.BtOk.parent=.form
.BtOk.caption="Ok"
.BtOk.default=1
.BtOk.top=.form.clientheight-.BtOk.height-5
.BtOk.left=int((.form.clientwidth-.BtOk.width)/2)
.form.showModal
end with
End Sub
Event BtOk.OnClick
QAbout.form.modalresult=1
End Event
Event label3.OnClick
QAbout.send="mailto:"+QAbout.Email
AboutExecute(0,"open",QAbout.send,"","",1)
End Event
Event label4.OnClick
if instr(LCASE$(QAbout.Web),"http")=0 then
QAbout.send="http://"+QAbout.Web
else
QAbout.send=QAbout.Web
end if
AboutExecute(0,"open",QAbout.send,"","",1)
End Event
Constructor
image.transparent=true
text=""
Email=""
Web=""
End Constructor
End Type