public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height) { Control[] controls = new Control[2]; var newControl = control.CreateControl(); var newControl1 = control.CreateControl(); newControl.Height = height; newControl1.Height = control.Height - height; newControl1.Top = 0; controls[1] = newControl1; controls[0] = newControl; return controls; }
public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height) { Control[] controls = new Control[2]; var newControl = control.CreateControl(); var newControl1 = control.CreateControl() as Image; newControl.Height = height; newControl1.Height = control.Height - height; newControl1.Offset = new MonoReports.Model.Point(0,-height); newControl1.Top = 0; controls[1] = newControl1; controls[0] = newControl; return controls; }
/// <summary> /// Breaks off contol at most at height. /// </summary> /// <returns> /// Array of two controls: broken control with height equal to height param or lower and second control representing rest part of oryginal control /// </returns> /// <param name='control'> /// Control to broke off /// </param> /// <param name='height'> /// Height. /// </param> public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height) { Control[] controls = new Control[2]; TextBlock textBlock = control.CreateControl() as TextBlock; controls[1] = textBlock; var newTextBlock = control.CreateControl() as TextBlock; textBlock.Top = 0; int charNumber = c.GetBreakLineCharacterIndexbyMaxHeight (textBlock,height); if (charNumber > 0) { newTextBlock.Text = textBlock.Text.Substring (0,charNumber-1); newTextBlock.Padding = new Thickness(textBlock.Padding.Left,0,textBlock.Padding.Right,textBlock.Padding.Bottom); var newSize = c.DrawTextBlock (newTextBlock, false); newTextBlock.Height = newSize.Height; textBlock.Height = textBlock.Height - newSize.Height; textBlock.Text = textBlock.Text.Substring (charNumber-1); } else if (charNumber == 0) { newTextBlock.Height = textBlock.Padding.Top; newTextBlock.Text = String.Empty; textBlock.Height = textBlock.Height - newTextBlock.Height; } else if (charNumber == -1) { newTextBlock.Height = height; newTextBlock.Text = String.Empty; textBlock.Height = textBlock.Height - height; textBlock.Padding = new Thickness (textBlock.Padding.Left,textBlock.Padding.Top - height,textBlock.Padding.Right,textBlock.Padding.Bottom); } else if (charNumber == -2) { newTextBlock.Height = height; textBlock.Text = String.Empty; textBlock.FieldName = String.Empty; textBlock.Height = textBlock.Height - height; textBlock.Padding = new Thickness (textBlock.Padding.Left,textBlock.Padding.Top - height,textBlock.Padding.Right,textBlock.Padding.Bottom); } controls[0] = newTextBlock; return controls; }
public Control[] BreakOffControlAtMostAtHeight(Cairo.Context c, Control control, double height) { Control[] controls = new Control[2]; var first = control.CreateControl () as Line; var second = control.CreateControl () as Line; double newX = 0; if ( first.Location.X != first.End.X ) { if ( first.Location.Y > first.End.Y ) { newX = calculateXAtYZero(first.End.X,height,first.Location.X,-(first.Height - height)); first.Location = new MonoReports.Model.Point(newX, first.End.Y + height); double deltaW = second.End.X - newX; second.Left -= deltaW; second.Top = 0; second.Location = new MonoReports.Model.Point(second.Location.X + deltaW , second.Location.Y - height); } else if (first.Location.Y < first.End.Y) { newX = calculateXAtYZero(first.Location.X,height,first.End.X,-(first.Height - height)); first.End = new MonoReports.Model.Point(newX, first.Location.Y + height); double deltaW = second.Location.X - newX; second.Left -= deltaW; second.Top = 0; second.End = new MonoReports.Model.Point(second.End.X + deltaW , second.End.Y - height); } } else { if ( first.Location.Y > first.End.Y ) { first.Location = new MonoReports.Model.Point(first.Location.X, first.End.Y + height); second.Top = 0; second.Location = new MonoReports.Model.Point(second.Location.X, second.Location.Y - height); } else if (first.Location.Y < first.End.Y) { first.End = new MonoReports.Model.Point(first.End.X, first.Location.Y + height); second.Top = 0; second.End = new MonoReports.Model.Point(second.End.X , second.End.Y - height); } } controls [0] = first; controls [1] = second; return controls; }
public Control[] BreakOffControlAtMostAtHeight(Control control, double height) { return new Control[]{ control.CreateControl(), control.CreateControl() }; }