本文整理汇总了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);
}
}