Esempio n. 1
0
            public Palette(ItemPalette parent, Point location)
            {
                this.parent       = parent;
                this.enabledItems = new ItemList <System.Workflow.ComponentModel.Design.ItemInfo>(this);
                foreach (System.Workflow.ComponentModel.Design.ItemInfo info in this.parent.items)
                {
                    ActivityDesignerVerb verb = info.UserData[DesignerUserDataKeys.DesignerVerb] as ActivityDesignerVerb;
                    if ((verb == null) || verb.Enabled)
                    {
                        this.enabledItems.Add(info);
                    }
                }
                this.menuItemCount = this.enabledItems.Count;
                base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
                base.FormBorderStyle = FormBorderStyle.None;
                this.BackColor       = Color.White;
                base.ShowInTaskbar   = false;
                base.MaximizeBox     = false;
                base.ControlBox      = false;
                base.StartPosition   = FormStartPosition.Manual;
                Screen screen = Screen.FromPoint(location);

                this.workingRectangle = screen.WorkingArea;
                this.PreparePalette(location);
                this.paletteShadow = new PaletteShadow(this);
            }
Esempio n. 2
0
        protected override void OnShowSmartTagVerbs(Point smartTagPoint)
        {
            if (this.itemPalette == null)
            {
                this.itemPalette                   = new ItemPalette();
                this.itemPalette.Closed           += new EventHandler(OnPaletteClosed);
                this.itemPalette.SelectionChanged += new SelectionChangeEventHandler <SelectionChangeEventArgs>(OnSmartAction);
            }

            //we need to update the font every time the menu is shown
            this.itemPalette.SetFont(WorkflowTheme.CurrentTheme.AmbientTheme.Font);

            this.itemPalette.Items.Clear();

            foreach (ActivityDesignerVerb smartVerb in SmartTagVerbs)
            {
                Image    image         = smartVerb.Properties[DesignerUserDataKeys.Image] as Image;
                ItemInfo smartVerbItem = new ItemInfo(smartVerb.Id, image, smartVerb.Text);
                smartVerbItem.UserData[DesignerUserDataKeys.DesignerVerb] = smartVerb;
                this.itemPalette.Items.Add(smartVerbItem);
            }

            Point location = PointToScreen(smartTagPoint);

            this.itemPalette.Show(location);
        }
        protected override void OnShowSmartTagVerbs(Point smartTagPoint)
        {
            if (this.itemPalette == null)
            {
                this.itemPalette                   = new ItemPalette();
                this.itemPalette.Closed           += new EventHandler(this.OnPaletteClosed);
                this.itemPalette.SelectionChanged += new SelectionChangeEventHandler <SelectionChangeEventArgs>(this.OnSmartAction);
            }
            this.itemPalette.SetFont(WorkflowTheme.CurrentTheme.AmbientTheme.Font);
            this.itemPalette.Items.Clear();
            foreach (ActivityDesignerVerb verb in this.SmartTagVerbs)
            {
                Image image = verb.Properties[DesignerUserDataKeys.Image] as Image;
                System.Workflow.ComponentModel.Design.ItemInfo item = new System.Workflow.ComponentModel.Design.ItemInfo(verb.Id, image, verb.Text);
                item.UserData[DesignerUserDataKeys.DesignerVerb] = verb;
                this.itemPalette.Items.Add(item);
            }
            Point location = base.PointToScreen(smartTagPoint);

            this.itemPalette.Show(location);
        }
        protected override void OnShowSmartTagVerbs(Point smartTagPoint)
        {
            if (this.itemPalette == null)
            {
                this.itemPalette = new ItemPalette();
                this.itemPalette.Closed += new EventHandler(OnPaletteClosed);
                this.itemPalette.SelectionChanged += new SelectionChangeEventHandler<SelectionChangeEventArgs>(OnSmartAction);
            }

            //we need to update the font every time the menu is shown
            this.itemPalette.SetFont(WorkflowTheme.CurrentTheme.AmbientTheme.Font);

            this.itemPalette.Items.Clear();

            foreach (ActivityDesignerVerb smartVerb in SmartTagVerbs)
            {
                Image image = smartVerb.Properties[DesignerUserDataKeys.Image] as Image;
                ItemInfo smartVerbItem = new ItemInfo(smartVerb.Id, image, smartVerb.Text);
                smartVerbItem.UserData[DesignerUserDataKeys.DesignerVerb] = smartVerb;
                this.itemPalette.Items.Add(smartVerbItem);
            }

            Point location = PointToScreen(smartTagPoint);
            this.itemPalette.Show(location);
        }
            public Palette(ItemPalette parent, Point location)
            {
                this.parent = parent;

                //copy over only items with enabled commands
                this.enabledItems = new ItemList<ItemInfo>(this);
                foreach (ItemInfo item in this.parent.items)
                {
                    ActivityDesignerVerb smartVerb = item.UserData[DesignerUserDataKeys.DesignerVerb] as ActivityDesignerVerb;
                    if (smartVerb == null || smartVerb.Enabled)
                        this.enabledItems.Add(item);
                }

                this.menuItemCount = this.enabledItems.Count;

                SetStyle(ControlStyles.OptimizedDoubleBuffer |
                            ControlStyles.UserPaint |
                            ControlStyles.SupportsTransparentBackColor |
                            ControlStyles.AllPaintingInWmPaint, true);

                FormBorderStyle = FormBorderStyle.None;
                BackColor = Color.White;
                ShowInTaskbar = false;
                MaximizeBox = false;
                ControlBox = false;
                StartPosition = FormStartPosition.Manual;

                Screen closestScreen = Screen.FromPoint(location);
                this.workingRectangle = closestScreen.WorkingArea;

                PreparePalette(location);

                this.paletteShadow = new PaletteShadow(this);
            }
 public PaletteShadow(ItemPalette.Palette parent)
 {
     this.parent = parent;
     base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
     base.FormBorderStyle = FormBorderStyle.None;
     this.BackColor = Color.White;
     base.ShowInTaskbar = false;
     base.MaximizeBox = false;
     base.ControlBox = false;
     base.Opacity = 0.5;
     base.StartPosition = FormStartPosition.Manual;
     base.Enabled = false;
     base.Region = parent.Region;
     base.Location = new Point(this.parent.Location.X + ItemPalette.Palette.DropShadowWidth, this.parent.Location.Y + ItemPalette.Palette.DropShadowWidth);
 }
 public Palette(ItemPalette parent, Point location)
 {
     this.parent = parent;
     this.enabledItems = new ItemList<System.Workflow.ComponentModel.Design.ItemInfo>(this);
     foreach (System.Workflow.ComponentModel.Design.ItemInfo info in this.parent.items)
     {
         ActivityDesignerVerb verb = info.UserData[DesignerUserDataKeys.DesignerVerb] as ActivityDesignerVerb;
         if ((verb == null) || verb.Enabled)
         {
             this.enabledItems.Add(info);
         }
     }
     this.menuItemCount = this.enabledItems.Count;
     base.SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint | ControlStyles.SupportsTransparentBackColor | ControlStyles.UserPaint, true);
     base.FormBorderStyle = FormBorderStyle.None;
     this.BackColor = Color.White;
     base.ShowInTaskbar = false;
     base.MaximizeBox = false;
     base.ControlBox = false;
     base.StartPosition = FormStartPosition.Manual;
     Screen screen = Screen.FromPoint(location);
     this.workingRectangle = screen.WorkingArea;
     this.PreparePalette(location);
     this.paletteShadow = new PaletteShadow(this);
 }
 protected override void OnShowSmartTagVerbs(Point smartTagPoint)
 {
     if (this.itemPalette == null)
     {
         this.itemPalette = new ItemPalette();
         this.itemPalette.Closed += new EventHandler(this.OnPaletteClosed);
         this.itemPalette.SelectionChanged += new SelectionChangeEventHandler<SelectionChangeEventArgs>(this.OnSmartAction);
     }
     this.itemPalette.SetFont(WorkflowTheme.CurrentTheme.AmbientTheme.Font);
     this.itemPalette.Items.Clear();
     foreach (ActivityDesignerVerb verb in this.SmartTagVerbs)
     {
         Image image = verb.Properties[DesignerUserDataKeys.Image] as Image;
         System.Workflow.ComponentModel.Design.ItemInfo item = new System.Workflow.ComponentModel.Design.ItemInfo(verb.Id, image, verb.Text);
         item.UserData[DesignerUserDataKeys.DesignerVerb] = verb;
         this.itemPalette.Items.Add(item);
     }
     Point location = base.PointToScreen(smartTagPoint);
     this.itemPalette.Show(location);
 }