Get Monitor Dimensions

バージョン 1.0.0.1 (2.03 KB) 作成者: Mirko Hrovat
Provides the "ScreenSize" property values of the primary or secondary display(s) dynamically.
ダウンロード: 2.6K
更新 2020/4/1

ライセンスの表示

GETMONDIM (for releases 2014a or less) returns the dimensions of the specified monitor as a 4 element vector [xstart,ystart,width,height] where values are in pixels in the same manner that the 'ScreenSize' property provides. (xstart,ystart) are the absolute coordinates of the lower left corner. The "monitornumber" is a number associated with each monitor (Default=1). Monitor numbering is defined as the row number of the corresponding monitor in the root property 'MonitorPositions'.
The primary monitor is always numbered 1 and always starts at (1,1). 'MonitorPositions' returns coordinates corresponding to the upper left corner and the bottom right corner (Windows convention). Matlab 'Help' on this property is incorrect. GETMONDIM converts these coordinates to the Matlab convention where the lower left corner starts at (1,1). There is a feature with the root property 'ScreenSize'. If the primary monitor's resolution is adjusted after Matlab has started, then the size parameters of 'ScreenSize' are not adjusted while the origin is adjusted. GETMONDIM fixes this by using the 'ScreenSize' origin to correct for the discrepancy. Note that on restarting Matlab the 'ScreenSize' property changes to the correct values!

Update! MATLAB 2014b version and higher fixed some of the bugs with monitor positions. So this utility will probably only work for releases below that version. MATLAB recommends that if the display configuration changes, resolution or monitor positioning, to restart MATLAB. The little bit I played with Java within MATLAB seems to support that as the Java calls return different results before and restarting MATLAB after a configuration change while MATLAB's MonitorPositions property remains unchanged.Therefore I recommend restarting MATLAB and using the MonitorPositions property to get screensize information.

引用

Mirko Hrovat (2024). Get Monitor Dimensions (https://www.mathworks.com/matlabcentral/fileexchange/19054-get-monitor-dimensions), MATLAB Central File Exchange. 取得済み .

MATLAB リリースの互換性
作成: R2007b
R2007a 以降 R2014a 以前と互換性あり
プラットフォームの互換性
Windows macOS Linux
カテゴリ
Help Center および MATLAB AnswersData Type Identification についてさらに検索
謝辞

ヒントを得たファイル: Get screen size (dynamic), Figure Management Utilities

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
バージョン 公開済み リリース ノート
1.0.0.1

The bugs have been apparently fixed in release 2014b and above. Therefore this utility should still work for releases 2014a and below. Description has been updated.

1.0.0.0