基于MATLAB的仿windows画图板功能的实现
2023-09-11 14:15:33 时间
1.仿真预览
% --- Executes on selection change in popupmenu2.
function popupmenu2_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu2 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu2
global rgb;
str=get(handles.popupmenu2,'string');
index=get(handles.popupmenu2,'value');
str1=char(str(index));
switch (str1)
case 'red'
rgb=[1,0,0];
case 'green'
rgb=[0,1,0];
case 'blue'
rgb=[0,0,1];
case 'black'
rgb=[0,0,0];
end
set(handles.edit1,'foregroundcolor',rgb);
set(handles.edit2,'foregroundcolor',rgb);
set(handles.text3,'foregroundcolor',rgb);
% --- Executes during object creation, after setting all properties.
function popupmenu2_CreateFcn(hObject, eventdata, handles)
% hObject handle to popupmenu2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles empty - handles not created until after all CreateFcns called
% Hint: popupmenu controls usually have a white background on Windows.
% See ISPC and COMPUTER.
if ispc && isequal(get(hObject,'BackgroundColor'), get(0,'defaultUicontrolBackgroundColor'))
set(hObject,'BackgroundColor','white');
end
% --- Executes on mouse press over axes background.
function axes1_ButtonDownFcn(hObject, eventdata, handles)
% hObject handle to axes1 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% --- Executes on button press in pushbutton2.
function pushbutton2_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton2 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% set(gcf, 'Interruptible', 'off','BusyAction', 'cancel');
% set(gcf, 'WindowButtonMotionFcn', '','Interruptible', 'off');
cla
set(handles.edit1,'string','');
set(handles.edit2,'string','');
set(handles.text3,'string','');
set(handles.pushbutton2,'enable','off');
set(handles.pushbutton3,'enable','off');
% --- Executes on button press in pushbutton3.
function pushbutton3_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
[FileName,PathName] = uiputfile({'*.jpg','JPEG(*.jpg)';...
'*.bmp','Bitmap(*.bmp)';...
'*.gif','GIF(*.gif)';...
'*.*', 'All Files (*.*)'},...
'Save Picture','Untitled');
if FileName==0
return;
else
h=getframe(handles.axes1);
imwrite(h.cdata,[PathName,FileName]);
end
% --- Executes on button press in pushbutton4.
function pushbutton4_Callback(hObject, eventdata, handles)
% hObject handle to pushbutton4 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
CleanGlobals;
close(gcf);
% --- Executes on selection change in popupmenu3.
function popupmenu3_Callback(hObject, eventdata, handles)
% hObject handle to popupmenu3 (see GCBO)
% eventdata reserved - to be defined in a future version of MATLAB
% handles structure with handles and user data (see GUIDATA)
% Hints: contents = get(hObject,'String') returns popupmenu3 contents as cell array
% contents{get(hObject,'Value')} returns selected item from popupmenu3
global graph flag h mark;
h=[];
str=get(handles.popupmenu3,'string');
index=get(handles.popupmenu3,'value');
graph=char(str(index));
popu={};
switch(graph)
case '点线'
popu={'. 点';'+ 号';'O 圈';'* 号';'v 三角号'};
set(handles.popupmenu1,'string',popu);
set(handles.popupmenu1,'value',1);
set(handles.text4,'string','选择marker')
mark='.';
otherwise
popu={'- 实线';'--虚线';': 点线';'-.虚点线';};
set(handles.popupmenu1,'string',popu);
set(handles.popupmenu1,'value',1);
set(handles.text4,'string','选择LineTyple')
mark='-';
end
C-02
相关文章
- Windows创建进程时指定父进程
- 【MATLAB教程案例94】基于Matlab的IHS图像融合算法仿真案例
- 【MATLAB教程案例86】通过matlab实现lorenz混沌系统
- 【MATLAB教程案例83】通过matlab实现数据的插值拟合
- 【MATLAB教程案例80】matlab在大学数学中的应用——高等数学
- 【MATLAB教程案例66】基于Q-learning强化学习的智能体栅格地图路线规划matlab仿真
- 【MATLAB教程案例62】使用matlab实现基于PointNet++网络的点云数据分类仿真分析
- 【MATLAB教程案例57】使用matlab实现RCNN,FastRCNN以及FasterRCNN网络目标检测功能与仿真分析
- 【MATLAB教程案例47】基于双目相机拍摄图像的三维重建matlab仿真
- 【MATLAB教程案例41】语音信号的语谱图matlab仿真与应用分析
- 【MATLAB教程案例11~20总结】优化类算法matlab仿真经验和技巧总结
- caffe windows 学习第一步:编译和安装(vs2012+win 64)
- 《数字图像处理与机器视觉——Visual C++与Matlab实现(第2版)》——第 1 章 MATLAB数字图像处理编程基础2.1 MATLAB R2011a简介
- 《数字图像处理与机器视觉——Visual C++与Matlab实现(第2版)》——2.2 MATLAB图像类型及其存储方式
- 【Matlab 六自由度机器人】定义标准型及改进型D-H参数建立机器人模型(附MATLAB建模代码)
- 【Matlab算法】L-M法求解非线性最小二乘优化问题(附L-M法MATLAB代码)
- windows下安装Appserv等php套件之后无法进入数据库管理的问题
- MatLab教程之使用Excel和MATLAB求解工程中的线性和非线性方程
- Windows 10家庭版安装Docker指南与windows10home 版开启Hyper-v
- 外媒称Windows 10是一辆“广告大巴车”
- Matlab ------ 打开MATLAB,设置默认打开的文件夹
- 【历史上的今天】1 月 14 日:IBM 计算机先驱诞生;Windows 7 寿终正寝;诺基亚收购阿尔卡特
- 关于windows 10 安装
- Windows服务一直“正在启动”怎么杀