取得螢幕目前的解析度,可以透過 Screen.PrimaryScreen Property 來達成
有興趣的可以參考MSDN的說明
http://msdn.microsoft.com/en-us/library/system.windows.forms.screen.primaryscreen.aspx
以下為範例程式碼
private
void button1_Click(object sender, EventArgs e)
{
int screenWidth = Screen.PrimaryScreen.Bounds.Width;
int screenHeight = Screen.PrimaryScreen.Bounds.Height;
MessageBox.Show("螢幕解析度為 " + screenWidth.ToString() + "*" + screenHeight.ToString());
}
全站熱搜
留言列表