Is there a Windows way to get the color used as the background color for inactive controls ( TextBox , etc.)? Or better yet, border color too?
This is for Windows Forms, and I could not find anything suitable in SystemColors . No such thing
Case in point. I have a text box that may not be large enough for the text that it contains, and it is disabled. When it is disabled, the user cannot scroll to view all the text, and I cannot even display a tooltip for obvious reasons .
So now I have set the TextBox ReadOnly property to true , which allows me to display tooltips and control scrolling. Now the client wants the text field to look like it was disabled; ReadOnly is a rather unpleasant property as it still looks so that it can be edited. Therefore, I thought that for the correct background color it might be enough to fool most users. I cannot use an arbitrary gray value, as there are other disabled controls in this form, and color differences may be noted. So is there a way I can find out how to disable management? The background color and border color, or at least the first one, should really be enough, but I would rather not guess. The platforms in question are most likely XP and Vista, possibly with or without themes.
ETA: Neglect. The question was stupid, and the error on my behalf I should have noticed earlier. It was a little strange that a TextBox alone would not stick to a gray background.
winforms
Joey
source share