i writing down simple schedule planner app using winforms in visual basic .net, , have "edit preferences" want user able change colors of labels. tried use code:
public sub darkmode(byval darkmodeon boolean) if darkmodeon each c control in me.controls if c isnot lbltitle if typeof c label directcast(c, label).forecolor = color.fromargb(255, 255, 255) elseif typeof c panel each pnlpanel panel in me.controls.oftype(of panel)() pnlpanel.backcolor = color.fromargb(66, 66, 66) next end if next end sub but when run code, changes forecolor of labels immediate children of form , changes not apply labels inside other containers panels. there way change forecolor of labels, not immediate children of form?
probably changing if elseif helps out.
for each c control in me.controls if typeof c panel each pnlpanel panel in me.controls.oftype(of panel)() pnlpanel.backcolor = color.fromargb(66, 66, 66) next elseif c isnot lbltitle if typeof c label directcast(c, label).forecolor = color.fromargb(255, 255, 255) end if next
Comments
Post a Comment