真实的国产乱ⅩXXX66竹夫人,五月香六月婷婷激情综合,亚洲日本VA一区二区三区,亚洲精品一区二区三区麻豆

成都創(chuàng)新互聯(lián)網(wǎng)站制作重慶分公司

vb.net讓鼠標(biāo)畫(huà)圓,用vb畫(huà)圓

怎樣用VB實(shí)現(xiàn):用鼠標(biāo)拖動(dòng)繪制實(shí)圓與多種虛線圓

Dim

創(chuàng)新互聯(lián)專注于企業(yè)成都全網(wǎng)營(yíng)銷推廣、網(wǎng)站重做改版、福安網(wǎng)站定制設(shè)計(jì)、自適應(yīng)品牌網(wǎng)站建設(shè)、H5網(wǎng)站設(shè)計(jì)、商城網(wǎng)站制作、集團(tuán)公司官網(wǎng)建設(shè)、成都外貿(mào)網(wǎng)站建設(shè)、高端網(wǎng)站制作、響應(yīng)式網(wǎng)頁(yè)設(shè)計(jì)等建站業(yè)務(wù),價(jià)格優(yōu)惠性價(jià)比高,為福安等各大城市提供網(wǎng)站開(kāi)發(fā)制作服務(wù)。

s

As

Boolean,

ci

As

Integer,

xianxing

As

Integer,

xiankuan

As

Integer

Dim

x0

As

Single,

y0

As

Single

Private

Sub

Command1_Click()

s

=

True

Command1.Enabled

=

False

End

Sub

Private

Sub

Form_Load()

Dim

b

b

=

Array("透明",

"實(shí)線",

"虛線",

"點(diǎn)線",

"點(diǎn)劃線",

"雙點(diǎn)劃線")

Frame1.Move

100,

100,

1300,

3500

Frame1.Caption

=

"線型"

Frame2.Move

Width

-

1500,

100,

1300,

3500

Frame2.Caption

=

"線寬"

For

i

=

To

5

Option1(i).Move

100,

300

+

i

*

500,

1100,

300

Option1(i).Caption

=

b(i)

Option2(i).Move

100,

500

+

i

*

500,

800,

300

Option2(i).Caption

=

i

+

1

"點(diǎn)寬"

Next

i

Shape1(0).Visible

=

False

Shape1(1).Visible

=

False

s

=

ci

=

-1

Command1.Caption

=

"開(kāi)始畫(huà)圓"

Command1.ToolTipText

=

"點(diǎn)擊按鈕后在窗體內(nèi)按下鼠標(biāo)左鍵處為圓心,拖到半徑處松開(kāi)鼠標(biāo)左鍵即可"

End

Sub

Private

Sub

Form_MouseDown(Button

As

Integer,

Shift

As

Integer,

X

As

Single,

Y

As

Single)

If

s

And

Button

=

1

Then

x0

=

X

y0

=

Y

ci

=

ci

+

1

If

ci

1

Then

Load

Shape1(ci)

Shape1(ci).Visible

=

True

Shape1(ci).BorderStyle

=

xianxing

Shape1(ci).Move

x0,

y0,

0,

Shape1(ci).Shape

=

3

Shape1(ci).BorderWidth

=

xiankuan

End

If

End

Sub

Private

Sub

Form_MouseMove(Button

As

Integer,

Shift

As

Integer,

X

As

Single,

Y

As

Single)

If

s

And

Button

=

1

Then

banjing

=

Sqr((x0

-

X)

*

(x0

-

X)

+

(y0

-

Y)

*

(y0

-

Y))

Shape1(ci).Move

x0

-

banjing,

y0

-

banjing,

2

*

banjing,

2

*

banjing

End

If

End

Sub

Private

Sub

Form_MouseUp(Button

As

Integer,

Shift

As

Integer,

X

As

Single,

Y

As

Single)

Command1.Enabled

=

True

s

=

False

End

Sub

Private

Sub

Option1_Click(Index

As

Integer)

For

i

=

To

5

If

Option1(i)

Then

xianxing

=

i

Next

i

If

i

=

1

Then

Frame2.Enabled

=

True

Else

Frame2.Enabled

=

False

xiankuan

=

1

End

If

End

Sub

Private

Sub

Option2_Click(Index

As

Integer)

For

i

=

To

5

If

Option2(i)

