2 Replies - 114 Views - Last Post: 27 December 2017 - 09:09 PM Rate Topic: -----

#1 JoeBobJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 17

Change border color of all forms using a combo box?

Posted 27 December 2017 - 05:26 PM

I'm trying to change the border color of all my forms using a combo box on my settings for but for some reason I can't seem to get it to work. What I've done is in the form_paint event of each form I've made a select case to change the border color but its not working. I have four strings in the main form which is the frmMain.normalFontColor, etc. They all contain a hex value.

Could use some help this is the code I'm using.

Private Sub frmSettings_Paint(sender As Object, e As PaintEventArgs) Handles Me.Paint
        Select Case cboThemes.Text
            Case "Windows Default"
                ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, ColorTranslator.FromHtml(frmMain.normalFontColor), ButtonBorderStyle.Solid)
            Case "Dark w/ Green font"
                ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, ColorTranslator.FromHtml(frmMain.mintFontColor), ButtonBorderStyle.Solid)
            Case "Dark w/ Tan font"
                ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, ColorTranslator.FromHtml(frmMain.tanFontColor), ButtonBorderStyle.Solid)
            Case "Dark w/ Orange font"
                ControlPaint.DrawBorder(e.Graphics, e.ClipRectangle, ColorTranslator.FromHtml(frmMain.orangeFontColor), ButtonBorderStyle.Solid)
        End Select
    End Sub

I wanted to mention without the select case I can take one of the lines of code and use it by itself and it will change the border color so I'm a bit confused why this doesn't work.



Is This A Good Question/Topic? 0
  • +

Replies To: Change border color of all forms using a combo box?

#2 JoeBobJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 17

Re: Change border color of all forms using a combo box?

Posted 27 December 2017 - 07:11 PM

I see why its not working but I need some help getting the hex code to work!

When I add the

ColorTranslator.FromHtml(normalFontColor)


It doesn't work but if I use color.black, etc it works. Is there a way to use hex codes in the drawborder code?
Was This Post Helpful? 0
  • +
  • -

#3 JoeBobJr  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 23
  • Joined: 23-December 17

Re: Change border color of all forms using a combo box?

Posted 27 December 2017 - 09:09 PM

I figured it out changed the code up some and it still wouldn't work what I ended up having to do is refresh all three forms after changing all the colors and it worked fine.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1