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. Chaning colors of certin lines in a textbox

Chaning colors of certin lines in a textbox

Scheduled Pinned Locked Moved Visual Basic
game-devquestiondiscussion
2 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.
  • J Offline
    J Offline
    jamesbronw
    wrote on last edited by
    #1

    Is it possible to change the color of only certin lines in a text box? I am trying to write a cheap game for my senior project and I thought it would be cool to be able to change color of the text if I was getting hit by something to red, and have me hitting the enemy in white. If anyone has any helpful thoughts please email them to me or post them. Thanks so much Tommy

    A 1 Reply Last reply
    0
    • J jamesbronw

      Is it possible to change the color of only certin lines in a text box? I am trying to write a cheap game for my senior project and I thought it would be cool to be able to change color of the text if I was getting hit by something to red, and have me hitting the enemy in white. If anyone has any helpful thoughts please email them to me or post them. Thanks so much Tommy

      A Offline
      A Offline
      axiomillies
      wrote on last edited by
      #2

      You know 'txtSample.ForeColor = vbColorRed' can change your text's color, but all lines. It's impossible to change colors of only certain lines in textbox. I have 2 ways to solve this problem (I often do): **1)**I think textbox is not for displaying, it's for inputing. So you should use 2 labels: 1 for you and 1 for the enemy. When you are getting hit X| , your label red, enemy's label white:mad:, contrary... **2)**You can use a RichTextBox: rtbSample.SelText.ForeColor = vbColorRed but it's not my favourite because the RichTextBox control is very complex:sigh:. I post this reply on a computer without Visual Basic installed, so that I can't test the code. If you don't like my answer:( or don't understand:confused:, reply me, I will find another way (I pay attention to this problem too!) GF bos

      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