Transparent button in Matlab GUI.
9 ビュー (過去 30 日間)
古いコメントを表示
How can I get a transparent button, i.e. a button that has the image of the image underneath. I will not manually build up my GUI - I want to just drag and drop the boxes in the GUIwindow. I have looked at example GUI_40.m in GUI example here in the file exchange that show how you can do it manually - but I don’t manage to do it in the automatic function. The code I have tried is and probable is ”F” wrong:
function ButtonValue_Callback(hObject, eventdata, handles)
% hObject handle to ButtonValue (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hint: get(hObject,'Value') returns toggle state of ButtonValue
% Makes each button's cdata equal to the image underneath.
ButtonPosition = get(hObject,'Position');
F = getframe(handles.figure1, ButtonPosition);
set(handles.ButtonValue,'cdata',F.cdata)
%endfunction
0 件のコメント
採用された回答
Sean de Wolski
2012 年 5 月 25 日
Are your units of the figure in pixels?
Also, rather than having this in the button callback, it should be in the opening function so it happens automatically.
0 件のコメント
その他の回答 (0 件)
参考
カテゴリ
Help Center および File Exchange で Migrate GUIDE Apps についてさらに検索
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!