Then

xiankuan

=

1

+

i

Next

i

End

Sub

界面稍微復(fù)雜了點(diǎn):

一個(gè)按鈕,兩個(gè)框架,第一框架上option1共六個(gè),第二個(gè)框架上option2也是六個(gè)。

VB編程 鼠標(biāo)畫(huà)圓

創(chuàng)建一個(gè)工程,界面上放一個(gè)PictureBox控件,控件名字叫Picture1,然后把下面的代碼復(fù)制到工程中,運(yùn)行查看效果。

Option?Explicit

Private?Type?POINTAPI

x?As?Long

y?As?Long

End?Type

Private?Declare?Function?Ellipse?Lib?"gdi32"?(ByVal?hdc?As?Long,?ByVal?X1?As?Long,?ByVal?Y1?As?Long,?ByVal?X2?As?Long,?ByVal?Y2?As?Long)?As?Long

Private?DrawEllipse?As?Boolean

Private?dwPoint(1)?As?POINTAPI

Private?Sub?Form_Load()

Picture1.ScaleMode?=?vbPixels

Picture1.AutoRedraw?=?True

End?Sub

Private?Sub?Picture1_MouseDown(Button?As?Integer,?Shift?As?Integer,?x?As?Single,?y?As?Single)

If?Button?=?vbLeftButton?Then

DrawEllipse?=?True

dwPoint(0).x?=?CLng(x)

dwPoint(0).y?=?CLng(y)

End?If

End?Sub

Private?Sub?Picture1_MouseMove(Button?As?Integer,?Shift?As?Integer,?x?As?Single,?y?As?Single)

If?DrawEllipse?=?True?Then

dwPoint(1).x?=?CLng(x)

dwPoint(1).y?=?CLng(y)

Picture1.Cls

Ellipse?Picture1.hdc,?dwPoint(0).x,?dwPoint(0).y,?dwPoint(1).x,?dwPoint(1).y

Picture1.Refresh

End?If

End?Sub

Private?Sub?Picture1_MouseUp(Button?As?Integer,?Shift?As?Integer,?x?As?Single,?y?As?Single)

If?Button?=?vbLeftButton?Then

DrawEllipse?=?False

End?If

End?Sub

如何用VB.NET畫(huà)同心圓

窗體上添加一個(gè)按鈕,在該按鈕的單擊事件里編寫(xiě)代碼如下:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click

'聲明窗體的Me.CreateGraphics對(duì)象

Dim MyGraphics As Graphics = Me.CreateGraphics

Dim Cx As Integer = 150 '圓心的X坐標(biāo)

Dim Cy As Integer = 150 '圓心的Y坐標(biāo)

Dim R As Integer '圓的半徑

'繪制半徑為R的圓

For R = 5 To 100 Step 5

MyGraphics.DrawEllipse(Pens.Black, New Rectangle(Cx - R, Cy - R, 2 * R, 2 * R))

Next

End Sub

‘用黑色畫(huà)筆繪制一組同心圓,半徑從5開(kāi)始,增量為5。

說(shuō)明:

DrawEllipse是VB.Net的Graphics類的繪制橢圓的方法;他有幾種格式,上面使用的是一種;

DrawEllipse(畫(huà)筆的顏色,繪制橢圓所需要的矩形區(qū)域)

其中:繪制橢圓所需要的矩形區(qū)域,如果被定義為正方形,就演變成繪制圓,定義該區(qū)域由死個(gè)數(shù)值確定,第1個(gè)數(shù)值,確定該區(qū)域左上角的X坐標(biāo),第2個(gè)數(shù)值,確定該區(qū)域左上角的Y坐標(biāo),第3個(gè)數(shù)值,確定該區(qū)域的寬度,第4個(gè)數(shù)值,確定該區(qū)域的高度。

例如1:

DrawEllipse(Pens.Black, New Rectangle(150, 150, 50, 50))

就是以圓心坐標(biāo)為(100,100),繪制半徑為50 的圓。其實(shí)在VB.NET中,是告訴系統(tǒng)在以左上角坐標(biāo)(150,150),邊長(zhǎng)為50的正方形里繪制內(nèi)切圓。理解了是在正方形里繪制內(nèi)切圓,就可以通過(guò)數(shù)學(xué)計(jì)算,知道如何繪制了。

同理例如2:

