Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. Visual Basic
  4. how to brush color into a textbox ?

how to brush color into a textbox ?

Scheduled Pinned Locked Moved Visual Basic
tutorialquestion
3 Posts 2 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    dungti
    wrote on last edited by
    #1

    you know, Combobox has property Drawmode = OwerDrawFixed that allow us catch DrawItem events to brush color for each item in Combobox. But a Textbox hasnot this usefull property. Can you guide me how to brush color into a textbox? special thanks! dungti

    C 1 Reply Last reply
    0
    • D dungti

      you know, Combobox has property Drawmode = OwerDrawFixed that allow us catch DrawItem events to brush color for each item in Combobox. But a Textbox hasnot this usefull property. Can you guide me how to brush color into a textbox? special thanks! dungti

      C Offline
      C Offline
      cnurse
      wrote on last edited by
      #2

      Dungti, If you are using VB.NET then just set the background color. If you are using VB 6 then you will have to work your way through this lot...It's on MSDN. PSS ID Number: Q174301 Article Last Modified on 01-11-2001 -------------------------------------------------------------------------------- The information in this article applies to: Microsoft Visual Basic Learning Edition for Windows 6.0 Microsoft Visual Basic Professional Edition for Windows 6.0 Microsoft Visual Basic Enterprise Edition for Windows 6.0 Microsoft Visual Basic Control Creation Edition for Windows 5.0 Microsoft Visual Basic Learning Edition for Windows 5.0 Microsoft Visual Basic Professional Edition for Windows 5.0 Microsoft Visual Basic Enterprise Edition for Windows 5.0 -------------------------------------------------------------------------------- Summary When a dithered color is selected as the background of a TextBox, the background around the text is displayed as a different, solid color when the display is set for 256 colors or less. To work around this limitation, you must hook the WM_CTLCOLOREDIT message and set the text background color to TRANSPARENT. This is not a trivial alternative, and using a solid background color is recommended if at all possible. More Information WARNING: ANY USE BY YOU OF THE SAMPLE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this sample code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. WARNING: Failure to unhook a window before its imminent destruction will result in application errors, Invalid Page Faults, and data loss. This is due to the fact that the new WindowProc function being pointed to no longer exists, but the window has not been notified of the change. Always unhook the sub-classed window upon unloading the sub-classed form or exiting the application. This is especially important while debugging an application that uses this technique within the Microsoft Visual Basic 5.0 Development Environment. Pressing the END button or selecting End from the Run menu without unhooking will cause an Invalid Page Fault and close Microsoft Visual Basic. A TextBox control cannot draw text with a dithered background color, but it can draw text with a transparent background color. If the background of the control is dithered, this achieves the same visual effect. (Note the distinction between the back

      D 1 Reply Last reply
      0
      • C cnurse

        Dungti, If you are using VB.NET then just set the background color. If you are using VB 6 then you will have to work your way through this lot...It's on MSDN. PSS ID Number: Q174301 Article Last Modified on 01-11-2001 -------------------------------------------------------------------------------- The information in this article applies to: Microsoft Visual Basic Learning Edition for Windows 6.0 Microsoft Visual Basic Professional Edition for Windows 6.0 Microsoft Visual Basic Enterprise Edition for Windows 6.0 Microsoft Visual Basic Control Creation Edition for Windows 5.0 Microsoft Visual Basic Learning Edition for Windows 5.0 Microsoft Visual Basic Professional Edition for Windows 5.0 Microsoft Visual Basic Enterprise Edition for Windows 5.0 -------------------------------------------------------------------------------- Summary When a dithered color is selected as the background of a TextBox, the background around the text is displayed as a different, solid color when the display is set for 256 colors or less. To work around this limitation, you must hook the WM_CTLCOLOREDIT message and set the text background color to TRANSPARENT. This is not a trivial alternative, and using a solid background color is recommended if at all possible. More Information WARNING: ANY USE BY YOU OF THE SAMPLE CODE PROVIDED IN THIS ARTICLE IS AT YOUR OWN RISK. Microsoft provides this sample code "as is" without warranty of any kind, either express or implied, including but not limited to the implied warranties of merchantability and/or fitness for a particular purpose. WARNING: Failure to unhook a window before its imminent destruction will result in application errors, Invalid Page Faults, and data loss. This is due to the fact that the new WindowProc function being pointed to no longer exists, but the window has not been notified of the change. Always unhook the sub-classed window upon unloading the sub-classed form or exiting the application. This is especially important while debugging an application that uses this technique within the Microsoft Visual Basic 5.0 Development Environment. Pressing the END button or selecting End from the Run menu without unhooking will cause an Invalid Page Fault and close Microsoft Visual Basic. A TextBox control cannot draw text with a dithered background color, but it can draw text with a transparent background color. If the background of the control is dithered, this achieves the same visual effect. (Note the distinction between the back

        D Offline
        D Offline
        dungti
        wrote on last edited by
        #3

        Hi! Thanks for your idea but my matter is that, I am using VB.NET My background of Textbox is still COLOR.WHITE, and I would like to draw a small color rectangle first and then a draw my text (like you add each color beside each text item in a Combobox). Could you give a new idea to handle this matter. Special thanks!!! dungti

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups