How do I make a splash screen for my MATLAB GUI application?

5 ビュー (過去 30 日間)
MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
I would like to make a splash screen for my application, a window that pops up with a logo in it while my program is loading. I can make a figure pop up, but this has a menu and toolbar.

採用された回答

MathWorks Support Team
MathWorks Support Team 2009 年 6 月 27 日
The ability to create splash screens is not available in MATLAB.
As a workaround, the following code should produce an example figure window in the center of the screen:
% create a figure that is not visible yet, and has minimal titlebar properties
fh = figure('Visible','off','MenuBar','none','NumberTitle','off');
% put an axes in it
ah = axes('Parent',fh,'Visible','off');
% put the image in it
load earth.mat
ih = image(X,'parent',ah);
colormap(map)
% set the figure size to be just big enough for the image, and centered at
% the center of the screen
imxpos = get(ih,'XData');
imypos = get(ih,'YData');
set(ah,'Unit','Normalized','Position',[0,0,1,1]);
figpos = get(fh,'Position');
figpos(3:4) = [imxpos(2) imypos(2)];
set(fh,'Position',figpos);
movegui(fh,'center')
% make the figure visible
set(fh,'Visible','on');
ht = timer('StartDelay',5,'ExecutionMode','SingleShot');
set(ht,'TimerFcn','close(fh);stop(ht);delete(ht)');
start(ht);
Unfortunately, the blue bar at the top of the window and the standard window buttons will be present. This sample should automatically readjust for different window sizes.

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeInteractive Control and Callbacks についてさらに検索

製品

Community Treasure Hunt

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

Start Hunting!

Translated by