View previous topic :: View next topic |
Author |
Message |
morgenweck
Joined: 09 Jun 2010 Posts: 21
|
Posted: Sat Jun 12, 2010 2:33 am Post subject: Cell padding |
|
|
Is there a way to set the cell padding? If I set the autoheight to true. wordwrap to true and put a border aroung the cell then the top line of multi text appears right on the border. Do I need to use a custom editor?
I using object binding
Thanks |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Sat Jun 12, 2010 4:22 am Post subject: |
|
|
Do you mean the padding around the text when there is an active editor like a textbox (ie you can change the text) or the padding around text in a normal display cell? _________________ Infralution Support |
|
Back to top |
|
|
morgenweck
Joined: 09 Jun 2010 Posts: 21
|
Posted: Sat Jun 12, 2010 1:38 pm Post subject: |
|
|
I'm using multi line text in a standard cell with no editor.
Dim Research As ResearchObjectInfo = CType(e.Row.Item, ResearchObjectInfo)
e.CellData.Value = Research.Name
e.CellData.OddStyle.BorderColor = Color.Black
e.CellData.OddStyle.BorderWidth = 1
e.CellData.OddStyle.BackColor = Color.WhiteSmoke
e.CellData.OddStyle.BorderRadius = 5
e.CellData.OddStyle.BorderStyle = Border3DStyle.Flat
e.CellData.OddStyle.WordWrap = True
I hopes that this helps. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Mon Jun 14, 2010 12:53 am Post subject: |
|
|
Virtual Tree doesn't currently have a separate text padding option - however this is something we could look at for the next version. To change the padding around the text you would need to create a custom CellWidget (see the section in help on using Widgets) and override the PaintText method as shown below which adds a padding of 5 around the text vertically and horizontally. You also need to override the GetOptimalHeight and GetOptimalWidth methods as shown to adjust for the extra padding.
Code: | public class MyCellWidget : CellWidget
{
public MyCellWidget(RowWidget rowWidget, Column column)
: base(rowWidget,column)
{
}
protected override void PaintText(Graphics graphics, Rectangle bounds, Style style, string text, bool printing)
{
bounds.Inflate(-5, -5);
base.PaintText(graphics, bounds, style, text, printing);
}
public override int GetOptimalWidth(Graphics graphics)
{
return base.GetOptimalWidth(graphics) + 10;
}
public override int GetOptimalHeight(Graphics graphics, int width)
{
return base.GetOptimalHeight(graphics, width) + 10;
}
} |
_________________ Infralution Support |
|
Back to top |
|
|
|