Xojo Conferences
MBSSep2018MunichDE
XDCMay2019MiamiUSA

Platforms to show: All Mac Windows Linux Cross-Platform

/Picture/Icon/Test Icon Loading
Function:
Required plugins for this example: MBS Picture Plugin, MBS Util Plugin
You find this example project in your Plugins Download as a Xojo project file within the examples folder: /Picture/Icon/Test Icon Loading
This example is the version from Sun, 10th Dec 2016.
Project "Test Icon Loading.rbp"
FileTypes
Filetype special/any
End FileTypes
Class Window1 Inherits Window
Control StaticText1 Inherits Label
ControlInstance StaticText1 Inherits Label
End Control
EventHandler Sub DropObject(obj As DragItem, action As Integer) do if obj.FolderItemAvailable then f=obj.FolderItem Refresh end if loop until not obj.NextItem End EventHandler
EventHandler Sub Open() dim dir,mail,Contents,Resources as FolderItem me.AcceptFileDrop "special/any" dir=ApplicationsFolderMBS(0) mail=dir.Child("Mail.app") Contents=mail.Child("Contents") Resources=Contents.Child("Resources") f=Resources.Child("app.icns") if f.Exists = false then // newer version of mail f=Resources.Child("Mail.icns") end if Exception End EventHandler
EventHandler Sub Paint(g As Graphics, areas() As REALbasic.Rect) dim i as IconFamilyMBS dim p as Picture dim b,m as Picture i=f.OpenAsIconFamilyMBS if i<>nil then if i.GetIconImage(512, b, m) then p = new Picture(b.Width,b.Height,32) p.graphics.DrawPicture b,0,0 p.mask.graphics.DrawPicture m,0,0 g.DrawPicture p,0,0 Return end if b=i.Thumbnail32BitData m=i.Thumbnail8BitMask if b<>Nil and m<>Nil then p = new Picture(b.Width,b.Height,32) p.graphics.DrawPicture b,0,0 p.mask.graphics.DrawPicture m,0,0 g.DrawPicture p,0,0 end if b=i.Large32BitData if b=nil then b=i.Large8BitData end if if b=nil then b=i.Large4BitData end if if b=nil then b=i.Large1BitData end if m=i.Large8BitMask if m=nil then m=i.Large1BitMask end if if b<>Nil and m<>Nil then p = new Picture(b.Width,b.Height,32) p.graphics.DrawPicture b,0,0 p.mask.graphics.DrawPicture m,0,0 g.DrawPicture p,200,0 end if end if End EventHandler
Property Protected f As FolderItem
End Class
MenuBar Menu
MenuItem UntitledMenu3 = ""
MenuItem UntitledMenu2 = "File"
MenuItem FileQuit = "Quit"
MenuItem UntitledMenu0 = "Edit"
MenuItem EditUndo = "Undo"
MenuItem UntitledMenu1 = "-"
MenuItem EditCut = "Cut"
MenuItem EditCopy = "Copy"
MenuItem EditPaste = "Paste"
MenuItem EditClear = "Clear"
End MenuBar
Class App Inherits Application
End Class
End Project

See also:

Feedback, Comments & Corrections

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




Links
MBS Xojo Chart Plugins