Esempio n. 1
0
        // Set the size of inplace editor
        private Rectangle AdjustEditorBounds(Rectangle editorBounds)
        {
            Rectangle screenControlBounds = control.Parent.RectangleToScreen(control.Bounds);

            editorBounds.Offset(0, -3);
            Rectangle screenEditorBounds = control.RectangleToScreen(editorBounds);

            Size preferredSize = GetPreferredSize(editorBounds.Size);
            int  height        = Math.Max(preferredSize.Height, editorBounds.Height);
            int  width         = preferredSize.Width;

            Rectangle rect = screenEditorBounds;

            rect.Offset(6, 0);

            int maxBottom = Math.Min(screenControlBounds.Bottom, rect.Top + height);
            int top       = maxBottom - height;

            Rectangle result = new Rectangle(rect.Left, top, width, height);

            if (screenControlBounds.Right < rect.Right)
            {
                int horzOffset = control.ActiveView is DayView ? 12 : 8;
                result = new Rectangle(screenEditorBounds.Left - width - horzOffset, top, width, height);
            }
            return(result);
        }
Esempio n. 2
0
 public MyInplaceEditor(SchedulerInplaceEditorEventArgs inplaceEditorArgs)
 {
     InitializeComponent();
     this.Text             = string.Empty;
     this.ControlBox       = false;
     this.FormBorderStyle  = System.Windows.Forms.FormBorderStyle.None;
     this.FormBorderEffect = DevExpress.XtraEditors.FormBorderEffect.None;
     SubscribeKeyDownEvents();
     this.control = inplaceEditorArgs.Control;
     if (inplaceEditorArgs.UseFullCellEditor)
     {
         this.Bounds = control.RectangleToScreen(inplaceEditorArgs.Bounds);
         DevExpress.Skins.Skin        currentSkin = DevExpress.Skins.SchedulerSkins.GetSkin(control.LookAndFeel);
         DevExpress.Skins.SkinElement element     = currentSkin[DevExpress.Skins.SchedulerSkins.SkinAllDayAreaSelected];
         this.BackColor = element.Color.BackColor;
         this.ForeColor = Color.White;
     }
     else
     {
         this.Bounds    = AdjustEditorBounds(inplaceEditorArgs.Bounds);
         this.BackColor = inplaceEditorArgs.BackColor;
     }
 }