Results 1 to 2 of 2

Thread: Change Button Border Color on Dynamically Created Buttons

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Jan 2021
    Posts
    191

    Change Button Border Color on Dynamically Created Buttons

    Hi All,

    I am using this to create dynamic buttons at runtime with various colors. When I have a button color "Color [Empty]" in my color variable, I still get a black border on my button. How can I make these buttons invisible?

    Code:
                If (IO.File.Exists(filename)) Then
                    Dim lines = IO.File.ReadAllLines(filename)
                    For Each line In lines
                        Dim Data = line.Split(","c)
                        If (Data.Length > 0 AndAlso Data(0) = ToggleFile) Then
                            TextBox1.Text = "DEFECT MAP"
                            Dim fromTextFile As String = Data(7)
                            Dim color As String = fromTextFile.Split(New Char() {"["c, "]"c})(1)
    
                            Dim dynamicButton As New Button With {
                .Location = New Point(CInt(Data(2)), CInt(Data(3))),
                .Height = 7,
                .Width = 7,
                .FlatStyle = FlatStyle.Flat,
                .BackColor = Drawing.Color.FromName(color),
                .ForeColor = Drawing.Color.FromName(color)
            }

  2. #2
    PowerPoster jdc2000's Avatar
    Join Date
    Oct 2001
    Location
    Idaho Falls, Idaho USA
    Posts
    2,525

    Re: Change Button Border Color on Dynamically Created Buttons


Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width