Gridview borders

User avatar
stevedee
Posts: 212
Joined: Monday 20th March 2017 6:06pm

Re: Gridview borders

Post by stevedee » Wednesday 11th December 2019 6:01am

Technopeasant wrote:
Wednesday 11th December 2019 2:12am
I wanted to be able to change the colour and size of the borders of my controls, but I might just have to add my own drawing code.
Yes I think that is the only option. My example just used a panel control slightly larger than the main control.

For anyone interested, here is my demo code using a TextArea and a Panel:-
Public Sub SetBorder(iSize As Integer, iColour As Integer)

  TextArea1.Border = False
  With Panel1
    .NoTabFocus = True
    .Left = TextArea1.Left - iSize
    .Top = TextArea1.Top - iSize
    .Width = TextArea1.Width + iSize * 2
    .Height = TextArea1.Height + iSize * 2
    .Background = iColour
  End With
  
End
...and also a 1 second Timer to run it:-
Public Sub Timer1_Timer()
Dim iBorder As Integer
Dim iColour As Integer

  iBorder = Rnd(0, 50)
  iColour = Rnd(0, 16700000)
  SetBorder(iBorder, iColour)
  TextArea1.Text = " Border size: " & iBorder

End

User avatar
cogier
Site Admin
Posts: 507
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gridview borders

Post by cogier » Wednesday 11th December 2019 2:47pm

I have had a look at this and I think the property to use is 'Padding'

Have a look at the attached (4 lines of code)

Image
Test1.tar.gz
(12.47 KiB) Downloaded 167 times

User avatar
Technopeasant
Posts: 41
Joined: Saturday 13th July 2019 6:50pm

Re: Gridview borders

Post by Technopeasant » Saturday 14th December 2019 4:53am

Might work for a panel, but does not seem to do what I want for picture boxes.

While it is disappointing that everything I read about how QT style sheets work suggests this should be possible, I have just implemented my own paint commands, which gave me the option of drawing ellipse borders as well.
Technical director,
Piga Software
http://icculus.org/piga/

User avatar
cogier
Site Admin
Posts: 507
Joined: Wednesday 21st September 2016 2:22pm
Location: Guernsey, Channel Islands

Re: Gridview borders

Post by cogier » Saturday 14th December 2019 10:35am

Might work for a panel, but does not seem to do what I want for picture boxes.
See attached, same as before but with a PictureBox. If this is not what you are looking for please elaborate.

Image
Test1.tar.gz
(34.12 KiB) Downloaded 127 times

User avatar
Technopeasant
Posts: 41
Joined: Saturday 13th July 2019 6:50pm

Re: Gridview borders

Post by Technopeasant » Monday 23rd December 2019 12:25am

Does the job for UI elements I guess, but my drawing commands are working out better for dynamic game elements. Thanks for the tips though.
Technical director,
Piga Software
http://icculus.org/piga/

Post Reply