本文整理汇总了C#中PictureBox.Show方法的典型用法代码示例。如果您正苦于以下问题:C# PictureBox.Show方法的具体用法?C# PictureBox.Show怎么用?C# PictureBox.Show使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PictureBox
的用法示例。
在下文中一共展示了PictureBox.Show方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OpenScreenshot
private void OpenScreenshot(PictureBox sender)
{
try
{
Image mImage = sender.Image;
Form nForm = new Form();
nForm.StartPosition = FormStartPosition.CenterParent;
nForm.ShowInTaskbar = false;
nForm.ShowIcon = false;
nForm.MaximizeBox = false;
nForm.MinimizeBox = false;
nForm.Width = mImage.Width + 2;
nForm.Height = mImage.Height + 2;
nForm.FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
PictureBox nPB = new PictureBox();
nPB.Parent = nForm;
nPB.BorderStyle = BorderStyle.FixedSingle;
nPB.Location = new Point(0, 0);
nPB.SizeMode = PictureBoxSizeMode.AutoSize;
nPB.Anchor = AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Top;
nPB.Image = mImage;
nPB.ContextMenuStrip = this.cMenScreenshot;
nPB.Show();
nPB.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbScreenshotOpen_MouseDown);
nForm.ShowDialog();
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
(string)
("OpenScreenshot (UI.Window.ScreenshotManager) failed" +
Constants.vbNewLine + ex.Message), true);
}
}
示例2: AddScreenshot
public void AddScreenshot(Image Screenshot)
{
try
{
PictureBox nPB = new PictureBox();
nPB.MouseDown += new System.Windows.Forms.MouseEventHandler(this.pbScreenshot_MouseDown);
nPB.Parent = this.flpScreenshots;
nPB.SizeMode = PictureBoxSizeMode.StretchImage;
nPB.BorderStyle = BorderStyle.FixedSingle;
nPB.ContextMenuStrip = this.cMenScreenshot;
nPB.Image = Screenshot;
nPB.Size = new Size(100, 100);
//New Size((Screenshot.Width / 100) * 20, (Screenshot.Height / 100) * 20)
nPB.Show();
Button nBtn = new Button();
nBtn.Click += new System.EventHandler(btnCloseScreenshot_Click);
nBtn.Parent = nPB;
nBtn.FlatStyle = FlatStyle.Flat;
nBtn.Text = "×";
nBtn.Size = new Size(22, 22);
nBtn.Location = new Point(nPB.Width - nBtn.Width, -1);
nBtn.Show();
this.Show(frmMain.Default.pnlDock);
}
catch (Exception ex)
{
Runtime.MessageCollector.AddMessage(Messages.MessageClass.ErrorMsg,
(string)
("AddScreenshot (UI.Window.ScreenshotManager) failed" +
Constants.vbNewLine + ex.Message), true);
}
}