Пример #1
0
 private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
 {
     if (e.ChangedItem.Label == "RenderPriority")
     {
         ((DialogControl)propertyGrid.SelectedObject).Parent.ResortChildren();
     }
     graphicsControl1.Invalidate();
     if (!data.Changed)
     {
         data.Changed = true;
         if (data.TabPage != null)
         {
             data.TabPage.Title += " *";
         }
     }
     if (e.ChangedItem.Parent.Label == "Events")
     {
         //data.AppendCode("void " + (string)e.ChangedItem.Value + "(int sender, Dialog dialog)\n{\n}");
         data.InsertEvent((string)e.ChangedItem.Value, false);
     }
     data.UpdateDesigener();
 }
Пример #2
0
        protected override void OnMouseUp(MouseEventArgs e)
        {
            if (DisableMouseControl)
            {
                return;
            }
            //Select/deselect
            if (status == Status.Idle)
            {
                if (mouseDownItem != null)
                {
                    if (SelectedItems.Contains(mouseDownItem))
                    {
                        if (ModifierKeys == Keys.Shift)
                        {
                            SelectedItems.Remove(mouseDownItem);
                            if (MainSelectedItem == mouseDownItem)
                            {
                                if (SelectedItems.Count == 0)
                                {
                                    MainSelectedItem = null;
                                }
                                else
                                {
                                    MainSelectedItem = SelectedItems[0];
                                }
                            }
                        }
                        else
                        {
                            MainSelectedItem = mouseDownItem;
                        }
                    }
                    else
                    {
                        if (ModifierKeys != Keys.Shift)
                        {
                            SelectedItems.Clear();
                        }
                        SelectedItems.Add(mouseDownItem);
                        MainSelectedItem = mouseDownItem;
                    }
                }
                else
                {
                    SelectedItems.Clear();
                    MainSelectedItem = null;
                }
                Invalidate();
            }
            else if (status == Status.CreatingControl)
            {
                Point     min  = new Point(Math.Min(mouseDownPosition.X, lastMousePos.X), Math.Min(mouseDownPosition.Y, lastMousePos.Y));
                Point     max  = new Point(Math.Max(mouseDownPosition.X, lastMousePos.X), Math.Max(mouseDownPosition.Y, lastMousePos.Y));
                Rectangle rect = new Rectangle(min.X, min.Y, max.X - min.X, max.Y - min.Y);
                if (rect.Width <= 5)
                {
                    rect.Width = controlBeingCreated.DefaultSize.Width;
                }
                if (rect.Height <= 5)
                {
                    rect.Height = controlBeingCreated.DefaultSize.Height;
                }
                controlBeingCreated.MoveTo(rect.X, rect.Y, rect.Width, rect.Height);
                controlBeingCreated.ContextChanged(this);

                /*items.Add(controlBeingCreated);
                 * items.Sort(Comparerer);
                 * items.Sort(Comparerer);*/
                if (controlBeingCreated is Dialog)
                {
                    items.Add((Dialog)controlBeingCreated);
                }
                else
                {
                    controlBeingCreated.Parent.AddControl((DialogControl)controlBeingCreated);
                }
                Parent.ControlCreated(controlBeingCreated);
                SelectedItems.Clear();
                SelectedItems.Add(controlBeingCreated);
                MainSelectedItem = controlBeingCreated;
                Invalidate();
                Data.UpdateDesigener();
            }
            status        = Status.Idle;
            mouseDownItem = null;
            if (Parent != null)
            {
                Parent.UpdateSelectedItem();
            }
        }