MCPcopy
hub / github.com/lxn/walk / setTextAlignment

Method setTextAlignment

static.go:135–162  ·  view source on GitHub ↗
(alignment Alignment2D)

Source from the content-addressed store, hash-verified

133}
134
135func (s *static) setTextAlignment(alignment Alignment2D) error {
136 if alignment == s.textAlignment {
137 return nil
138 }
139
140 var styleBit uint32
141
142 switch alignment {
143 case AlignHNearVNear, AlignHNearVCenter, AlignHNearVFar:
144 styleBit |= win.SS_LEFT
145
146 case AlignHCenterVNear, AlignHCenterVCenter, AlignHCenterVFar:
147 styleBit |= win.SS_CENTER
148
149 case AlignHFarVNear, AlignHFarVCenter, AlignHFarVFar:
150 styleBit |= win.SS_RIGHT
151 }
152
153 if err := setAndClearWindowLongBits(s.hwndStatic, win.GWL_STYLE, styleBit, win.SS_LEFT|win.SS_CENTER|win.SS_RIGHT); err != nil {
154 return err
155 }
156
157 s.textAlignment = alignment
158
159 s.Invalidate()
160
161 return nil
162}
163
164func (s *static) setText(text string) (changed bool, err error) {
165 if text == s.text() {

Callers 2

setTextAlignment1DMethod · 0.95
SetTextAlignmentMethod · 0.80

Calls 2

InvalidateMethod · 0.65

Tested by

no test coverage detected