#171543 - 2006-12-15 07:37 AM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Benny69]
|
Witto
MM club member
Registered: 2004-09-29
Posts: 1828
Loc: Belgium
|
;region Set Code Options
;Set Break to On if not in Logon Mode.
If NOT @LOGONMODE
Break On
Else
Break Off
EndIf
;Set Code Options to On
Dim $SO
$SO=SetOption("Explicit", "ON")
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("WrapAtEOL", "ON")
;endregion Set Code Options
Global $System
$System = CreateObject("Kixforms.System")
If NOT $System
$nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
Quit @ERROR
EndIf
Global $frmRegRun
Dim $frmRegRunWidth, $frmRegRunHeight
$frmRegRunWidth = 600
$frmRegRunHeight = 400
Dim $nul, $Imagelist, $MainMenu, $MenuItem1, $MenuItem2
Dim $Panel1, $Panel2, $Panel3, $Listview1, $Listview2, $Splitter1
Dim $ListView1Column0, $ListView1Column1, $ListView2Column0, $ListView2Column1
Dim $ComboBox1, $Label1
Dim $btnExit, $btnDelete, $btnRefresh, $btnRestore, $btnBackup, $btnSave
$frmRegRun = $System.Form()
$frmRegRun.StartPosition = 1 ;FormStartPosition_CenterScreen
$frmRegRun.Size = $System.Size($frmRegRunWidth,$frmRegRunHeight) ;(Width,Height)
$frmRegRun.Text = "Windows Registry Run [Project 01 - Lesson 01]"
$frmRegRun.Icon = $System.Icon.FromBitmap(frmRegRunIcon())
$frmRegRun.SizeChanged = "ChangeSize($frmRegRunWidth, $frmRegRunHeight)"
$ImageList = $System.ImageList()
$nul = $ImageList.Images.AddStrip(MenuBitmap())
$MainMenu = $System.MainMenu()
$MenuItem1 = $MainMenu.MenuItems.Add($System.MenuItem("File"))
$MenuItem2 = $MenuItem1.MenuItems.Add($System.MenuItem("Exit"))
$MenuItem2.Click = "QuitProgram()"
$frmRegRun.Menu = $MainMenu
$Panel1 = $System.Panel()
$Panel1.BorderStyle = 2 ;Fixed3D
$Panel1.Dock = 5 ;Fill
$nul = $frmRegRun.Controls.Add($Panel1)
$ListView2 = $System.ListView()
$ListView2.Dock = 5 ;Fill
$ListView2.Font = $System.Font("Microsoft Sans Serif",10,0) ;Regular
$ListView2.GridLines = -1 ;True
$ListView2.View = $System.View_Details
$nul = $Panel1.Controls.Add($ListView2)
$ListView2Column0 = $ListView2.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left))
$ListView2Column1 = $ListView2.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left))
$Label1 = $System.Label()
$Label1.Dock = 1 ;Top
$Label1.Text = "Entries to delete"
$Label1.TextAlign = 32 ;MiddleCenter
$nul = $Panel1.Controls.Add($Label1)
$Splitter1 = $System.Splitter()
$Splitter1.BackColor = $System.Color.FromName("ActiveCaption")
$Splitter1.Dock = 1 ;Top
$Splitter1.Height = 3
$nul = $frmRegRun.Controls.Add($Splitter1)
$Panel2 = $System.Panel()
$Panel2.BorderStyle = 2 ;Fixed3D
$Panel2.Dock = 1 ;Top
$Panel2.Height = 195
$nul = $frmRegRun.Controls.Add($Panel2)
$ListView1 = $System.ListView()
$ListView1.Dock = 5 ;Fill
$ListView1.Font = $System.Font("Microsoft Sans Serif",10,0) ;Regular
$ListView1.GridLines = -1 ;True
$ListView1.View = $System.View_Details
$nul = $Panel2.Controls.Add($ListView1)
$ListView1Column0 = $ListView1.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left))
$ListView1Column1 = $ListView1.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left))
$ComboBox1 = $System.ComboBox()
$ComboBox1.Dock = 1 ;Top
$ComboBox1.DropDownWidth = 500
$ComboBox1.IntegralHeight = 0
$ComboBox1.ItemHeight = 13
$ComboBox1.Text = ""
$nul = $Panel2.Controls.Add($ComboBox1)
$Panel3 = $System.Panel()
$Panel3.BorderStyle = 2 ;Fixed3D
$Panel3.Dock = 3 ;Left
$Panel3.Width = 90
$nul = $frmRegRun.Controls.Add($Panel3)
$btnExit = $System.Button()
$btnExit.Dock = 1 ;Top
$btnExit.ImageAlign = 16 ;Middle,Left
$btnExit.Text = "Exit"
$btnExit.TextAlign = 64 ;MiddleRight
$btnExit.ImageList = $ImageList
$btnExit.ImageIndex = 0
$btnExit.Click = "QuitProgram()"
$nul = $Panel3.Controls.Add($btnExit)
$btnDelete = $System.Button()
$btnDelete.Dock = 1 ;Top
$btnDelete.ImageAlign = 16 ;Middle,Left
$btnDelete.Text = "Delete"
$btnDelete.TextAlign = 64 ;MiddleRight
$btnDelete.ImageList = $ImageList
$btnDelete.ImageIndex = 1
$nul = $Panel3.Controls.Add($btnDelete)
$btnRefresh = $System.Button()
$btnRefresh.Dock = 1 ;Top
$btnRefresh.ImageAlign = 16 ;Middle,Left
$btnRefresh.Text = "Refresh"
$btnRefresh.TextAlign = 64 ;MiddleRight
$btnRefresh.ImageList = $ImageList
$btnRefresh.ImageIndex = 2
$nul = $Panel3.Controls.Add($btnRefresh)
$btnRestore = $System.Button()
$btnRestore.Dock = 1 ;Top
$btnRestore.ImageAlign = 16 ;Middle,Left
$btnRestore.Text = "Restore"
$btnRestore.TextAlign = 64 ;MiddleRight
$btnRestore.ImageList = $ImageList
$btnRestore.ImageIndex = 3
$nul = $Panel3.Controls.Add($btnRestore)
$btnBackup = $System.Button()
$btnBackup.Dock = 1 ;Top
$btnBackup.ImageAlign = 16 ;Middle,Left
$btnBackup.Text = "Backup"
$btnBackup.TextAlign = 64 ;MiddleRight
$btnBackup.ImageList = $ImageList
$btnBackup.ImageIndex = 4
$nul = $Panel3.Controls.Add($btnBackup)
$btnSave = $System.Button()
$btnSave.Dock = 1 ;Top
$btnSave.ImageAlign = 16 ;Middle,Left
$btnSave.Text = "Save"
$btnSave.TextAlign = 64 ;MiddleRight
$btnSave.ImageList = $ImageList
$btnSave.ImageIndex = 5
$nul = $Panel3.Controls.Add($btnSave)
$frmRegRun.Show ;Displays the Form
While $frmRegRun.Visible
$Nul = Execute($frmRegRun.DoEvents())
Loop
Exit 0
Function frmRegRunIcon()
$frmRegRunIcon = "
iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AHlJREFUOE+NkgEOwCAIA/3/q/gZY+IqCtoRk2HY0UJs7QsRQc4SVfvDAPvcz9LoL6BobxmL
V2EDIFqyE4jmumQfKcUArIaIS6sBdxXD28ctozraZWA6XO0dgU0B89wAl8VsfiVAXjGfwXsS
S3CSV1wrxKXVM7DHvNQfo/mQ/8A92p4AAAAASUVORK5CYII="
$frmRegRunIcon = $System.Bitmap.FromBase64String($frmRegRunIcon)
EndFunction
Function MenuBitmap()
$MenuBitmap = "
iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAOwwHHb6hk
AAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIHkcgVAdGGQhungRVN
IpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxhfWBNfdj1OevYpix22KcX49md
3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+pHOWPJdcXxf6iLv4X+f/j8YFzkGg0ilnc
/hqmbmvI+8cgfyhsTxDhTroQVYQ76XLX4twLf0IoKt/6UREPPHMMUVTzcYpq/cxqrBFJkbPf
RUZGEdPT04vC5Wpn48ZaMjOT8vz5dB9zc3Omi4/MQfiWhk2V8JsTfbyd3xJL8HW6YMSSFpYU
98JvFOpXJ6f4eTk8VgQPHhg3F23lEWR1Sfy+ovLtzFOp4xQVefYTZIsXyQsir7cjK4+kjPsm
Bpw7d8XcgHc/6yYSicQWHo1qi/8qoi18eFrD34pDfHg0SHbO8YQE/1ohGGEm8ly6cEfR3pbk
Z2b8XeEbrDq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ME4Ltko
HRlFiePsPiTLk2KA3e7DbvexZYubXbs85Oa2snt3E6+9VoHd7iQ7u5YXX6wgM9NpbsDuP5XR
2zdA/yTcCGtN+NYGG74gBI4XEsrOorpXW7yzG17KOpgiZu9ywQirZ2YGJPPrBjxWbGNrTR4P
HX0YUcWaX1E1sfQ6v9QPraWGoiJrSuMN2BBGAzIzVbzeQAyVlW5crkb8/gCKoqIoqnkJemvv
5/i7e+mZgM5xuDR/2tBrrr7zS/1w6hps+uX7sQRX0wS/AV1p5iL3LBe6l5s/N/L7xyDbfTDh
9LO2/A1L/gSRNjdoIv3Y5MPqbsN4/NT7gyFSDRjg+efPsGNHMY2NjQQCAWZnZxcxIPcUHV0B
OsfhyggpNV/feaeuwadXYNOm92IJOtIEHVctxNejM03QYcZ/bUzjbx7Q8NL5PHa6CynvgdOd
5vwJ8dThRBPuNRQVWXXC9ANMj2QDnM6LrFtXyb59FTHxJycnFzYgZ1cxX3R0LbjzT16FE5fh
2CXY+It3ExJcXiZcXra03xBXlgnt87hf/CmiGX813EvoJ6FVJyzzJRvgcBzH4WjG7Y6L39vb
u4gBb31CZc0QFefDGqq+pPzcBOWuccoqxyirGOVs+Qhny4Zxnh1aWIAlRLJh953/fvaARX7e
JRtQUlKSsPNDoRB+v9/UgH8DM43DgdT9MCYAAAAASUVORK5CYII="
$MenuBitmap = $System.Bitmap.FromBase64String($MenuBitmap)
EndFunction
Function ChangeSize($frmRegRunWidth, $frmRegRunHeight)
Dim $blnChangeSize
$blnChangeSize = 0
If $frmRegRun.Width < $frmRegRunWidth
$blnChangeSize = -1
Else
$frmRegRunWidth = $frmRegRun.Width
EndIf
If $frmRegRun.Height < $frmRegRunHeight
$blnChangeSize = -1
Else
$frmRegRunHeight = $frmRegRun.Height
EndIf
If $blnChangeSize = -1
$frmRegRun.Size = $System.Size($frmRegRunWidth,$frmRegRunHeight)
EndIf
EndFunction
Function QuitProgram
Quit 0
EndFunction
|
Top
|
|
|
|
#171545 - 2006-12-15 08:07 AM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Witto]
|
Viggen
Starting to like KiXtart
Registered: 2002-03-22
Posts: 110
|
Our SAN broke down last night, so I haven't got the "splittermoved()"-function in
;************ Options ************************
If Not @LogonMode
Break On
EndIf
Dim $SO
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("Explicit", "ON")
Global $nul, $System, $LSL01, $MainMenu, $List_Panel, $RegList_ListView, $Reg_ComboBox, $Splitter, $RegList_ListViewColumn, $FW, $FH
Global $Del_Panel, $DelList_ListView, $DelList_Label, $Btn_Panel, $FileMenu, $Exit, $DelList_ListViewColumn, $Exit_Button
Global $icons, $IconList, $FormIcon, $ControlIcons, $Save_Button, $Backup_Button, $Restore_Button, $Refresh_Button, $Delete_Button
; Form dimensions
$FW = 600 ;Form Width
$FH = 400 ;Form Height
;*********************************************
;************ Main Form **************************************************************
$System = CreateObject("Kixforms.System")
If Not $System
$nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16)
Quit()
EndIf
;******************************************
$LSL01 = $System.Form()
$LSL01.Icon = $System.Icon.FromBitmap(FormIcon())
$LSL01.StartPosition = 1
$LSL01.Size = $System.Size($FW,$FH)
$LSL01.Text = "Windows Registry Run [Project 01 - Lesson 01]"
$LSL01.SizeChanged = "Size()"
;******************************************
;******************************************
$Icons = ControlIcons()
$IconList = $System.ImageList()
$IconList.ImageSize = 16,16
$IconList.TransparentColor = 0,0,0
$nul = $IconList.Images.AddStrip($Icons)
;******************************************
;******************************************
$MainMenu = $System.MainMenu()
$FileMenu = $MainMenu.MenuItems.Add($System.MenuItem("File"))
$Exit = $FileMenu.MenuItems.Add($System.MenuItem("Exit"))
$Exit.Click = "ExitForm()"
$LSL01.Menu = $MainMenu
;******************************************
;******************************************
$List_Panel = $System.Panel()
$List_Panel.BorderStyle = 2
$List_Panel.Dock = 5
$nul = $LSL01.Controls.Add($List_Panel)
;******************************************
;******************************************
$RegList_ListView = $System.ListView()
$RegList_ListView.Dock = 5
$RegList_ListView.FullRowSelect = -1
$RegList_ListView.GridLines = -1
$RegList_ListView.View = $System.View_Details
$nul = $List_Panel.Controls.Add($RegList_ListView)
;******************************************
;******************************************
$RegList_ListViewColumn = $RegList_ListView.Columns.Add($System.ColumnHeader("Entry",120,$System.HorizontalAlignment_Left))
$RegList_ListViewColumn = $RegList_ListView.Columns.Add($System.ColumnHeader("Value",120,$System.HorizontalAlignment_Left))
;******************************************
;******************************************
$Reg_ComboBox = $System.ComboBox()
$Reg_ComboBox.Dock = 1
$Reg_ComboBox.ItemHeight = 15
$Reg_ComboBox.Text = ""
$nul = $List_Panel.Controls.Add($Reg_ComboBox)
;******************************************
;******************************************
$Splitter = $System.Splitter()
$Splitter.Dock = 2
$Splitter.Height = 4
$nul = $LSL01.Controls.Add($Splitter)
;******************************************
;******************************************
$Del_Panel = $System.Panel()
$Del_Panel.BorderStyle = 2
$Del_Panel.Dock = 2
$Del_Panel.Height = ($LSL01.Height/2)-20 ; Centers the splitter (almost...) if "MainMenu" is 18px high (how high is it?)
$nul = $LSL01.Controls.Add($Del_Panel)
;******************************************
;******************************************
$DelList_ListView = $System.ListView()
$DelList_ListView.Dock = 5
$DelList_ListView.FullRowSelect = -1
$DelList_ListView.GridLines = -1
$DelList_ListView.View = $System.View_Details
$nul = $Del_Panel.Controls.Add($DelList_ListView)
;******************************************
;******************************************
$DelList_ListViewColumn = $DelList_ListView.Columns.Add($System.ColumnHeader("Entry",120,$System.HorizontalAlignment_Left))
$DelList_ListViewColumn = $DelList_ListView.Columns.Add($System.ColumnHeader("Value",120,$System.HorizontalAlignment_Left))
;******************************************
;******************************************
$DelList_Label = $System.Label()
$DelList_Label.BorderStyle = 2
$DelList_Label.Dock = 1
$DelList_Label.Height = 20
$DelList_Label.Text = "Entries to Delete"
$DelList_Label.TextAlign = 32
$nul = $Del_Panel.Controls.Add($DelList_Label)
;******************************************
;******************************************
$Btn_Panel = $System.Panel()
$Btn_Panel.BorderStyle = 2
$Btn_Panel.Dock = 3
$Btn_Panel.Width = 89
$nul = $LSL01.Controls.Add($Btn_Panel)
;******************************************
;******************************************
$Save_Button = $System.Button()
$Save_Button.Height = 26
$Save_Button.Left = 0
$Save_Button.Text = "Save "
$Save_Button.ImageAlign = 16
$Save_Button.TextAlign = 64
$Save_Button.Top = 0
$Save_Button.Width = 85
$Save_Button.ImageList = $IconList
$Save_Button.ImageIndex = 5
$nul = $Btn_Panel.Controls.Add($Save_Button)
;******************************************
;******************************************
$Backup_Button = $System.Button()
$Backup_Button.Height = 26
$Backup_Button.Left = 0
$Backup_Button.Text = "Backup "
$Backup_Button.ImageAlign = 16
$Backup_Button.TextAlign = 64
$Backup_Button.Top = 26
$Backup_Button.Width = 85
$Backup_Button.ImageList = $IconList
$Backup_Button.ImageIndex = 4
$nul = $Btn_Panel.Controls.Add($Backup_Button)
;******************************************
;******************************************
$Restore_Button = $System.Button()
$Restore_Button.Height = 26
$Restore_Button.Left = 0
$Restore_Button.Text = "Restore "
$Restore_Button.ImageAlign = 16
$Restore_Button.TextAlign = 64
$Restore_Button.Top = 52
$Restore_Button.Width = 85
$Restore_Button.ImageList = $IconList
$Restore_Button.ImageIndex = 3
$nul = $Btn_Panel.Controls.Add($Restore_Button)
;******************************************
;******************************************
$Refresh_Button = $System.Button()
$Refresh_Button.Height = 26
$Refresh_Button.Left = 0
$Refresh_Button.Text = "Refresh "
$Refresh_Button.ImageAlign = 16
$Refresh_Button.TextAlign = 64
$Refresh_Button.Top = 78
$Refresh_Button.Width = 85
$Refresh_Button.ImageList = $IconList
$Refresh_Button.ImageIndex = 2
$nul = $Btn_Panel.Controls.Add($Refresh_Button)
;******************************************
;******************************************
$Delete_Button = $System.Button()
$Delete_Button.Height = 26
$Delete_Button.Left = 0
$Delete_Button.Text = "Delete "
$Delete_Button.ImageAlign = 16
$Delete_Button.TextAlign = 64
$Delete_Button.Top = 104
$Delete_Button.Width = 85
$Delete_Button.ImageList = $IconList
$Delete_Button.ImageIndex = 1
$nul = $Btn_Panel.Controls.Add($Delete_Button)
;******************************************
;******************************************
$Exit_Button = $System.Button()
$Exit_Button.Height = 26
$Exit_Button.Left = 0
$Exit_Button.Text = "Exit "
$Exit_Button.ImageAlign = 16
$Exit_Button.TextAlign = 64
$Exit_Button.Top = 130
$Exit_Button.Width = 85
$Exit_Button.ImageList = $IconList
$Exit_Button.ImageIndex = 0
$Exit_Button.Click = "ExitForm()"
$nul = $Btn_Panel.Controls.Add($Exit_Button)
;******************************************
$LSL01.Show
While $LSL01.Visible
$Nul = Execute($LSL01.DoEvents())
Loop
Exit 0
;*************************************************************************************
;*************************************************************************************
;**********************************
Function Size()
; Check if the form width or hight is smaller than allowed
; If it is, reset to "startsize"
If $LSL01.Width < $FW OR $LSL01.Height < $FH
$LSL01.Width = $FW
$LSL01.Height = $FH
$Del_Panel.Height = ($LSL01.Height/2)-20
Endif
; Check if the splitter is "out of bounds"
; If It is, then center the splitter again.
If $Del_Panel.Top < ($List_Panel.Top+20)
$Del_Panel.Height = ($LSL01.Height/2)-20
Endif
Endfunction
;**********************************
;**********************************
Function ExitForm()
$LSL01.Hide
$System = ""
Exit 0
Endfunction
;**********************************
;*************************************************************************************
;********************* Icons *********************************************************
;********************************************************************
Function ControlIcons()
$ControlIcons = "iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAOwwHHb6hk
AAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIHkcgVAdGGQhungRVN
IpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxhfWBNfdj1OevYpix22KcX49md
3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+pHOWPJdcXxf6iLv4X+f/j8YFzkGg0ilnc
/hqmbmvI+8cgfyhsTxDhTroQVYQ76XLX4twLf0IoKt/6UREPPHMMUVTzcYpq/cxqrBFJkbPf
RUZGEdPT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6heQQXMUHnn5jntzLA
FQin8isq8uol5HediYIpKrKxNhFWBmR3aU17c4O2u3U8nXSc1d+kpB6wZk0p+/ZV43A0c+iQ
l0OHvOTnt5Cf30JBQSsFBa2oqo/sbBdZWZ5UA/a856JvIMjwNIS64iUoWHAwdt1ZWMi5AJT3
wMu//qupoH2PCzr6Ddf/nIeVATq/LrxecrLdWtlzBcKsOJmB67oFv6Jq4m1uSD3xWME4Ltko
HRlFiePsPiTLk2KA3e7DbvexZYubXbs85Oa2snt3E6+9VoHd7iQ7u5YXX6wgM9NpbsDuP5XR
2zdA/yTcCGtN+NYGG74gBI4XEsrOorpXW7yzG17KOpgiZu9ywQirZ2YGJPPrBjxWbGNrTR4P
HX0YUcWaX1E1sfQ6v9QPraWGoiJrSuMN2BBGAzIzVbzeQAyVlW5crkb8/gCKoqIoqnkJemvv
5/i7e+mZgM5xuDR/2tBrrr7zS/1w6hps+uX7sQRX0wS/AV1p5iL3LBe6l5s/N/L7xyDbfTDh
9LO2/A1L/gSRNjdoIv3Y5MPqbsN4/NT7gyFSDRjg+efPsGNHMY2NjQQCAWZnZxcxIPcUHV0B
OsfhyggpNV/feaeuwadXYNOm92IJOtIEHVctxNejM03QYcZ/bUzjbx7Q8NL5PHa6CynvgdOd
5vwJ8dThRBPuNRQVWXXC9ANMj2QDnM6LrFtXyb59FTHxJycnFzYgZ1cxX3R0LbjzT16FE5fh
2CXY+It3ExJcXiZcXra03xBXlgnt87hf/CmiGX813EvoJ6FVJyzzJRvgcBzH4WjG7Y6L39vb
u4gBb31CZc0QFefDGqq+pPzcBOWuccoqxyirGOVs+Qhny4Zxnh1aWIAlRLJh953/fvaARX7e
JRtQUlKSsPNDoRB+v9/UgH8DM43DgdT9MCYAAAAASUVORK5CYII="
$ControlIcons = $System.Bitmap.FromBase64String($ControlIcons)
Endfunction
;********************************************************************
;********************************************************************
Function FormIcon()
$FormIcon = "iVBORw0KGgoAAAANSUhEUgAAABAAAAAQCAIAAACQkWg2AAAAAXNSR0IArs4c6QAAAARnQU1B
AACxjwv8YQUAAAAgY0hSTQAAeiYAAICEAAD6AAAAgOgAAHUwAADqYAAAOpgAABdwnLpRPAAA
AHlJREFUOE+NkgEOwCAIA/3/q/gZY+IqCtoRk2HY0UJs7QsRQc4SVfvDAPvcz9LoL6BobxmL
V2EDIFqyE4jmumQfKcUArIaIS6sBdxXD28ctozraZWA6XO0dgU0B89wAl8VsfiVAXjGfwXsS
S3CSV1wrxKXVM7DHvNQfo/mQ/8A92p4AAAAASUVORK5CYII="
$FormIcon = $System.Bitmap.FromBase64String($FormIcon)
Endfunction
;********************************************************************
;*************************************************************************************
|
Top
|
|
|
|
#171560 - 2006-12-15 02:55 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Jochen]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Witto, Form layout Well done. Just a few small things; Dim/Global variables will be discussed in greater detail in Lesson 02. By default 'Break' is set to off, so 'Else Break Off' is redundant and not needed. When using forms you don't want the console to show up unless you are debugging, so '$SO=SetOption("WrapAtEOL", "ON")' should not be set in the Options. Variable names are Not descriptive, example what is the difference between $ListView1 And $ListView2, what are they for? $Splitter1/$ComboBox1/$Label1 eludes that there is more that one. Lacking in comments, particularly the controls (what is each control for, what do they do).
|
Top
|
|
|
|
#171561 - 2006-12-15 02:56 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Benny69]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Viggen, Form layout Well done. Just a few small things; Dim/Global variables will be discussed in greater detail in Lesson 02. Lacking in comments, particularly the controls (what is each control for, what do they do).
|
Top
|
|
|
|
#171565 - 2006-12-15 04:31 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Benny69]
|
Gargoyle
MM club member
Registered: 2004-03-09
Posts: 1597
Loc: Valley of the Sun (Arizona, US...
|
[code] If Not @LogonMode Break On EndIf
;Declare Variables that will be used throughout Global $SO, $Nul
;Set Code Options to On
$SO=SetOption("NoMacrosInStrings", "ON") $SO=SetOption("NoVarsInStrings", "ON") $SO=SetOption("Explicit", "ON")
;Declare Variables for the form
DIM $MainMenu,$MenuItem1,$MenuItem2 DIM $Panel_Dock[],$Panel_Height[],$Panel_Left[],$Panel_Top[] DIM $Button_Text,$Button_Top[],$Label1 DIM $Splitter1,$ListView2Column[1],$ListView1Column[1] DIM $Button_Click[],$ControlStackImageList
Global $System,$Form_Main,$Panel[2],$ListView1,$ListView2,$ComboBox1,$Button[5]
;Array build information ;Could probably make MultiDimensional array's but I kept losing myself $Panel_dock = 3,"",5 $Panel_Height = "",332,"" $Panel_Left = "",80,"" $Panel_Top = "",21,"" $Button_Text = "Exit","Delete","Refresh","Restore","Backup","Save" $Button_Top = 120,96,72,48,24,0 $Button_Click = "","","","","","IWantOut()"
;Check for existence of KiXForms $System = CreateObject("Kixforms.System") If Not $System $nul= MessageBox("KiXforms.Net Not Initiated. This Script Will Now Close.","Error",16) Quit() EndIf $nul = $System.Application.EnableVisualStyles
;Build the Form $Form_Main = $System.Form() $Form_Main.StartPosition = 1 $Form_Main.Size = $System.Size(600,400) $Form_Main.Text = "Project1 - Lesson 1" $Form_Main.SizeChanged = "Resize()" $Form_Main.Icon = $System.Icon.FromBase64String(FormImage())
;Build the menu bar $MainMenu = $System.MainMenu()
$MenuItem1 = $MainMenu.MenuItems.Add($System.MenuItem("File"))
$MenuItem2 = $MenuItem1.MenuItems.Add($System.MenuItem("Exit")) $MenuItem2.Click = "IWantOut()"
$Form_Main.Menu = $MainMenu
;Build the panels ;Panel 0 = Left panel with Control Stack ;Panel 1 = Is set to fill the rest of the fomr ;Panel 2 = Panel within Panel 1 For $SO = 0 To UBound($Panel) $Panel[$SO] = $System.Panel() $Panel[$SO].BorderStyle = 1 $Panel[$SO].Dock = $Panel_Dock[$SO] $Panel[$SO].Left = $Panel_Left[$SO] $Panel[$SO].Top = $Panel_Top[$SO] $Panel[$SO].Height = $Panel_Height[$SO] Next
;Add Control Stack containing panel $Nul = $Form_Main.Controls.Add($Panel[0])
;Build the ImageList for the ControlStack $ControlStackImageList = $System.Imagelist() $ControlStackImageList.ImageSize = $System.Size(16,16) $Nul = $ControlStackImageList.Images.AddStrip($System.Bitmap.FromBase64String(ControlStackImageList()))
;Build the Buttons for the Control Stack ;Buttons are built from the bottom up ;See definition of Button_Text[] Array for clarification For $SO = 0 to Ubound($Button) $Button[$SO] = $System.Button() $Button[$SO].Left = 0 $Button[$SO].TextAlign = 64 $Button[$SO].Top = $Button_Top[$SO] $Button[$SO].Text = $Button_Text[$SO] $Button[$SO].Click = $Button_Click[$SO] $Button[$SO].ImageList = $ControlStackImageList $Button[$SO].ImageAlign = 16 $Button[$SO].ImageIndex = $SO $Nul = $Panel[0].Controls.Add($Button[$SO]) Next
;Add the ComboBox $ComboBox1 = $System.ComboBox() $ComboBox1.DropDownWidth = 512 $ComboBox1.IntegralHeight = 0 $ComboBox1.ItemHeight = 13 $ComboBox1.Left = 79 $ComboBox1.Text = "" $ComboBox1.Top = 0 $nul = $Form_Main.Controls.Add($ComboBox1)
;Add Two Panels that will allow for splitting $Nul = $Form_Main.Controls.Add($Panel[1])
;Add the secondary panel to the one just created $Nul = $Panel[1].Controls.Add($Panel[2])
;Add the Label $Label1 = $System.Label() $Label1.BorderStyle = 1 $Label1.Dock = 1 $Label1.Text = "Entries to Delete" $Label1.TextAlign = 32 $nul = $Panel[2].Controls.Add($Label1)
;Insert the Bottom Listview First to establish for the Splitter $ListView2 = $System.ListView() $ListView2.GridLines = -1 ;True $ListView2.Left = 0 $ListView2.Top = 22 $ListView2.View = $System.View_Details $nul = $Panel[2].Controls.Add($ListView2)
;Add in the Splitter $Splitter1 = $System.Splitter() $Splitter1.Dock = 1 ;Top $Splitter1.Height = 3 $nul = $Panel[1].Controls.Add($Splitter1)
;Now we can add the top Listview $ListView1 = $System.ListView() $ListView1.Dock = 1 ;Top $ListView1.GridLines = -1 ;True $ListView1.View = $System.View_Details $nul = $Panel[1].Controls.Add($ListView1)
;Set up Column headers for ListViews $ListView2Column[0] = $ListView2.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView2Column[1] = $ListView2.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Center)) $ListView1Column[0] = $ListView1.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left)) $ListView1Column[1] = $ListView1.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Center))
;Set the widths of everything to match the form $Panel[0].Width = 79 Resize()
$Form_Main.Show ;Displays the Form
While $Form_Main.Visible $Nul = Execute($Form_Main.DoEvents()) Loop Exit 0
;================================================================================================ ; Functions ;================================================================================================ Function Resize() DIM $Width If $Form_Main.Width => 600 $Width = $Form_Main.Width - 86 Else $Form_Main.Width = 600 EndIf If $Form_Main.Height < 400 $Form_Main.Height = 400 EndIf
$Panel[1].Width = $Width $Panel[2].Width = $Width $ComboBox1.Width = $Width $ListView2.Width = $Width $ListView1.Width = $Width $Panel[1].Height = $Form_Main.Height $Panel[2].Height = $Form_Main.Height - ($ListView1.Height - 5) $ListView2.Height = $Panel[2].Height
EndFunction
;=====================================
Function IWantOut() Quit 0 EndFunction
;================================================================================================ ; Image Strings ;================================================================================================ Function ControlStackImageList() $ControlStackImageList = " iVBORw0KGgoAAAANSUhEUgAAAGAAAAAQCAYAAADpunr5AAAACXBIWXMAAA7DAAAO wwHHb6hkAAAGmElEQVR4nO2YW2wU5xmGv5vcRFGVq14lUitVucAkWTxSaKOgWKIH kcgVAdGGQhungRVNIpTWmKQgYqMSWpI0NJUWexrAFBI7DjQGLT4sxudl7bWXGIxh fWBNfdj1OevYpix22KcX49md3Z2xHUBqVfWTXmk08//fq/99//m+f0bk//HfEX+p HOWPJdcXxf6iLv4X+f/j8YFzkGg0ilnc/hqmbmvI+8cgfyhsTxDhTroQVYQ76XLX 4twLf0IoKt/6UREPPHMM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AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAB AQEBAQEBAQEGBgYBAQAAAQEBAQEBBgYAAAAGAQEAAAEBAQEBAAAAAAMABgEBAAAB AQEBAQAGAQAAAAEBAQAAAQEBAQEABgEBBgYGAQEAAAEBAQEBAAYGAAAABgEBAAAB AQEBAQAAAAACAAYBAQAAAQEBAQEABgYAAAABAQEAAQYGBgYAAAAGAQEBAQEBAAEA AAAAAAUABgEBAQEBAQABAAYBAQAAAAEBAQEBAQEAAQAGAQEBAQEBAQEBAQEBAAAA AAYDAwMDAwMDAwMDAwAABAAGAwMDAwMDAwMDAwMAAAAABgAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA AAAAAAAAAAAAAAAAAAA="
EndFunction [/code]
_________________________
Today is the tomorrow you worried about yesterday.
|
Top
|
|
|
|
#171566 - 2006-12-15 05:11 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Gargoyle]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Gargoyle, Form layout looks nice, but when the form is resized larger you can see the size of the 'ListView'(s) and other internal controls remain small until the form border is released. Comments, well done and easy to follow. Construction of identical controls, very creative well done. The arrays might be a little over kill. Variable names are Not descriptive, example what is the difference between $ListView1 And $ListView2, what are they for? $Splitter1/$ComboBox1/$Label1 eludes that there is more that one.
|
Top
|
|
|
|
#171575 - 2006-12-15 05:53 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Gargoyle]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Gargoyle, When you set the '.Dock' property for any control you should never have to set the '.Top'/'.Left' properties, the '.Width'/'.Height' properties should not be used if '.Dock = Fill'. If you set these properties after you set the '.Dock' properties you will receive undesirable results.
with '$Panel_dock = 3,"",5' the second panel created is not docked at all and should be docked to the bottom '2'.
also i think that part of what is happening is that the controls are not created in a sequence that is indicative of what you are trying to achieve.
'.Dock' property its self alows a form or container to be resized and the '.Width'/'.Height' properties will automaticly change to sute the size of the container.
maybe i did not say things very well but these are the things that i was trying to show you in this post: http://www.kixtart.org/forums/ubbthreads.php?ubb=showflat&Number=170867&page=1#Post171243
Edited by Benny69 (2006-12-15 05:55 PM)
|
Top
|
|
|
|
#171579 - 2006-12-15 06:38 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Gargoyle]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I think you hit the nail on the head, for the creation of this form, the sequence should be: TopPanel for TopListView .dock = fill TopListView inside TopPanel .dock = fill ComboBox for TopListView inside TopPanel .dock = top
Splitter .dock = bottom
BottomPanel for BottomListView .dock = bottom BottomListView inside BottomPanel .dock = fill BottomLabel for BottomListView inside BottomPanel .dock = top
ButtonPanel for Buttons .dock = left Buttons inside ButtonPanel .dock = top Buttons created starting with last button first to accommodate the .dock property
if you create the panels one after the other then create the splitter the .dock sequence is messed up.
|
Top
|
|
|
|
#171583 - 2006-12-15 07:14 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Gargoyle]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
Gargoyle,
As far as determining the correct build pattern, for me I use kfd to create the basic structure and then use the Object TreeView to rearrange the sequence until I have the layout I am looking for. As you create more forms that use the .Dock property you will begin to see a pattern. That pattern tends to be, create controls backward to what you would think they should be created. You will also notice that typically the control that needs to be set to fill, is the first one created.
I don't know that any particular way of doing things is right or wrong as long as it gets you to the result you need.
|
Top
|
|
|
|
#171608 - 2006-12-16 08:38 PM
Re: KiXforms.Net Learning Series - Windows Registry Run Project 01 - Lesso
[Re: Gargoyle]
|
Benny69
Moderator
Registered: 2003-10-29
Posts: 1036
Loc: Lincoln, Ne
|
I Think that just about everyone that is going to post has, except maybe Jochen.
Here is my solution:
;Things to Note:
;Comments, they are in every part of the form and it's construction, it makes it easier for others to
; understand what is happening and what controls are used for.
;Variable names are descriptive and easy to keep straight as you dig into the code.
;I use '$MainForm.Tag' to store the original 'Form.Size' for easy retrieval in the 'MainForm.SizeChanged'
; event function. Most controls have a '.Tag' property, it is very useful for many things.
; The '.Tag' property can be used to store just about anything including arrays and even
; multi-dimensional arrays.
;Personal preference, when creating a stack of controls that are identical:
; create an array that contains a list of names or '.Text' values to identify the different controls,
; then loop thru their construction with a 'For Next' loop. This way you don't have a huge list of identical
; controls that would be difficult for anyone to keep straight.
;region Set Code Options
;Set Break to On if not in Logon Mode.
If Not @LogonMode
Break On
EndIf
;Set Code Options to On
Dim $SO
$SO=SetOption("NoMacrosInStrings", "ON")
$SO=SetOption("NoVarsInStrings", "ON")
$SO=SetOption("Explicit", "ON")
;endregion Set Code Options
;region Setup Varibles
;Dim variables in order of creation.
Global $System,$MainForm
Dim $nul,$ImageList,$MainMenu,$FileMenuItem,$ExitMenuItem,$MainPanel,
$DeletePanel,$DeleteListView,$DeleteListViewColumn0,$DeleteListViewColumn1,$DeleteLabel,
$Splitter,
$ActivePanel,$ActiveListView,$ActiveListViewColumn0,$ActiveListViewColumn1,$ActiveComboBox,
$ControlPanel,$ControlButton,$Controls,$Control,$ImageIndex
;Create an array of names of the 'Control Stack'.
$Controls = "Exit","Delete","Refresh","Restore","Backup","Save"
;Create 'Kixforms.System' Object.
$System = CreateObject("Kixforms.System")
;Verify the 'Kixforms.System' Object was created if not, notify and exit.
If Not $System
$nul= MessageBox("KiXforms.Net Not Initiated."+@CRLF+
"Please verify KiXforms.Net is installed."+@CRLF+
"This Script Will Now Close.","Error",16)
Quit()
EndIf
;Create an 'ImageList' for the 'Control Stack'.
$ImageList = $System.ImageList()
$ImageList.ImageSize = $System.Size(16,16)
$nul = $ImageList.Images.AddStrip(ControlImages())
;endregion Setup Varibles
;region Main Form
;Create Form and Controls.
;Store the original 'MainForm.Size' in 'MainForm.Tag' for easy retrieval in the 'MainForm.SizeChanged' event function.
$MainForm = $System.Form()
$MainForm.Font = $System.Font("Verdana",8.25,0) ;Regular
$MainForm.Icon = $System.Icon.FromBitmap(FormIcon())
$MainForm.StartPosition = $System.FormStartPosition_CenterScreen
$MainForm.Size = $System.Size(600,400) ;(Width,Height)
$MainForm.SizeChanged = "OnFormSizeChange()"
$MainForm.Text = "Windows Registry Run [Project 01 - Lession 01]"
$MainForm.Tag = $System.Size(600,400) ;(Width,Height)
;Create the MainMenu.
$MainMenu = $System.MainMenu()
$FileMenuItem = $MainMenu.MenuItems.Add($System.MenuItem("File"))
$ExitMenuItem = $FileMenuItem.MenuItems.Add($System.MenuItem("Exit"))
$ExitMenuItem.Click = "ExitForm()"
$MainForm.Menu = $MainMenu
;region Form Controls
;Most controls are attached to the MainPanel.
$MainPanel = $System.Panel()
$MainPanel.Dock = $System.DockStyle_Fill
$nul = $MainForm.Controls.Add($MainPanel)
;region Active Panel
;Create the upper Panel, it contains the controls above the spliter.
$ActivePanel = $System.Panel()
$ActivePanel.BorderStyle = $System.BorderStyle_Fixed3D
$ActivePanel.Dock = $System.DockStyle_Fill
$ActivePanel.Height = 160
$nul = $MainPanel.Controls.Add($ActivePanel)
;Create the upper ListView, to display the current registry entries.
$ActiveListView = $System.ListView()
$ActiveListView.CheckBoxes = "True"
$ActiveListView.Dock = $System.DockStyle_Fill
$ActiveListView.FullRowSelect = "True"
$ActiveListView.GridLines = "True"
$ActiveListView.View = $System.View_Details
$nul = $ActivePanel.Controls.Add($ActiveListView)
;Create the Columns for the upper ListView.
$ActiveListViewColumn0 = $ActiveListView.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left))
$ActiveListViewColumn1 = $ActiveListView.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left))
;Create a ComboBox for the upper ListView to tell the user what registry key the user is viewing.
$ActiveComboBox = $System.ComboBox()
$ActiveComboBox.Dock = $System.DockStyle_Top
$nul = $ActivePanel.Controls.Add($ActiveComboBox)
;endregion Active Panel
;Create a horizontal Splitter so the user can adjust the vertical size of the ListViews.
$Splitter = $System.Splitter()
$Splitter.BackColor = $System.Color.FromName("ActiveCaption")
$Splitter.Dock = $System.DockStyle_Bottom
$Splitter.Height = 3
$nul = $MainPanel.Controls.Add($Splitter)
;region Delete Panel
;Create the lower Panel, it contains the controls below the spliter.
$DeletePanel = $System.Panel()
$DeletePanel.BorderStyle = $System.BorderStyle_Fixed3D
$DeletePanel.Dock = $System.DockStyle_Bottom
$DeletePanel.Height = 150
$nul = $MainPanel.Controls.Add($DeletePanel)
;Create the lower ListView, to display the registry entries to be deleted.
$DeleteListView = $System.ListView()
$DeleteListView.Dock = $System.DockStyle_Fill
$DeleteListView.FullRowSelect = "True"
$DeleteListView.GridLines = "True"
$DeleteListView.View = $System.View_Details
$nul = $DeletePanel.Controls.Add($DeleteListView)
;Create the Columns for the lower ListView.
$DeleteListViewColumn0 = $DeleteListView.Columns.Add($System.ColumnHeader("Entry",100,$System.HorizontalAlignment_Left))
$DeleteListViewColumn1 = $DeleteListView.Columns.Add($System.ColumnHeader("Value",100,$System.HorizontalAlignment_Left))
;Create a Lable for the lower ListView to tell the user what the lower ListView is for.
$DeleteLabel = $System.Label()
$DeleteLabel.Dock = $System.DockStyle_Top
$DeleteLabel.Height = 20
$DeleteLabel.Text = "Entries to Delete"
$DeleteLabel.TextAlign = $System.ContentAlignment_MiddleCenter
$nul = $DeletePanel.Controls.Add($DeleteLabel)
;endregion Delete Panel
;region User Controls
;Create a Panel for the form user controls.
$ControlPanel = $System.Panel()
$ControlPanel.BorderStyle = $System.BorderStyle_Fixed3D
$ControlPanel.Dock = $System.DockStyle_Left
$ControlPanel.Width = 90
$nul = $MainForm.Controls.Add($ControlPanel)
;Create the user controls: Exit, Delete, Refresh, Restore, Backup, Save.
$ImageIndex = 0
For Each $Control in $Controls
$ControlButton = $System.Button()
$ControlButton.Dock = $System.DockStyle_Top
$ControlButton.Height = 26
$ControlButton.ImageAlign = $System.ContentAlignment_TopLeft
$ControlButton.ImageList = $ImageList
$ControlButton.ImageIndex = $ImageIndex
$ControlButton.Text = $Control
$ControlButton.TextAlign = $System.ContentAlignment_MiddleRight
$nul = $ControlPanel.Controls.Add($ControlButton)
$ImageIndex = $ImageIndex + 1
Next
;endregion User Controls
;endregion Form Controls
;region Startup
;endregion Startup
;Show the Form
$MainForm.Show
;Loop to catch form events.
While $MainForm.Visible
$nul = Execute($MainForm.DoEvents())
Loop
Exit 0
;endregion Main Form
;region Main Form Functions
;The 'OnFormSizeChange()' function adjusts the size of the form to the minimum size
;if the user tries to Set it too Small.
Function OnFormSizeChange()
Dim $MainForm_Size
;Retrieve the original 'MainForm.Size' from 'MainForm.Tag'
$MainForm_Size = $MainForm.Tag
If $MainForm.Width < $MainForm_Size.Width And Not($MainForm.WindowState = 1)
$MainForm.Width = $MainForm_Size.Width
EndIf
If $MainForm.Height < $MainForm_Size.Height And Not($MainForm.WindowState = 1)
$MainForm.Height = $MainForm_Size.Height
EndIf
EndFunction
;The 'ExitForm()' function exits the form.
Function ExitForm()
Quit 0
EndFunction
;endregion Main Form Functions
;region Images
;The 'FormIcon()' function creates the icon for 'MainForm.Icon'.
Function FormIcon()
$FormIcon = "
Qk02BAAAAAAAADYAAAAoAAAAEAAAABAAAAABACAAAAAAAAAAAADEDgAAxA4AAAAAAAAAAAAA
AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAA
AP8AAAD/AAAA/wAAAP/////////////////////////////////////////////////AwMD/
wMDA/8DAwP///////////wAAAP8AAAD/////////////////////////////////wMDA/8DA
wP8AAAD/AAAA/wAAAP/AwMD///////////8AAAD/AAAA////////////////////////////
AAAA/wAAAP8AAAD/AAAA/wAA//8AAAD/wMDA////////////AAAA/wAAAP//////////////
/////////////wAAAP/AwMD//////wAAAP8AAAD/AAAA/////////////////wAAAP8AAAD/
//////////////////////////8AAAD/wMDA////////////wMDA/8DAwP/AwMD/////////
//8AAAD/AAAA////////////////////////////AAAA/8DAwP/AwMD/AAAA/wAAAP8AAAD/
wMDA////////////AAAA/wAAAP///////////////////////////wAAAP8AAAD/AAAA/wAA
AP8A/wD/AAAA/8DAwP///////////wAAAP8AAAD///////////////////////////8AAAD/
wMDA/8DAwP8AAAD/AAAA/wAAAP////////////////8AAAD//////8DAwP/AwMD/wMDA/8DA
wP8AAAD/AAAA/wAAAP/AwMD/////////////////////////////////AAAA//////8AAAD/
AAAA/wAAAP8AAAD/AAAA/wD///8AAAD/wMDA/////////////////////////////////wAA
AP//////AAAA/8DAwP///////////wAAAP8AAAD/AAAA////////////////////////////
//////////8AAAD//////wAAAP/AwMD/////////////////////////////////////////
////////////////////////AAAA/wAAAP8AAAD/AAAA/8DAwP8AAP//AAD//wAA//8AAP//
AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAAAP8AAAD///8A/wAAAP/AwMD/AAD//wAA
//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAP//AAD//wAA//8AAAD/AAAA/wAAAP8AAAD/
wMDA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/wAAAP8AAAD/AAAA/w==
"
$FormIcon = $System.Bitmap.FromBase64String($FormIcon)
EndFunction
;The 'ControlImages()' function creates the images for the 'ImageList'.
Function ControlImages()
$Contro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/8oBoSeh6PSJYtf3qoUPW3OF5HH4p8p
JwOW7VNFdpDgAmzGSOusoOcC2n6bvfw3SXzm54LLWJ4Rhk22KFn8hArFfD2/Dx8LxGlImPCo
omsjf/ZJww8wbRHW7gCL5QoWLUqlmpCiit/Z2TmyASFbYnHVUTli5J+7AZy8DkRfA5Z+utdH
6OtTJTDGst5y6lfmhbqIx+T34eWI1f6rYSwvZdZHnKDYBJO0pk9B4eEn5GJssymRz+LX1NSM
YsDm00jNakZKhkdB+h0kp3Ug2XobSantSEppQ2JyKxKTWmBJbB5mwHjXqDcs5EnzP8kaIEww
WaTegLi4OJ/Id7vdVAOchgb8AzONw4G+paf3AAAAAElFTkSuQmCC"
$ControlImages = $System.Bitmap.FromBase64String($ControlImages)
EndFunction
;endregion Images
I will now post Lesson 02. Next Lesson: Project 01 - Lesson 02
You may use my solution, someone else's or modify your own to include bits and pieces of different ones.
|
Top
|
|
|
|
Moderator: NTDOC, ShaneEP, Mart, Radimus, Glenn Barnas, Jochen, Allen
|
0 registered
and 338 anonymous users online.
|
|
|