in Education by
Is is possible to change the item selection focus color and text color in a TListBox? When themes are not enabled in the project, or the list box style is set to owner-draw, the selection around the item is painted blue, which I believe is globally defined by the system's appearance settings. I would like to change the color of selected items to a custom color. So an example, the result would be something like this: Note the last listbox has been modified in Paint to illustrate the example. JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
try this: procedure TForm1.ListBox1DrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); begin with (Control as TListBox).Canvas do begin if odSelected in State then Brush.Color := $00FFD2A6; FillRect(Rect); TextOut(Rect.Left, Rect.Top, (Control as TListBox).Items[Index]); if odFocused In State then begin Brush.Color := ListBox1.Color; DrawFocusRect(Rect); end; end; end;

Related questions

0 votes
    When assigning a background color of a table cell on hover, the box shadow is covered. I have found ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    When assigning a background color of a table cell on hover, the box shadow is covered. I have found ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 21, 2022 in Education by JackTerrance
0 votes
    I'm working with ASP.NET 3.5. I have a list box that users must add items to (I've written ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 12, 2022 in Education by JackTerrance
0 votes
    1 Choose the correct option:- 1) It is the blank area where you can draw and color in MS Paint. a) Line ... ans please tell me fast Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    1 Choose the correct option:- 1) It is the blank area where you can draw and color in MS Paint. a) ... give me ans subject computer Select the correct answer from above options...
asked Dec 24, 2021 in Education by JackTerrance
0 votes
    I am trying to create a combobox in a datagrid. So far I have the two versions of this combobox ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I am trying to create a combobox in a datagrid. So far I have the two versions of this combobox ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 7, 2022 in Education by JackTerrance
0 votes
    I have an item and I want to count it's occurrence in a list, How can I do that in Python? Select the correct answer from above options...
asked Jan 22, 2022 in Education by JackTerrance
0 votes
    A box contains 100 bulbs 20 of which are defective. 10 bulbs are selected for inspection. Find the probability ... none3 is defective. Select the correct answer from above options...
asked Nov 15, 2021 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 10, 2022 in Education by JackTerrance
0 votes
    Is there a way, for the FlipView control, to ONLY have it load the selected item?? The default ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 5, 2022 in Education by JackTerrance
0 votes
    I have a ListBox that scrolls images horizontally. I have the following XAML I used blend to create it. ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 11, 2022 in Education by JackTerrance
0 votes
    I tested out the script below in jsfiddle and it works fine, can someone guide me how to fix it? ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Dec 31, 2021 in Education by JackTerrance
0 votes
    A coin is tossed. If it shows tail, we draw a ball from a box which contains 2 red 3 black balls; ... sample space of this experiment. Select the correct answer from above options...
asked Nov 22, 2021 in Education by JackTerrance
...