Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Margins in a grid (particularly for a checkbox)

Status
Not open for further replies.

mpgalvin

Programmer
Feb 5, 2001
119
IE
I have a grid setup where the fields in each column are flush to the left margin. It's fine when the contents of the column is text, but I've noticed that when I put a checkbox, it's slap bang against the side, and looks awful. This is just an aesthetics thing, but I wonder if there's any way to get the checkbox to move to the center, or at the very least, set up a little margin on the LHS, so that it's not right up against the divider.
 
I wonder if there's any way to get the checkbox to move to the center, or at the very least, set up a little margin on the LHS

How about creating a special checkbox class with a small, built-in margin to use in grids? (Though I suspect there's a simplier solution ;-)). --Dave
 
we ended up creating a container class with a checkbox in it that we drop into the grid. The container takes on the width of the column and the check box is then centered in the container.
 
Yeah, I thought I might to make a container class, which I'm afraid is beyond my experience at the moment. I haven't really got the luxury of learning something at the moment that is not going to help the system dramatically. I guess I'll get around to it at some point...
 
I don't know if this helps, but you can easily get the checkbox scrunched against the RIGHT side of the column by changing the alignment property to 1.

Jim
 
Yeah, I thought I might to make a container class, which I'm afraid is beyond my experience at the moment.

Actually creating new classes is extremely simple. I just did one like you need and it shouldn't take very long.

1. Create a form. 2. Drop a container object (the weird thing that looks like it has 4 eyes). 3. Drop a checkbox on the container. 4. Laso the container and then use File / Save as Class and follow the directions. Save it in an appropriate class library with an appropriate name (I used Checkmargin) and you're done. You can now drop your new control whereever you want.

Visually it works on a quick test I did, but you might have to create a property for the new control to store the checked property of the internal checkbox, since you no longer have a separate checkbox.

Dave Dardinger
 
You can set the alignment property of MyGrid.ColumN.TextBox to Centre or right and set that columns width property suitably. ramani :)
(Subramanian.G)
FoxAcc
ramani_g@yahoo.com
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top