簡體   English   中英

如何在winforms中使用c#.net將圖像顯示為全屏模式

[英]how to display the image as fullscreen mode using c#.net in winforms

我正在 Win forms 中設計一個登錄頁面,單擊登錄后屏幕進入全屏模式,但背景圖像變為屏幕的一半而不顯示為全屏。 我需要背景圖像也以全屏模式顯示。

我試過的:

FormBorderStyle = System.Windows.Forms.FormBorderStyle.None;
WindowState = FormWindowState.Maximized;

Picturebox 停靠屬性填充..

你需要改變pictureBox控件的SizeMode

    pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;

您可以在不使用pictureBox控件的情況下使用表單背景圖像

  this.BackgroundImage = Resources.bg_image ;
  this.BackgroundImageLayout = ImageLayout.Stretch;

試試這個

private void Form1_Load(object sender, EventArgs e)
    {
        Bitmap myPicture = new Bitmap("a.png");
        pictureBox1.Image = myPicture;
        pictureBox1.SizeMode = PictureBoxSizeMode.StretchImage;
    }

More information can be found in https://docs.microsoft.com/en-us/dotnet/api/system.windows.forms.picturebox.sizemode?view=net-5.0#:~:text=Using%20the%20StretchImage %20value%20cause,to%20always%20fit%20the%20image

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM