1

セルを配置するために、画像(ファイルのパス)と下を表示したい。

残念ながら画像は消えました。これは画像付きの GUI です。黄色のセルが画像の下になるようにします。 ここに画像の説明を入力

これは私の変更後のGUIです: ここに画像の説明を入力

hFig = figure('Name','Step 3 of 4: Choose data for each image','Menubar','none', 'Resize','off', ...
    'WindowStyle','modal', 'Position',[300 300 1150 500]);
set(gcf,'NumberTitle','off')
movegui(hFig, 'center');



%# top/bottom panels
S.fh = uipanel('Parent',hFig, 'BorderType','none', ...
    'Units','normalized', 'Position',[0 0.002 1 0.28]);

Layout = GridLayout(S.fh, ...
'NumRows', 2, ...
'NumCols', 3, ...
'HGap', 10, ...
'VGap', 5, ...
'Margin', 10, ...
'CellMargin', 10, ...
'CellColor', 'y');


for RIdx = 1:Layout.NumRows
    for CIdx = 1:Layout.NumCols

        if (RIdx == 1)
           UIArgs = {'Style','text', 'String',choice{CIdx}};
        else
           UIArgs = {'Style','edit', 'String',''};
        end

        hFig = Layout.Cell(RIdx,CIdx);
        uicontrol(hFig, UIArgs{:});
    end
end


S.pb = uicontrol('style','pushbutton',...
             'units','pix',...
            'position',[380 20 180 30],...
            'string','Submit',...
            'callback',{@pb_call});


S.pc = uicontrol('style','pushbutton',...
             'units','pix',...
            'position',[580 20 180 30],...
            'string','change the image',...
            'callback',{@pc_call});

Update(Layout);
4

1 に答える 1

1

実際に自分でプログラムする必要がない場合は、 GridLayout FEX コントリビューションがあります。

GridLayout は GridBagLayout マネージャーに触発されました。それは同様に柔軟性がありますが、私の好みではより直感的であり、必要なボイラープレート コードも少なくて済みます。

それは間違いなくあなたのプログラミング作業を容易にします..

于 2012-10-11T12:21:12.023 に答える