当前位置: 首页>>代码示例>>C#>>正文


C# ToolStripDropDown.Show方法代码示例

本文整理汇总了C#中System.Windows.Forms.ToolStripDropDown.Show方法的典型用法代码示例。如果您正苦于以下问题:C# ToolStripDropDown.Show方法的具体用法?C# ToolStripDropDown.Show怎么用?C# ToolStripDropDown.Show使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Forms.ToolStripDropDown的用法示例。


在下文中一共展示了ToolStripDropDown.Show方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Show

        public void Show(Point screenLocation)
        {
            ToolStripControlHost host = new ToolStripControlHost(this);
            ToolStripDropDown = new ToolStripDropDown();
            ToolStripDropDown.Items.Clear();
            ToolStripDropDown.Items.Add(host);

            ToolStripDropDown.Padding = Padding.Empty;
            ToolStripDropDown.Margin = Padding.Empty;
            host.Padding = Padding.Empty;
            host.Margin = Padding.Empty;

            ToolStripDropDown.Closed += new ToolStripDropDownClosedEventHandler(ToolStripDropDown_Closed);

            ToolStripDropDown.Show(screenLocation);
        }
开发者ID:okyereadugyamfi,项目名称:softlogik,代码行数:16,代码来源:RibbonPopup.cs

示例2: SelectModel

        private void SelectModel(object sender, EventArgs e)
        {
            // We want to pop up a small drop-down window with a
            // property grid that can be used to set all of the properties
            // in the ModelViewSettings object. This is a handy non-model
            // way to change the selected model

            var dropDownCtrl = new PropertyGrid();
            dropDownCtrl.SelectedObject = Object;
            dropDownCtrl.ToolbarVisible = false;
            dropDownCtrl.HelpVisible = false;

            var toolDrop = new ToolStripDropDown();
            var toolHost = new ToolStripControlHost(dropDownCtrl);
            toolHost.Margin = new Padding(0);
            toolDrop.Padding = new Padding(0);
            toolDrop.Items.Add(toolHost);

            // we don't have a way to know the ideal height of the drop down ctrl... just make a guess based on the text height
            toolHost.AutoSize = false;
            toolHost.Size = new Size(512, 8 * dropDownCtrl.Font.Height);

            toolDrop.Show(this, PointToClient(MousePosition));
        }
开发者ID:coreafive,项目名称:XLE,代码行数:24,代码来源:CtrlStrip.cs

示例3: btnCustomMoleculeColumns_Click

        private void btnCustomMoleculeColumns_Click(object sender, EventArgs e)
        {
            var checkedListBox = new CheckedListBox {CheckOnClick = true};
            checkedListBox.ItemCheck += CheckedListBox_ItemCheck;
            checkedListBox.Items.Clear();
            foreach (DataGridViewColumn c in gridViewTransitionList.Columns)
            {
                checkedListBox.Items.Add(c.HeaderText, c.Visible);
            }
            checkedListBox.Height = checkedListBox.Items.Count * radioMolecule.Height * 12 / 10;
            checkedListBox.Width = radioMolecule.Width * 3;
            var controlHost = new ToolStripControlHost(checkedListBox)
            {
                Padding = Padding.Empty,
                Margin = Padding.Empty,
                AutoSize = false
            };

            var popup = new ToolStripDropDown {Padding = Padding.Empty};
            popup.Items.Add(controlHost);

            popup.Show(btnCustomMoleculeColumns.PointToScreen(new Point(0, -checkedListBox.Height)));
        }
开发者ID:lgatto,项目名称:proteowizard,代码行数:23,代码来源:PasteDlg.cs

