Red de conocimiento informático - Espacio del host - Quiero agregar la capacidad de dibujar círculos y rectángulos en un programa de dibujo escrito en VB. ¿Cómo lo cambio?

Quiero agregar la capacidad de dibujar círculos y rectángulos en un programa de dibujo escrito en VB. ¿Cómo lo cambio?

¿Dim?PenStyle?As?Integer

¿Dim?DW?As?Integer,?bChangeDrawWidth?As?Boolean

Dim?C(0?To? 2)?¿Como?Integer,?bChangeRGB?As?Boolean

Dim?Bn?As?Integer,?oX?As?Single,?oY?As?Single

¿Privado? Sub?Form_Load() PenStyle?=?0: ?DW?=?1 Con?Combo1

.AddItem?1: ?.AddItem?2: ?.AddItem?3: ?.AddItem?4: ?.AddItem?5 ¿Fin?Con

Fin?Sub

Privado?Sub?CmdCls_Click() Imagen1.Click() ¿Descargar?Yo

Fin?Sub

¿Privado?Sub?Combo1_Click() bChangeDrawWidth?=?True

Fin?Sub

Privado?Sub?Combo1_Change() bChangeDrawWidth?=?True p>

¿Fin?Sub

¿Privado?Sub?Combo1_KeyPress(KeyAscii?As?Integer) ¿Seleccionar?Caso?KeyAscii

Caso?8,?13

¿Caso?48?

Caso?ElseKeyAscii?=?0End?Select

Fin?Sub

Privado?Sub?Combo1 _LostFocus()If ?bChangeDrawWidth ?Entonces?bChangeDrawWidth?=?False:?DW?=?Val(Combo1.Text):?Picture1.>

Privado?Sub?OptionPenStyle_Click(Index?As?Integer) If?OptionPenStyle( Índice) .Valor?Entonces

PenStyle?=?Índice

Seleccionar?Caso?Índice Caso?0,?1,?2,?4

Imagen1 .FillStyle ?=?0 Caso?3,?5

Imagen1.FillStyle?

Fin?Sub

Privado?Sub?TxtRGB_Change(Index?As? Entero) bChangeRGB?=?True

End?Sub

Privado?Sub?TxtRGB_KeyPress(Index?As?Integer, ?KeyAscii?As?Integer) Select?Case?KeyAscii

Caso?8, 13

Caso?48?A?57

Caso?ElseKeyAscii?=?0 ¿Fin?Select

¿Fin? Sub

¿Privado?Sub?T

xtRGB_LostFocus(Index?As?Integer) If?bChangeRGB?Then

bChangeRGB?=?False :?C(Index)? =?Val(TxtRGB(Index))

Si? C(Índice)? gt;?255?Entonces?C(Índice)? =?255:?TxtRGB(Índice)? =?RGB(C(0),?C(1),?C(2)):?Imagen1.FillColor?=?Imagen1.ForeColor End?If

End?Sub

¿Privado?Sub?Picture1_DblClick() ¿Llamar?Picture1_MouseDown(Bn,?0,?oX,?oY)

Fin?Sub

¿Privado?Como?Integer,?Shift? Como?Entero,?X?Como?Único,?Y?Como?Único) Bn?=?Botón:?oX?=?X:?oY?=?Y Si?Bn?=?1?Entonces

Si?PenStyle?Then Picture1.AutoRedraw?=?True

Else Picture1.AutoRedraw?=?False

Fin?If End?If

Fin?Sub

Privado?Privado?Sub?Picture1_MouseMove(Botón?As?Integer, ?Shift?As?Integer, ?X?As?Single, ?Y?As?Single) If?Button?= ?1?Entonces

Seleccionar?Caso?PenStyleCase?0

Imagen1.Línea?(oX,?oY)-(X,?Y)

oX ?=?X:?oY?=?YCaso?1

Imagen1.Refresh

Imagen1.Línea?Línea?(oX,?oY)-(X,?Y) Caso ?2

Imagen1.Refresh

Imagen1.Line?, ?BF Caso 3

Imagen1.Refresh

Imagen1.Line?( oX,?oY)-(X,?Y),?,?B Caso 4,?5

Imagen1.Actualizar

Si?X?-?oX?lt;gt ;?0?Entonces?Imagen1.Círculo?((oX? ?X)?/?2,?(oY? ?Y)?/?2),?IIf(Abs(oX? ?X)? gt;? Abs (oY?-?Y),?Abs(oX?-?X),?Abs(oY?-?Y))?/?2,?,?,?,?Abs((Y?-?oY) ? /? (X?-(X?-?OX))

Fin Seleccionar Fin

Fin Sub

Privado?Sub?Picture1_MouseUp(El botón es un número entero , Shift es un número entero, X es un punto único, Y es un punto único) Entonces

Picture1.AutoRedraw=True

¿Llamar a Pic?

ture1_MouseMove(Bn,?0,?X,?Y)

oX?