C1 Community
ComponentOne Community is a free source for developers and help authors to collaborate and communicate.

C1Combo: snap lines

rated by 0 users
This post has 1 Reply | 0 Followers

Top 25 Contributor
Posts 477
Wolfgang Knauf Posted: Mon, Jun 8 2009 8:17 AM
Hi community,

probably you noticed that the C1Combo control does not work well when trying to
align it with labels etc. in the Windows Forms Designer. The purple horizontal
line, which marks the text bottom line and is perfect for aligning labels,
buttons, checkboxes etc in one line, is missing.

The fix is quite easy: you need to create a "ControlDesigner" subclass, which
overrides the property "SnapLines" and add a BaseLine at y=15:

using System.Collections;
using System.Windows.Forms.Design;
using System.Windows.Forms.Design.Behavior;

namespace C1.Win.C1List
{
public class C1ComboDesigner : ControlDesigner
{
public override IList SnapLines
{
get
{
IList snaplines = base.SnapLines;

SnapLine snapBaseLine = new SnapLine(SnapLineType.Baseline, 15);
snaplines.Add(snapBaseLine);

return snaplines;
}
}
}
}

This designer has to be activated on C1Combo:
[DesignerAttribute(typeof(C1ComboDesigner ))]
public class C1Combo : ...
{


That's all, and now the purple baseline is showing.

I worked around it by adding a subclass of C1Combo to my project, but other
users might find it useful, too. So I post it here, too.
Top 25 Contributor
Posts 456
Hello,
 
This issue has been replicated as a situation with the control and has been escalated to the developers.
 
Have a nice day.
 
Regards,
James Smith
<Wolfgang Knauf> wrote in message news:218704@10.0.1.98...
Hi community,

probably you noticed that the C1Combo control does not work well when trying to
align it with labels etc. in the Windows Forms Designer. The purple horizontal
line, which marks the text bottom line and is perfect for aligning labels,
buttons, checkboxes etc in one line, is missing.

The fix is quite easy: you need to create a "ControlDesigner" subclass, which
overrides the property "SnapLines" and add a BaseLine at y=15:

using System.Collections;
using System.Windows.Forms.Design;
using System.Windows.Forms.Design.Behavior;

namespace C1.Win.C1List
{
public class C1ComboDesigner : ControlDesigner
{
public override IList SnapLines
{
get
{
IList snaplines = base.SnapLines;

SnapLine snapBaseLine = new SnapLine(SnapLineType.Baseline, 15);
snaplines.Add(snapBaseLine);

return snaplines;
}
}
}
}

This designer has to be activated on C1Combo:
[DesignerAttribute(typeof(C1ComboDesigner ))]
public class C1Combo : ...
{


That's all, and now the purple baseline is showing.

I worked around it by adding a subclass of C1Combo to my project, but other
users might find it useful, too. So I post it here, too.

http://helpcentral.componentone.com/cs/forums/p/79472/218704.aspx#218704

Page 1 of 1 (2 items) | RSS
Contact ComponentOne: 1.800.858.2739 ©1987-2010 ComponentOne LLC All Rights Reserved.