绘制基本形状(线/矩形/等) [英] Drawing basic shapes (line/rectangle/etc)

查看:115
本文介绍了绘制基本形状(线/矩形/等)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,
我想在运行时在窗体内绘制线条和矩形以及其他形状,例如mspaint.

无论我们在工具箱中选择了哪种形状,都应该绘制

如何为此添加工具箱.

有人可以帮我吗.

Hello Guys,
I want to draw a line and rectangle and other shapes inside the form at the runtime, like mspaint.

whatever we selected in the toolbox that shape should be drawn

how to add the toolbox for that.

can anybody help me please.

推荐答案

写道:​​

如何添加工具箱为此.



具有相当数量的代码.我过去做的方式是创建一个基本的"shape"类.然后派生不同形状的类.每个形状都知道如何绘制自己以及它的位置.表单的绘画事件,遍历了一系列形状实例,并让它们都在表单上绘制自己.



With a fair amount of code. The way I''ve done it in the past, is to create a basic ''shape'' class. Then derive classes for different shapes. Each shape knows how to draw itself, and it''s location. The paint event of the form, goes over a collection of shape instances, and lets them all draw themselves on the form.


我想您正在寻找类似这样的东西:

用鼠标绘制 [
I think you are looking for something like this :

Draw with Mouse[^]

:cool:


这篇关于绘制基本形状(线/矩形/等)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