Esempio n. 1
0
        public GridWithFilterPanelButtons()
        {
            InitializeComponent();

            CustomGridControl customGridControl = new CustomGridControl();

            customGridControl.Dock       = DockStyle.Fill;
            customGridControlView        = new CustomGridControlView();
            customGridControl.MainView   = customGridControlView;
            customGridControl.DataSource = new List <TestData>()
            {
                new TestData("Test1", true), new TestData("Test2", false), new TestData("Test3", true)
            };
            customGridControlView.OptionsView.ShowFilterPanelMode = DevExpress.XtraGrid.Views.Base.ShowFilterPanelMode.ShowAlways;
            EditorButton btn = new EditorButton(ButtonPredefines.OK);

            AddCustomFilterPanelButton(ButtonPredefines.Redo, isLeft: false);
            AddCustomFilterPanelButton(ButtonPredefines.Plus, isNeedClickEvent: false);

            SimpleButton button = new SimpleButton();

            button.Click += OnAddButton;
            button.Dock   = DockStyle.Left;
            button.Text   = "AddCustomFilterPanelButton";
            button.Width  = 150;

            PanelControl panelControl = new PanelControl();

            panelControl.Height = 30;
            panelControl.Dock   = DockStyle.Bottom;
            panelControl.Controls.Add(button);
            Controls.Add(customGridControl);
            Controls.Add(panelControl);
        }
Esempio n. 2
0
        Rectangle GetButtonBounds(EditorButton button, CustomGridControlView controlView)
        {
            Point startPosition;

            if (button.IsLeft)
            {
                startPosition = new Point(
                    LeftStartPoint.X + (SizeOfButton.Width + Offset) * controlView.CustomFilterPanelButtons.ToList().FindAll(p => p.IsLeft).IndexOf(button),
                    LeftStartPoint.Y);
            }
            else
            {
                startPosition = new Point(
                    RightStartPoint.X - (SizeOfButton.Width + Offset) * controlView.CustomFilterPanelButtons.ToList().FindAll(p => !p.IsLeft).IndexOf(button),
                    LeftStartPoint.Y);
            }
            return(new Rectangle(startPosition, SizeOfButton));
        }
Esempio n. 3
0
        void DrawButtons(GraphicsCache cache, EditorButtonObjectCollection collection)
        {
            CustomGridControlView view = viewInfo.View as CustomGridControlView;

            foreach (EditorButtonObjectInfoArgs button in collection)
            {
                if (view.CustomFilterPanelButtons.IndexOf(button.Button) < viewInfo.CustomButtonsCountToDraw)
                {
                    if (button.Cache == null)
                    {
                        button.Cache = cache;
                    }
                    EditorButtonHelper.GetPainter(BorderStyles.Default).DrawObject(button);
                }
                else
                {
                    break;
                }
            }
        }
Esempio n. 4
0
 public CustomGridControlViewInfo(GridView view) : base(view)
 {
     controlView = View as CustomGridControlView;
 }
Esempio n. 5
0
 protected override void CreateMainView()
 {
     base.CreateMainView();
     gridControlView     = (Views.FirstOrDefault() as CustomGridControlView);
     gridControlViewInfo = Views.FirstOrDefault().GetViewInfo() as CustomGridControlViewInfo;
 }