Example: /Picture/Picture Hash/Picture Hash

Online Documentation   -   Statistics   -   FAQ   -   Plugin Parts (All, Dependencies)   -   Class hierarchy

New in Version 22.2 22.3 22.4 22.5 23.0 23.1 23.2 23.3 23.4 23.5 24.0 24.1

The list of the   topics,   classes,   interfaces,   controls,   modules,   global methods by category,   global methods by name,   screenshots,   licenses   and   examples.

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Picture Hash/Picture Hash


Required plugins for this example: MBS Picture Plugin

You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Picture Hash/Picture Hash

This example is the version from Thu, 18th Apr 2018.

Project "Picture Hash.xojo_binary_project"
Class App Inherits Application
Const kEditClear = "&Delete"
Const kFileQuit = "&Quit"
Const kFileQuitShortcut = ""
End Class
Class MainWindow Inherits Window
Control List Inherits Listbox
ControlInstance List Inherits Listbox
EventHandler Function CellBackgroundPaint(g As Graphics, row As Integer, column As Integer) As Boolean if column = 0 and row < me.ListCount then dim p as Picture = me.RowTag(row) if p <> nil then g.DrawPicture p, 0, 0 end if end if End EventHandler
End Control
EventHandler Sub Open() SplitCards End EventHandler
Function FindFile(name as string) As FolderItem // Look for file in parent folders from executable on dim parent as FolderItem = app.ExecutableFile.Parent while parent<>Nil dim file as FolderItem = parent.Child(name) if file<>Nil and file.Exists then Return file end if parent = parent.Parent wend End Function
Sub SplitCards() dim f as FolderItem = FindFile("Cards.png") if f = nil then MsgBox "Cards not found!" return end if dim p as Picture = Picture.Open(f) dim n as integer = 0 for y as integer = 0 to 6 for x as integer = 0 to 7 dim pic as new Picture(50, 70) pic.Graphics.DrawPicture p, 0, 0, pic.Width, pic.Height, x*49, y*69, pic.Width, pic.Height pictures.Append pic n = n + 1 if n = 52 then exit end if next next for each pp as Picture in pictures list.AddRow "", hex(pp.HashMBS) list.RowTag(List.LastIndex) = pp next End Sub
Property Pictures() As Picture
End Class
MenuBar MainMenuBar
MenuItem FileMenu = "&File"
MenuItem FileQuit = "#App.kFileQuit"
MenuItem EditMenu = "&Edit"
MenuItem EditUndo = "&Undo"
MenuItem EditSeparator1 = "-"
MenuItem EditCut = "Cu&t"
MenuItem EditCopy = "&Copy"
MenuItem EditPaste = "&Paste"
MenuItem EditClear = "#App.kEditClear"
MenuItem EditSeparator2 = "-"
MenuItem EditSelectAll = "Select &All"
End MenuBar
End Project

See also:

The items on this page are in the following plugins: MBS Picture Plugin.


💬 Ask a question or report a problem