Beispiel #1
0
        void radListBox1_MouseMove(object sender, MouseEventArgs e)
        {
            if (e.Button != MouseButtons.Left)
            {
                return;
            }

            if (this.isDragging)
            {
                return;
            }

            Point currentPosition = e.Location;

            if ((Math.Abs(currentPosition.X - this.mouseDownPosition.X) >= SystemInformation.DragSize.Width) ||
                (Math.Abs(currentPosition.Y - this.mouseDownPosition.Y) >= SystemInformation.DragSize.Height))
            {
                this.isDragging = true;
                DragObject        dragObject = new DragObject();
                RadListVisualItem item       = this.radListBox1.ElementTree.GetElementAtPoint(e.Location) as RadListVisualItem;

                if (item != null)
                {
                    dragObject.Values.Add(AppointmentFields.Summary, item.Text);
                    dragObject.Status = AppointmentFields.Summary;

                    (sender as RadListControl).DoDragDrop(dragObject, DragDropEffects.Copy);
                }
            }
        }
Beispiel #2
0
 void ClosePopup(object sender, EventArgs ea)
 {
     this.popupShown = false;
     this.UnWireEvents();
     this.item  = null;
     this.popup = null;
 }
Beispiel #3
0
        public override void OnPropertyChange(RadElement element, RadPropertyChangedEventArgs e)
        {
            if ((bool)e.NewValue == true)
            {
                this.item = element as RadListVisualItem;

                if (!this.popupShown)
                {
                    comboPopup = item.ElementTree.Control as DropDownPopupForm;
                    if (comboPopup == null)
                    {
                        return;
                    }

                    comboPopup.PopupClosing += comboPopup_PopupClosing;
                    if (comboPopup.IsDisplayed)
                    {
                        this.popupShown = true;
                        this.popup      = new ZoomPopup(element, new SizeF(1.1f, 1.1f));
                        this.popup.BeginInit();
                        this.WireEvents();
                        this.popup.EndInit();
                        this.popup.Show();
                    }
                }
            }
        }
Beispiel #4
0
        void radListControl1_VisualItemFormatting(object sender, Telerik.WinControls.UI.VisualItemFormattingEventArgs args)
        {
            RadListVisualItem item = args.VisualItem;
            int rowIndex           = item.Data.RowIndex;

            System.ComponentModel.TypeConverter typeConverter = TypeDescriptor.GetConverter(typeof(Color));
            item.DrawFill      = true;
            item.BackColor     = (Color)typeConverter.ConvertFromString(null, CultureInfo.InvariantCulture, bgColors[rowIndex % 7]);
            item.GradientStyle = Telerik.WinControls.GradientStyles.Solid;
        }
 public VisualItemFormattingEventArgs(RadListVisualItem item)
 {
     this.item = item;
 }
        private void DrawFeedBack(MouseEventArgs e)
        {
            if (targetListBox == null)
            {
                feedBackForm.Hide(); return;
            }
            this.targetComponentElementTree = this.targetListBox.ElementTree;
            Point p4 = new Point();

            p4 = sourceListBox.PointToScreen(new Point(e.X, e.Y));
            p4 = targetListBox.PointToClient(p4);
            RadElement elementAtPoint = targetComponentElementTree.GetElementAtPoint(p4);

            RadListVisualItem visualReplacedItem = elementAtPoint as RadListVisualItem;

            this.replacedItem = visualReplacedItem != null ? visualReplacedItem.Data : null;

            if (visualReplacedItem == null)
            {
                feedBackForm.Hide(); return;
            }

            if (visualReplacedItem != null)
            {
                int UpperBound  = visualReplacedItem.Bounds.Height * this.targetListBox.Items.IndexOf(this.replacedItem);
                int MiddleBound = UpperBound + visualReplacedItem.Bounds.Height / 2;
                int LowerBound  = UpperBound + visualReplacedItem.Bounds.Height;

                if (p4.Y < UpperBound || p4.Y > LowerBound)
                {
                    //FeedBack shouldnt be drawn
                    feedBackForm.StartPoint = null;
                }

                if (p4.Y <= MiddleBound && p4.Y > UpperBound)
                {
                    //FeedBack should be drawn above the replceditem
                    feedBackForm.StartPoint = this.targetListBox.PointToScreen(new Point(0 + 3, UpperBound + 1));
                }

                if (p4.Y <= LowerBound && p4.Y > MiddleBound)
                {
                    //FeedBack should be drawn below the replaceditem
                    feedBackForm.StartPoint = this.targetListBox.PointToScreen(new Point(0 + 3, UpperBound + 1 + visualReplacedItem.Bounds.Height));
                }
            }

            if (elementAtPoint is RadListElement)
            {
                if (targetListBox.Items.Count > 0)
                {
                    RadListDataItem lastItem = this.targetListBox.Items[this.targetListBox.Items.Count - 1];


                    //FeedBack should be drawn always below the last item of the targetListBox
                    if (feedBackForm == null)
                    {
                        return;
                    }
                    feedBackForm.StartPoint = this.targetListBox.PointToScreen(new Point(3, 1 + lastItem.VisualItem.Bounds.Height * this.targetListBox.Items.IndexOf(lastItem) + lastItem.VisualItem.Bounds.Height));
                }
                else
                {
                    feedBackForm.StartPoint = null;
                }
            }
            SetFeedBackForm();
        }