Domanda

I'm trying to set fullscreen property to my GUI like that

set(gcf, 'units','normalized','position',[0 0 1 1]);

This doesn't work for me, my window isn't centered and there is a titlebar of matlab that appear above the GUI.

I've found many topic using this, isn't a problem of version ? I'm using Matlab R2012a, Any solution for that?

Thanks !

ps: it's fullscreen but not centered

enter image description here

È stato utile?

Soluzione

Normally, a figure window can be maximized by obtaining the underlying Java Frame object and calling its setMaximized method:

jf = get(handle(gcf), 'JavaFrame');
jf.setMaximized(true)

If this doesn't work, the likely reason is that resizing is disabled for that figure window. You should be able to re-enable resizing this way:

set(gcf, 'Resize', 'on')

Of course, replace gcf with the handle of the respective figure if it is not the current figure.

Altri suggerimenti

You could try:

set(0,'units','pixels')
screensize = get(0,'screensize')

fh = figure(....)
...

set(fh, 'units','pixels','Position', screensize);      %// without menubar
%// or
set(fh, 'units','pixels','OuterPosition', screensize); %// with menubar

The default units of the 'parent' 0 is usually pixels, if you want to be sure not to mess up other functions add the following at the beginning:

defaultunits = get(0,'units')

and at the end:

set(0,'units', defaultunits)

You were nearly right:

set(gcf, 'units','normalized','OuterPosition',[0 0 1 1]);
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top