Farbe von einem Teil eines Strings ändern

  • VB.NET

Es gibt 4 Antworten in diesem Thema. Der letzte Beitrag () ist von vb-checker.

    Farbe von einem Teil eines Strings ändern

    Huhu,
    ich möchte die Schriftfarbe von einem Teil der Schrift in der Titelleiste ändern. Somit kann ich nicht einfach die Eigenschaft setzen. Der 1. Teil soll ganz normal schwarz sein und der 2. Teil Rot.

    Kann man das irgendwie umsetzen?

    Grüße
    Du änderst lediglich den Text der Form. Nicht den Text der Titelleiste. Es ist lediglich Schicksal, dass in der Titelleiste der Name der Form steht =)

    Denn du setzt ja den Wert "Me.Text" und nicht iwas wie "me.TitleText" oder "Me.Title.Text"

    EDit: Hab mal irgendwo was gelesen mit "SysColors..." Aber man kann nur wenn überhaupt die globale Schriftfarbe ändern. Ein Workaround wäre den Rahmen auszublenden und eine eigene Titelleiste zu basteln

    Dieser Beitrag wurde bereits 1 mal editiert, zuletzt von „Agita“ ()

    Agita schrieb:

    Es ist lediglich Schicksal, dass in der Titelleiste der Name der Form steht =)

    Naja, Schicksal würde ich es nicht direkt nennen ^^

    So funktionierts:

    The secret life of GetWindowText, The Old New Thing schrieb:

    How windows manage their text
    There are two ways window classes can manage their text. They can either do it manually or they can let the system do it. The default is to let the system do it.
    If a window class lets the system manage its text, the system will do the following:
    • Default handling of the WM_NCCREATE message takes the lpWindowName parameter passed to CreateWindow/Ex and saves it in a "special place".
    • Default handling of the WM_GETTEXT message retrieves the string from that "special place".
    • Default handling of the WM_SETTEXT message copies the string to that "special place".

    On the other hand, if a window class manages its window text manually, the system will not do any special handling, and it is the window class's responsibility to respond to the WM_GETTEXT/WM_SETTEXT messages and return/save the strings explicitly.
    Frame windows typically let the system manage their window text. Custom controls typically manage their window text manually.

    Skybird schrieb:

    Das sind ja Ubisoftmethoden hier !