Example #1
0
func NewImageList(imageSize Size, maskColor Color) (*ImageList, error) {
	hIml := win.ImageList_Create(
		int32(imageSize.Width),
		int32(imageSize.Height),
		win.ILC_MASK|win.ILC_COLOR24,
		8,
		8)
	if hIml == 0 {
		return nil, newError("ImageList_Create failed")
	}

	return &ImageList{hIml: hIml, maskColor: maskColor}, nil
}
Example #2
0
func imageListForImage(image interface{}) (hIml win.HIMAGELIST, isSysIml bool, err error) {
	if filePath, ok := image.(string); ok {
		_, hIml = iconIndexAndHImlForFilePath(filePath)
		isSysIml = hIml != 0
	} else {
		w, h := win.GetSystemMetrics(win.SM_CXSMICON), win.GetSystemMetrics(win.SM_CYSMICON)

		hIml = win.ImageList_Create(w, h, win.ILC_MASK|win.ILC_COLOR24, 8, 8)
		if hIml == 0 {
			return 0, false, newError("ImageList_Create failed")
		}
	}

	return
}