hi
i use wxgrid in my project,but it does not have solid line border,so how can i add lines aroud it?
tks a lot
how to draw lines around wxgrid
Re: how to draw lines around wxgrid
You want a border around the whole control? Add wxBORDER_SIMPLE to the window style flags (long style) when creating the wxGrid.
Use the source, Luke!
Re: how to draw lines around wxgrid
if you want the border to be a particular color or size, an easy way would be to make the wxGrid the child of a panel whose BG colour is the desired border color and the margin settings of the wxGrid is the desired border thickness.
Re: how to draw lines around wxgrid
tks,it does work.doublemax wrote:You want a border around the whole control? Add wxBORDER_SIMPLE to the window style flags (long style) when creating the wxGrid.
another question, how to use wxGrid::DrawColLabels ,any samples?
Re: how to draw lines around wxgrid
It's a virtual function, you'd have to derive your own class from wxGrid and override it in order to change its behavior.how to use wxGrid::DrawColLabels
But it's uncommon to do that, what are you trying to do?
If you want to learn about his method, look at the original source code in <wxdir>\src\generic\grid.cpp
Use the source, Luke!
Re: how to draw lines around wxgrid
at the top of the grid there are two horizontal lines,one is the boder of the grid; another is the border of the col header,and i want to hide it.doublemax wrote:But it's uncommon to do that, what are you trying to do?how to use wxGrid::DrawColLabels
-
- Filthy Rich wx Solver
- Posts: 235
- Joined: Fri Sep 14, 2012 8:26 am
- Location: Kontich, Belgium
- Contact:
Re: how to draw lines around wxgrid
Hi Hu,
It seems to me that you have put the wxGrid onto a wxPanel (with a white background) which contains a wxBoxSizerV that has a spacer as first item and the grid as a second. This of course is one possibility to get this result. So what I am saying is that your problem probably is not with the wxGrid but with the undelying parent objects. Maybe you can show us the code so that we can be of more assistance.
I personally like to work with xrc files to build the screens and forms - with use of DialogBlocks - so that you can easily see upfront how your form or window will look like before you put it into your source.
regards,
Nunki
It seems to me that you have put the wxGrid onto a wxPanel (with a white background) which contains a wxBoxSizerV that has a spacer as first item and the grid as a second. This of course is one possibility to get this result. So what I am saying is that your problem probably is not with the wxGrid but with the undelying parent objects. Maybe you can show us the code so that we can be of more assistance.
I personally like to work with xrc files to build the screens and forms - with use of DialogBlocks - so that you can easily see upfront how your form or window will look like before you put it into your source.
regards,
Nunki
Re: how to draw lines around wxgrid
tks NunkiNunki wrote:Hi Hu,
It seems to me that you have put the wxGrid onto a wxPanel (with a white background) which contains a wxBoxSizerV that has a spacer as first item and the grid as a second. This of course is one possibility to get this result. So what I am saying is that your problem probably is not with the wxGrid but with the undelying parent objects. Maybe you can show us the code so that we can be of more assistance.
I personally like to work with xrc files to build the screens and forms - with use of DialogBlocks - so that you can easily see upfront how your form or window will look like before you put it into your source.
regards,
Nunki
I use wxpython,it seems that xrc does not work well in it,especially the 'subclass' did not work.