Jump to content
Fórum Script Brasil
  • 0

[ERRO] Converte RGB para HEX


Adson Leal

Question

Olá.

Resolvi o problema de antes. Com muita dor de cabeça xD.

Mas veio esse novo problema.

Fiz o seguinte código:

ColorDialog1.ShowDialog()
        If Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString.Length = 4 Then
            TextBox1.SelectedText = "^00" & Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString & TextBox1.SelectedText & "^000000"
        End If
        If Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString.Length = 6 Then
            TextBox1.SelectedText = "^" & Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString & TextBox1.SelectedText & "^000000"
        End If
        If Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString.Length = 2 Then
            TextBox1.SelectedText = "^0000" & Hex(System.Drawing.ColorTranslator.ToWin32(ColorDialog1.Color)).ToString & TextBox1.SelectedText & "^000000"
        End If

O que ele faz?

Esse código está associado à um button click event.

Quando se clica no botão aparece um color dialog.

Você escolhe a cor e ele trasforma o texto selecionado.

EX escolhendo a cor vermelha:

^FF0000texto selecionado^000000

O meu problema é o seguinte.

Algumas cores não aparecem certas.

Por exemplo o azul: ^FF0000texto^000000 Exatamente o mesmo que o vermelho deveria ser ^0000FFtexto ^000000

alguém sabe como arrumar isso??

Grato

Edited by Adson Leal
Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



  • Forum Statistics

    • Total Topics
      152.2k
    • Total Posts
      652k
×
×
  • Create New...