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, italic, size 12). It then creates a listview with two columns. The program next adds an attribute column ( column number two) and assocates the three colors with the listview attributes. Color1 is white, color2 is tan, and color3 is blue. Next the program associates the courier italic font with the listview as font1. Finally, the list has the white color (1) defined as the default background color.
The program then inserts ten rows of data. As rows are inserted, the background color for the entire row is toggled between the default color1 (white) and color2 (tan). The listview and instruction text are made visible and a quit button is added.
When the user double-clicks on the name column of a row, the column foreground color is set to white (color1), the background color is set to blue (color3), and the font is changed to couier italic (font1) for the entire row. The attribute string is therefore (1,3,1). Double-clicking the selected name once more restores the row to the original color.
![]() |