Gridview borders
Posted
#1
(In Topic #150)
Guru

This class defines constants used by the Border property of many controls. Moreover, since Gambas 3.7, this class is creatable, and allows to describe the border of a GridView cell or row.
I have tried: -
Code (gambas)
- GridViewCmdSearch.Row[0] = Border.Plain
Code (gambas)
- GridViewCmdSearch.Row[0].Border = Border.Plain
Code (gambas)
- GridViewCmdSearch[0,0].Border = Border.Plain
Code (gambas)
- GridViewCmdSearch[0, 0].Border("margin:4;width:4;left-style:none;left-margin:0;left-width:0;top-right-radius:24;right-color:green")
I've missed something, but what?
Posted
Regular

However, I discovered that this format seems to work;
Code (gambas)
Unless something is obvious to beginners (& me), there needs to be a working example + a plain English {other languages are also available} description of how it works.
Posted
Guru

Not that I know anything about 'CSS-like syntax'
So my code is now: -
Code (gambas)
Joke
Son, pointing at the sky, asks father 'What are clouds made of Dad?". Father replies 'Mainly Linux servers son'.
I just heard that on MintCast https://mintcast.org/
Posted
Regular

Code (gambas)
- GridView1[1, 1].Border = Border("style:double;color:Red")
Also, if you type:-
Code (gambas)
- GridView1[1, 1].Border.
Code (gambas)
- GridView1[1, 1].Border.BottomColor = Color.Red
It really shouldn't be this difficult.
Posted
Regular

Code (gambas)
- hBorder = New Border
- 'specify cell border
- With hBorder
- .Width = 5
- .Color = Color.Red
- .BottomStyle = Border.Raised
- .BottomColor = Color.DarkBlue
- .TopColor = Color.Green
- GridView1.Columns.Count = 3
- GridView1.Rows.Count = 4
- GridView1.Header = GridView1.Both
- GridView1.Columns.Width = 150
- GridView1.Rows[1].Height = 50
- GridView1[0, 1].Text = "jornmo"
- GridView1[1, 1].Text = "cogier"
- GridView1[2, 1].Text = "stevedee"
- GridView1[1, 1].Border = hBorder 'apply cell border
Posted
Regular

That joke was exactly the way I like them - super dry!
Posted
Guru

Code (gambas)
- hTimer.start
- hBorder = New Border
- 'specify cell border
- With hBorder
- .Width = 5
- .Color = Color.Red
- .BottomStyle = Border.Raised
- .BottomColor = Color.DarkBlue
- .TopColor = Color.Green
- GridView1.Columns.Count = 3
- GridView1.Rows.Count = 6
- GridView1.Header = GridView1.Both 'Interesting that "GridView1" works as well as "GridView"
- GridView1.Columns.Width = 150
- GridView1.Rows[1].Height = 50
- GridView1[0, 1].Text = "jornmo"
- GridView1[1, 1].Text = "cogier"
- GridView1[2, 1].Text = "stevedee"
- GridView1[5, 1].Text = "Hello world!"
- GridView1[5, 1].Alignment = Align.Center
- GridView1[1, 1].Border = hBorder 'apply cell border
- Inc siCount
Posted
Regular

Posted
Regular

Technopeasant said
Does this only work for gridview borders or can you change the colour and style on other controls?
It looks like it only works with GridView controls. The border property on most controls just turns it on/off, and it wont accept a bunch of style properties.
However, did you just want to create a simple border like this?
Posted
Regular

Posted
Regular

Technopeasant said
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:-
…and also a 1 second Timer to run it:-
Posted
Guru

Have a look at the attached (4 lines of code)
<IMG src="http://www.cogier.com/gambas/Borders.png">
</IMG>
Posted
Regular

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.
Posted
Guru

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.
<IMG src="http://www.cogier.com/gambas/Borders1.png">
</IMG>
Posted
Regular

1 guest and 0 members have just viewed this.




