您现在的位置:首页 >> 图像处理 >> 内容

使用matlab实现类似windows系统中的画图小软件,带GUI界面

时间:2022/12/25 18:48:49 点击:

  核心提示:A147包括程序操作录像...

1.完整项目描述和程序获取

>面包多安全交易平台:https://mbd.pub/o/bread/Y5qbmZxq

>如果链接失效,可以直接打开本站店铺搜索相关店铺:

点击店铺

>如果链接失效,程序调试报错或者项目合作可以加微信或者QQ联系。

2.部分仿真图预览


3.算法概述

使用matlab实现类似windows系统中的画图小软件,带GUI界面

4.部分源码

................................................................

% --- Executes on mouse motion over figure - except title and menu.

function figure1_WindowButtonMotionFcn(hObject, eventdata, handles)

% hObject    handle to figure1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

global flg mark rgb x0 y0 x y rect graph h;

if flg

    switch(graph)

        case '点线'

            currPt=get(gca, 'CurrentPoint');

            x=currPt(1,1);

            y=currPt(1,2);

            line(x,y, 'marker', mark,'color',rgb);

        case '线形'

            x0=x;y0=y;

            currPt=get(gca, 'CurrentPoint');

            x=currPt(1,1);

            y=currPt(1,2);

            line([x0 x], [y0,y],'LineStyle',mark,'color',rgb);

        case '矩形'

            currPt=get(gca, 'CurrentPoint');

            x=currPt(1,1);

            y=currPt(1,2);

            if x~=x0

                if ~isempty(h)

                    set(h,'Visible','off')

                end

                rect=[min([x0,x]),min([y0,y]),abs(x-x0),abs(y-y0)];

                if rect(3)*rect(4)~=0

                    h=rectangle('Position',rect,'LineStyle',':');

                end

            end

        case '椭圆'

            currPt=get(gca, 'CurrentPoint');

            x=currPt(1,1);

            y=currPt(1,2);

            if x~=x0

                if ~isempty(h)

                    set(h,'Visible','off')

                end

                rect=[min([x0,x]),min([y0,y]),abs(x-x0),abs(y-y0)];

                if rect(3)*rect(4)~=0

                    h=rectangle('Position',rect,'Curvature',[1,1],'LineStyle',':');

                end

            end

    end

    set(handles.edit1,'string',num2str(x));

    set(handles.edit2,'string',num2str(y));

    set(handles.text3,'string','Mouse is moving!');

end

 

function figure1_WindowButtonUpFcn(hObject, eventdata, handles)

% hObject    handle to figure1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

global flg rgb mark h graph rect;

flg=0;

switch(graph)

    case '矩形'

        set(h,'Visible','off');h=[];

        if rect(3)*rect(4)~=0

            rectangle('Position',rect,'edgecolor',rgb,'LineStyle',mark)

        end

    case '椭圆'

        set(h,'Visible','off');h=[];

        if rect(3)*rect(4)~=0

            rectangle('Position',rect,'Curvature',[1,1],'edgecolor',rgb,'LineStyle',mark)

        end

end

set(handles.text3,'string','Mouse up!');

function edit1_Callback(hObject, eventdata, handles)

% hObject    handle to edit1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    structure with handles and user data (see GUIDATA)

 

% Hints: get(hObject,'String') returns contents of edit1 as text

%        str2double(get(hObject,'String')) returns contents of edit1 as a double

 

 

% --- Executes during object creation, after setting all properties.

function edit1_CreateFcn(hObject, eventdata, handles)

% hObject    handle to edit1 (see GCBO)

% eventdata  reserved - to be defined in a future version of MATLAB

% handles    empty - handles not created until after all CreateFcns called

 

% Hint: edit 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

A147 

.....................................

作者:我爱C编程 来源:我爱C编程
本站最新成功开发工程项目案例
相关文章
  • 没有相关文章
相关评论
发表我的评论
  • 大名:
  • 内容:
本类固顶
  • 没有
  • FPGA/MATLAB商业/科研类项目合作(www.store718.com) © 2025 版权所有 All Rights Reserved.
  • Email:1480526168@qq.com 站长QQ: 1480526168