DrawEllipse(Pens.Black, New Rectangle(150, 150, 100, 50))

就是以圓心坐標(biāo)為(100,100),繪制半徑為50 的圓。其實(shí)在VB.NET中,是告訴系統(tǒng)在以左上角坐標(biāo)(150,150),長(zhǎng)軸為100,短軸為50的內(nèi)切橢圓。

VB.NET中怎樣畫(huà)圓弧

用Circle 畫(huà)圓 圓弧 橢圓 都 具體參照面詳細(xì)說(shuō)明 Circle(一000,一000),500,吧,-陸,-三 一000,一000,圓坐標(biāo) 500,半徑 面別代表起始角,終止角,短軸比率 吧,詳細(xì)點(diǎn),Circle都說(shuō)遍 象畫(huà)圓、橢圓或弧 語(yǔ) object.Circle [Step] (x, y), radius, [color, start, end, aspect] Circle 語(yǔ)象限定符部: 部 描述 object 選 象表達(dá)式其值應(yīng)用于列表象object 省略具焦點(diǎn)窗體作object Step 選關(guān)鍵字 指定圓、橢圓或弧相于前 object CurrentX CurrentY 屬性提供坐標(biāo) (x, y) 必需 Single (單精度浮點(diǎn)數(shù))圓、橢圓或弧坐標(biāo)object ScaleMode 屬性決定使用度量單位 radius 必需Single (單精度浮點(diǎn)數(shù))圓、橢圓或弧半徑 object ScaleMode 屬性決定使用度量單位 color 選Long (整型數(shù))圓輪廓 RGB 顏色省略則使用 ForeColor 屬性值用 RGB 函數(shù)或 QBColor 函數(shù)指定顏色 start, end 選 Single (單精度浮點(diǎn)數(shù))弧、或部圓或橢圓畫(huà)完start end 指定(弧度單位)弧起點(diǎn)終點(diǎn)位置其范圍 -二 pi 二 pi 起點(diǎn)缺省值0; 終點(diǎn)缺省值二 * pi aspect 選 Single (單精度浮點(diǎn)數(shù))圓縱橫尺寸比缺省值 一.0何屏幕都產(chǎn)標(biāo)準(zhǔn)圓(非橢圓) 說(shuō)明 想要填充圓使用圓或橢圓所屬象 FillColor FillStyle 屬性封閉圖形才能填充封閉圖形包括圓、橢圓、或扇形 畫(huà)部圓或橢圓 start 負(fù)Circle 畫(huà)半徑 start并角度處理; end 負(fù)Circle 畫(huà)半徑 end并角度處理Circle 總逆針()向繪圖 畫(huà)圓、橢圓或弧線段粗細(xì)取決于 DrawWidth 屬性值背景畫(huà)圓取決于 DrawMode DrawStyle 屬性值 畫(huà)角度 0 扇形要畫(huà)條半徑(向右畫(huà)水平線段)給 start 規(guī)定負(fù)值要給 0 .省略語(yǔ)間某參數(shù)能省略隔參數(shù)逗號(hào)您指定參數(shù)面逗號(hào)省略 Circle 執(zhí)行CurrentX CurrentY 屬性參數(shù)設(shè)置點(diǎn) 能用 With匛nd With 語(yǔ)句塊 -------------------------------------------------------------------------------- Circle 示例 示例用Circle 窗體央畫(huà)許同圓要運(yùn)行示例代碼放入窗體 General 部按 F5 并單擊窗體 Sub Form_Click () Dim CX, CY, Radius, Limit ' Declare variable. ScaleMode = 三 ' 像素單位 CX = ScaleWidth / 二 ' X 位置 CY = ScaleHeight / 二 ' Y 位置 If CX CY Then Limit = CY Else Limit = CX For Radius = 0 To Limit ' 半徑 Circle (CX, CY), Radius,RGB(Rnd * 二55, Rnd * 二55, Rnd * 二55) Next Radius End Sub -------------------------------------------------------------------------------


新聞名稱:vb.net讓鼠標(biāo)畫(huà)圓,用vb畫(huà)圓
網(wǎng)頁(yè)鏈接:http://weahome.cn/article/dssspei.html

其他資訊

在線咨詢

微信咨詢

電話咨詢

028-86922220(工作日)

18980820575(7×24)

提交需求

返回頂部