示例4: ShowTooltip

        private void ShowTooltip()
        {
            Point loc = Cursor.Position;
            Control child = this.GetChildAtPoint(this.PointToClient(loc));
            if (child is EvilDPSBar)
            {
                EvilDPSGraph g = GetGraphForBar(child);
                if (g.Samples.Count == 0)
                    return;
                ToolStripDropDown f = new ToolStripDropDown();
                f.Margin = Padding.Empty;
                f.Padding = Padding.Empty;
                ToolStripControlHost host = new ToolStripControlHost(g);
                host.Padding = Padding.Empty;
                host.Margin = Padding.Empty;
                f.Items.Add(host);
                f.Width = 300;
                f.Height = 80;
                g.Dock = DockStyle.Fill;
                host.Dock = DockStyle.Fill;
                g.Width = 300;
                g.Height = 80;
                f.Show(Cursor.Position);

                currentGraph = g;
            }
        }
开发者ID:Tilps,项目名称:Stash,代码行数:27,代码来源:EvilDPSArea.cs

示例5: Show

        /// <summary>
        /// Shows this Popup on the specified location of the screen
        /// </summary>
        /// <param name="screenLocation"></param>
        public void Show(Point screenLocation)
        {
            var host = new ToolStripControlHost(this);
            ToolStripDropDown = new ToolStripDropDown();
            ToolStripDropDown.Items.Clear();
            ToolStripDropDown.Items.Add(host);

            ToolStripDropDown.Padding = Padding.Empty;
            ToolStripDropDown.Margin = Padding.Empty;
            host.Padding = Padding.Empty;
            host.Margin = Padding.Empty;

            ToolStripDropDown.Opening += ToolStripDropDown_Opening;
            ToolStripDropDown.Closing += ToolStripDropDown_Closing;
            ToolStripDropDown.Closed += ToolStripDropDown_Closed;
            ToolStripDropDown.Show(screenLocation);
            MouseWheel += ToolStripDropDown_MouseWheel;

            OnShowed(EventArgs.Empty);
        }
开发者ID:AlexGaidukov,项目名称:gipertest_streaming,代码行数:24,代码来源:RibbonPopup.cs

示例6: OnClick

        public override bool OnClick(System.Windows.Forms.Control container, System.Windows.Forms.MouseEventArgs evnt, System.Drawing.Drawing2D.Matrix viewTransform)
		{
			base.OnClick(container, evnt, viewTransform);

            if (evnt.Button == System.Windows.Forms.MouseButtons.Left)
            {
                var basePts = new PointF[] { 
                    new PointF(Node.bounds.Left + GraphConstants.HorizontalSpacing, bounds.Top), 
                    new PointF(Node.bounds.Right + GraphConstants.HorizontalSpacing - GraphConstants.NodeExtraWidth, bounds.Bottom) };
                viewTransform.TransformPoints(basePts);

                var dropDownCtrl = new ListBox();
                dropDownCtrl.BorderStyle = BorderStyle.None;
                dropDownCtrl.Margin = new Padding(0);
                dropDownCtrl.Padding = new Padding(0);

                dropDownCtrl.DrawMode = DrawMode.OwnerDrawVariable;
                dropDownCtrl.DrawItem +=
                    (object sender, DrawItemEventArgs e) =>
                    {
                        var lb = sender as ListBox;
                        var item = lb.Items[e.Index];

                        bool selectedState = e.State != DrawItemState.None;

                        // We have to draw the background every item, because the control 
                        // background isn't refreshed on state changes
                        e.Graphics.FillRectangle(selectedState ? Brushes.Gray : BackgroundBrush, e.Bounds);
                        e.Graphics.DrawString(
                            item.ToString(), SystemFonts.MenuFont, selectedState ? Brushes.Black : Brushes.White,
                            e.Bounds, GraphConstants.LeftTextStringFormat);
                    };

                dropDownCtrl.MeasureItem +=
                    (object sender, MeasureItemEventArgs e) =>
                    {
                        var lb = sender as ListBox;
                        var item = lb.Items[e.Index];
                        var size = new Size(GraphConstants.MinimumItemWidth, GraphConstants.MinimumItemHeight);
                        var textSize = e.Graphics.MeasureString(
                            item.ToString(), SystemFonts.MenuFont,
                            size, GraphConstants.LeftMeasureTextStringFormat);
                        e.ItemWidth = (int)textSize.Width;
                        e.ItemHeight = (int)textSize.Height;
                    };

                dropDownCtrl.BackColor = Color.FromArgb(96, 96, 96);

                dropDownCtrl.Items.AddRange(Items);
                dropDownCtrl.SelectedIndex = SelectedIndex;
                
                var toolDrop = new ToolStripDropDown();
                var toolHost = new ToolStripControlHost(dropDownCtrl);
                toolHost.Margin = new Padding(0);
                toolDrop.Padding = new Padding(0);
                toolDrop.Items.Add(toolHost);

                // Unfortunately the AutoSize functionality for toolHost just doesn't
                // work with an owner draw list box... Perhaps MeasureItem isn't called
                // until the list box is first drawn -- but that is after the tool host
                // has done it's auto size
                toolHost.AutoSize = false;
                toolHost.Size = new Size((int)(basePts[1].X - basePts[0].X), dropDownCtrl.PreferredHeight + 20);
                
                dropDownCtrl.SelectedIndexChanged +=
                    (object sender, System.EventArgs e) =>
                    {
                        var lb = sender as ListBox;
                        if (lb != null)
                            SelectedIndex = lb.SelectedIndex;
                        toolDrop.Close();
                    };

                toolDrop.Show(container, new Point((int)basePts[0].X, (int)basePts[1].Y + 4));
                return true;
            }

            return false;
		}
