Exemplo n.º 1
0
        private static Rectangle getFieldBounds(FieldControl field, LayoutControl card)
        {
            var fieldBounds = field.Bounds;

            fieldBounds.Offset(card.Location);
            return(fieldBounds);
        }
Exemplo n.º 2
0
 internal void SetCard(LayoutControl card, int rowHandle, object dataSource)
 {
     Card          = card;
     RowHandle     = rowHandle;
     CardBounds    = card?.Bounds;
     RowDataSource = dataSource;
 }
Exemplo n.º 3
0
        public virtual void CopyFrom(LayoutControl other)
        {
            Font             = other.Font;
            Size             = other.Size;
            HighlightOptions = other.HighlightOptions.Clone();

            using (var thisEnumerator = Fields.GetEnumerator())
                using (var otherEnumerator = other.Fields.GetEnumerator())
                    while (thisEnumerator.MoveNext() && otherEnumerator.MoveNext())
                    {
                        thisEnumerator.Current.CopyFrom(otherEnumerator.Current);
                    }
        }
Exemplo n.º 4
0
        private void cardInvalidated(LayoutControl layoutControl, FieldControl fieldControl)
        {
            Rectangle rect;

            if (fieldControl != null)
            {
                rect = fieldControl.Bounds;
                rect.Offset(layoutControl.Location);
            }
            else
            {
                rect = layoutControl.Bounds;
            }

            Invalidate(rect);
        }
Exemplo n.º 5
0
        private void paintButtons(PaintEventArgs e, FieldControl field, LayoutControl card)
        {
            var fieldBounds = getFieldBounds(field, card);

            var buttons = card.GetFieldButtons(field, SearchOptions, SortOptions).ToList();

            buttons.LayOutIn(fieldBounds);

            foreach (var button in buttons)
            {
                if (button.Size == Size.Empty || button.Icon == null)
                {
                    continue;
                }

                e.Graphics.DrawImage(button.Icon, button.Location);
            }
        }
Exemplo n.º 6
0
        private static void probeCardCreating(object view, LayoutControl probeCard)
        {
            var card = (DeckListLayout)probeCard;

            card.ScaleDpi();

            foreach (var field in card.Fields)
            {
                field.Image = ((Bitmap)field.Image)?.HalfResizeDpi();

                for (int i = 0; i < field.CustomButtons.Count; i++)
                {
                    var button = field.CustomButtons[i];
                    button.Icon = button.Icon?.ResizeDpi();
                }
            }

            card.ImageDeckBox       = Resources.deckbox.ResizeDpi();
            card.ImageDeckBoxOpened = Resources.deckbox_opened.ResizeDpi();
        }
Exemplo n.º 7
0
        private void paintFieldData(PaintEventArgs e, LayoutControl card, FieldControl field, Rectangle fieldArea, int rowHandle)
        {
            if (CustomDrawField != null)
            {
                var customFieldArgs = new CustomDrawArgs
                {
                    RowHandle   = rowHandle,
                    Graphics    = e.Graphics,
                    Bounds      = fieldArea,
                    FieldName   = field.FieldName,
                    Handled     = false,
                    Font        = field.Font,
                    ForeColor   = field.ForeColor,
                    DisplayText = field.DataText,
                    HAlignment  = field.HorizontalAlignment,
                    Selection   = _selection
                };

                CustomDrawField.Invoke(this, customFieldArgs);

                if (!customFieldArgs.Handled)
                {
                    field.PaintSelf(
                        e.Graphics,
                        card.Location,
                        card.HighlightOptions,
                        _selection,
                        SelectionOptions);
                }
            }
            else
            {
                field.PaintSelf(
                    e.Graphics,
                    card.Location,
                    card.HighlightOptions,
                    _selection,
                    SelectionOptions);
            }
        }
Exemplo n.º 8
0
 public bool IsButtonVisible(LayoutControl card, FieldControl field) =>
 Allow && card.ShowSortButton(field);
Exemplo n.º 9
0
 private void invalidateField(FieldControl field, LayoutControl card)
 {
     Invalidate(new Rectangle(field.Location.Plus(card.Location), field.Size));
 }