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


C# PictureBox.PerformLayout方法代码示例

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


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

示例1: legendToolStripMenuItem_Click

        private void legendToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                Form legend = new Form();
                legend.Icon = BIDSHelper.Resources.Common.BIDSHelper;
                legend.Text = "Visualize Attribute Lattice - Legend";
                legend.MaximizeBox = false;
                legend.MinimizeBox = false;
                PictureBox pic = new PictureBox();
                pic.Location = new System.Drawing.Point(0, 0);
                pic.Size = new System.Drawing.Size(290, 480);


                Bitmap canvas = new Bitmap(pic.Width, pic.Height);
                Graphics g = Graphics.FromImage(canvas);
                g.SmoothingMode = SmoothingMode.AntiAlias;
                g.FillRectangle(new SolidBrush(Color.White), 0, 0, canvas.Width, canvas.Height);

                g.DrawString("Relationship Types", new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold | FontStyle.Underline), new SolidBrush(Color.Black), new RectangleF(10, 12, 200, 25));
                Pen pen = new Pen(Color.Green, 1.55F); //Color.Gray) //active and rigid
                g.DrawLine(pen, 10, 50, 100, 50); //active and rigid
                g.DrawString("= Active and rigid", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 45 - 3, 200, 25));
                pen.DashStyle = DashStyle.Dash;
                pen.DashPattern = new float[] { 1F, 1.55F };
                g.DrawLine(pen, 10, 75, 100, 75); //active and flexible
                g.DrawString("= Active and flexible", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 70 - 3, 200, 25));
                pen = new Pen(Color.Gray, 1.55F);
                g.DrawLine(pen, 10, 100, 100, 100); //inactive and rigid
                g.DrawString("= Inactive and rigid", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 95 - 3, 200, 25));
                pen.DashStyle = DashStyle.Dash;
                pen.DashPattern = new float[] { 1F, 1.55F };
                g.DrawLine(pen, 10, 125, 100, 125); //inactive and flexible
                g.DrawString("= Inactive and flexible", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, 120 - 3, 200, 25));

                pen.Width = 5;
                pen.Color = Color.Red;
                pen.DashStyle = DashStyle.Dash;
                pen.DashPattern = new float[] { 0.4F, 1.5F };
                g.DrawLine(pen, 10, 150, 100, 150); //overlapping relationship being highlighted so it is seen
                g.DrawString("= Red ensures overlapping\r\n   relationship is seen", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Black), new RectangleF(105, 145 - 3, 200, 40));


                g.DrawString("Attribute Types", new Font(FontFamily.GenericSansSerif, 11, FontStyle.Bold | FontStyle.Underline), new SolidBrush(Color.Black), new RectangleF(10, 200, 200, 25));

                StringFormat centered = new StringFormat();
                centered.Alignment = StringAlignment.Center;

                RectangleF fillRect = new RectangleF(10, 230, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightBlue), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), fillRect, centered);
                g.DrawString("= Visible and enabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 285, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightBlue), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Gray), fillRect, centered);
                g.DrawString("= Visible and disabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 340, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightGray), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), fillRect, centered);
                g.DrawString("= Invisible and enabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                fillRect = new RectangleF(10, 395, 90, 40);
                g.FillRectangle(new SolidBrush(Color.LightGray), fillRect);
                fillRect.Y += 12;
                g.DrawString("Attribute", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Italic), new SolidBrush(Color.Gray), fillRect, centered);
                g.DrawString("= Invisible and disabled", new Font(FontFamily.GenericSansSerif, 10, FontStyle.Regular), new SolidBrush(Color.Black), new RectangleF(105, fillRect.Y, 200, fillRect.Height));

                g.Dispose();
                pic.Image = canvas;
                legend.Controls.Add(pic);
                legend.Width = canvas.Width;
                legend.Height = canvas.Height;
                legend.MinimumSize = legend.Size;
                legend.MaximumSize = legend.Size;
                legend.SizeGripStyle = SizeGripStyle.Hide;
                pic.PerformLayout();
                this.PerformLayout();
                legend.ShowDialog();
                legend.Dispose();
            }
            catch (Exception ex)
            {
                MessageBox.Show("Error: " + ex.Message);
            }
        }
开发者ID:japj,项目名称:bidshelper,代码行数:90,代码来源:VisualizeAttributeLatticeForm.cs


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