【发布时间】:2011-06-09 09:45:29
【问题描述】:
我的想法是构建一个徽标图像(类似于 Matlab 的启动图像),它会在我的 gui 出现之前显示。我有以下代码(它是通过修改How do I make a splash screen for my MATLAB GUI application? 给出的解决方案获得的):
% create a figure1 that is not visible yet, and has minimal titlebar properties
fh = figure('Visible','off','MenuBar','none','NumberTitle','off',...
'DockControls','off');
% put an axes in it
ah = axes('Parent',fh,'Visible','on');
% put the image in it
ih = imshow('SIS.gif','Parent',ah);
% set the figure1 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 figure1 visible
set(fh,'Visible','on');
pause(3);
close(fh);
我有两个问题:
数字 1:我希望徽标图像的图形窗口没有边框、标题和任务栏。我尝试过WindowAPI,但它不起作用,因为我在上面的代码之后调用它并且由于窗口的可见性关闭了,所以它的句柄也关闭了。
编号 2:我希望,当徽标图像消失时,它会显示 gui 窗口最大化。问题出在哪里?徽标图像窗口和 gui 窗口之间的屏幕转换不平滑。我尝试使用在 Matlab Central 的文件交换中找到的许多 Matlab 应用程序(WindowAPI、Maxfig、Maximize、SetFigTransparency...),但没有成功。我意识到问题在于我的 gui 的可见性(我开始工作,直到创建所有元素,然后将其更改为 on)。由于关闭可见性导致handlevisibility也关闭,前面提到的应用程序对我想要最大化的图形窗口没有影响。
观察Matlab的启动后,我注意到标志显示后,出现一个全屏图像,然后是程序的正常全屏。因此,我尝试创建一个最大化的全屏窗口,该窗口在徽标的窗口关闭后出现。但是,现在的问题是最后一个窗口和 gui 窗口之间的转换。如果我将 gui 窗口的可见性设置为打开,然后将其最大化,那么在瞬间可以看到困扰我的过渡。我不知道该怎么办。我还认为,如果我可以在更改其可见性时避免指南窗口是 currentfigure,也许我会实现它。其他解决方案可能是一个计时器,将白色窗口保持为 currentfigure,而引导窗口落后于更改其可见性,但我不知道该怎么做。感谢您的关注。干杯。
【问题讨论】:
标签: user-interface matlab look-and-feel