MCPcopy Create free account
hub / github.com/lxn/walk / AddIcon

Method AddIcon

imagelist.go:115–132  ·  view source on GitHub ↗
(icon *Icon)

Source from the content-addressed store, hash-verified

113}
114
115func (il *ImageList) AddIcon(icon *Icon) (int32, error) {
116 if icon == nil {
117 return 0, newError("icon cannot be nil")
118 }
119
120 if index, ok := il.icon2Index[icon]; ok {
121 return index, nil
122 }
123
124 index := win.ImageList_ReplaceIcon(il.hIml, -1, icon.handleForDPI(il.dpi))
125 if index == -1 {
126 return 0, newError("ImageList_ReplaceIcon failed")
127 }
128
129 il.icon2Index[icon] = index
130
131 return index, nil
132}
133
134func (il *ImageList) AddImage(image interface{}) (int32, error) {
135 switch image.(type) {

Callers 1

AddImageMethod · 0.95

Calls 2

newErrorFunction · 0.85
handleForDPIMethod · 0.65

Tested by

no test coverage detected