2010-12-18 19 views

答えて

1

Backgroundimageを使用して画像を表示するだけで、フチなしのフォームを作成できます。セカンダリ画面と同じ大きさにします。このように:

public static Form ShowImage(Image image) { 
     Form frm = new Form(); 
     frm.ControlBox = false; 
     frm.FormBorderStyle = FormBorderStyle.None; 
     frm.BackgroundImage = image; 
     frm.BackgroundImageLayout = ImageLayout.Zoom; 
     Screen scr = Screen.AllScreens.Length > 1 ? Screen.AllScreens[1] : Screen.PrimaryScreen; 
     frm.Location = new Point(scr.Bounds.Left, scr.Bounds.Top); 
     frm.Size = scr.Bounds.Size; 
     frm.BackColor = Color.Black; 
     frm.Show(); 
     return frm; 
    } 

Formオブジェクトを返し、Close()メソッドを呼び出して画像をもう一度取り除くことに注意してください。

+0

実際には、画像の実際の解像度が表示されるように、800 x 600の画像を拡大縮小したり拡大したりすることなく表示する必要があります。 –

+0

BackkgroundImageLayoutを変更します。追加要件がある場合は、フォームのPaintイベントを使用します。 –

2

WinAPIからSetWindowPosを使用します。

例:

[DllImport("user32.dll")] 
public static extern void SetWindowPos(IntPtr hwnd, IntPtr hwndInsertAfter, int X, int Y, int width, int height, uint flags); 
public Form1() 
{ 
    InitializeComponent(); 
    this.FormBorderStyle = FormBorderStyle.None; 
    SetWindowPos(this.Handle, IntPtr.Zero, 0, 0, Screen.PrimaryScreen.Bounds.Width, Screen.PrimaryScreen.Bounds.Height, 64); 
}

が選びだし画面でPrimaryScreenを交換してください。

私はイメージで何ができるのか分かりません。ピクチャボックスを使用するか、オンコントロールを作成してGDIで表示するだけです。

+0

つまり、フォームに画像ボックスを追加してから、画像ボックスのサイズをフォームと同じに設定する必要があります。 –

関連する問題