开发者ID:coreafive,项目名称:XLE,代码行数:79,代码来源:NodeDropDownItem.cs

示例7: Paint

        /*
        protected internal override void Paint(Graphics gr)
        {
          if (MouseIsOver && m_Grid.ColumnResizeAllowed &&  m_Grid.m_RepositioningColumn==null)
        using(var br =  new LinearGradientBrush(Region, Color.Blue, Color.White, LinearGradientMode.ForwardDiagonal))
        {
          gr.FillRectangle(br, Region);
        }
        }
        */
        protected internal override void OnMouseClick(MouseEventArgs e)
        {
            // Right click on the right edge of a column - open the column picker
              if (e.Button == MouseButtons.Right)
              {
            if (!m_Grid.Columns.Any() || !m_Grid.ColumnHidingAllowed)
              return;

            var longestText     = new string('W', m_Grid.Columns.Max(c => c.Title.Length));
            var textSize        = TextRenderer.MeasureText(longestText, m_Grid.Font);
            int preferredHeight = (m_Grid.Columns.Count * textSize.Height) + 7;
            var checkedListBox  = new CheckedListBox()
            {
              CheckOnClick = true,
              Height       = (preferredHeight < 350) ? preferredHeight : 350,
              Width        = Math.Min(textSize.Width, m_Grid.Width),
            };
            checkedListBox.ItemCheck += (sender, ea) =>
            {
              var column = m_Grid.Columns.FirstOrDefault(c => c.Title.Equals(checkedListBox.Items[ea.Index].ToString()));
              if (column == null) return;
              if (m_Grid.Columns.Count(c => c.Visible) > 1 || ea.NewValue == CheckState.Checked)
            column.Visible = ea.NewValue == CheckState.Checked;
              else
            ea.NewValue = ea.CurrentValue;
            };

            foreach (var c in m_Grid.Columns)
              checkedListBox.Items.Add(c.Title, c.Visible);

            var controlHost = new ToolStripControlHost(checkedListBox)
            {
              Padding  = Padding.Empty,
              Margin   = Padding.Empty,
              AutoSize = false
            };

            // The following permits handling of custom actions such as applying themes
            // to the newly created control:
            m_Grid.Controls.Add(checkedListBox);

            var popup = new ToolStripDropDown() {Padding = Padding.Empty};
            popup.Items.Add(controlHost);
            popup.Disposed += (sender, args) => m_Grid.Controls.Remove(checkedListBox); // This removes checkedListBox from m_Grid.Controls

            popup.Show(m_Grid.PointToScreen(e.Location));
              }

              base.OnMouseClick(e);
        }
开发者ID:itadapter,项目名称:nfx,代码行数:60,代码来源:ColumnResizeElement.cs


注:本文中的System.Windows.Forms.ToolStripDropDown.Show方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。