成人午夜视频全免费观看高清-秋霞福利视频一区二区三区-国产精品久久久久电影小说-亚洲不卡区三一区三区一区

vb.net繪制矩形 vb怎么設(shè)置圓角矩形

VB.NET我要用鼠標(biāo)軌跡畫一個矩形框 然后選中控件。就像星際和魔獸爭霸里對部隊單位的選中一樣~等大神回答

這個類繼承自Panel,把它加到你的項目里面,先運行一下,然后從工具箱里把它拖到窗體上,然后再向里面添加其它控件就可以了,支持Shift加選,Alt減選

十余年的類烏齊網(wǎng)站建設(shè)經(jīng)驗,針對設(shè)計、前端、開發(fā)、售后、文案、推廣等六對一服務(wù),響應(yīng)快,48小時及時工作處理。營銷型網(wǎng)站的優(yōu)勢是能夠根據(jù)用戶設(shè)備顯示端的尺寸不同,自動調(diào)整類烏齊建站的顯示方式,使網(wǎng)站能夠適用不同顯示終端,在瀏覽器中調(diào)整網(wǎng)站的寬度,無論在任何一種瀏覽器上瀏覽網(wǎng)站,都能展現(xiàn)優(yōu)雅布局與設(shè)計,從而大程度地提升瀏覽體驗。創(chuàng)新互聯(lián)從事“類烏齊網(wǎng)站設(shè)計”,“類烏齊網(wǎng)站推廣”以來,每個客戶項目都認真落實執(zhí)行。

Imports?System.Linq

Imports?System.Collections

Public?Class?MyPanel

Inherits?Panel

'?選擇模式,相交還是包含

Enum?SelectMode

Intersects

Contains

End?Enum

Dim?down?As?New?Point(-1,?-1)

Dim?rect?As?Rectangle

Dim?selected?As?New?List(Of?Control)

Dim?editting?As?IEnumerable(Of?Control)

Dim?mode?As?SelectMode?=?SelectMode.Contains

Dim?shift,?alt?As?Boolean

Public?Sub?New()

Me.DoubleBuffered?=?True

End?Sub

Protected?Overrides?Sub?OnMouseDown(e?As?MouseEventArgs)

MyBase.OnMouseDown(e)

down?=?e.Location

editting?=?selected.ToArray().ToList()

OnMouseMove(e)

End?Sub

Protected?Overrides?Sub?OnMouseMove(e?As?MouseEventArgs)

MyBase.OnMouseMove(e)

If?e.Button?=?Windows.Forms.MouseButtons.Left?Then

Dim?loc?As?New?Point(Math.Min(down.X,?e.X),?Math.Min(down.Y,?e.Y))

Dim?size?As?New?Size(Math.Abs(down.X?-?e.X),?Math.Abs(down.Y?-?e.Y))

rect?=?New?Rectangle(loc,?size)

Dim?cs?As?New?List(Of?Control)

For?Each?c?In?Controls

cs.Add(c)

Next

Dim?a?=?cs.Where(Function(n?As?Control)?(mode?=?SelectMode.Contains?And?rect.Contains(n.Bounds))?Or?(mode?=?SelectMode.Intersects?And?rect.IntersectsWith(n.Bounds)))

If?shift?Then?editting?=?a.Union(selected)?Else?If?alt?Then?editting?=?selected.Except(a)?Else?editting?=?a

Invalidate()

End?If

End?Sub

Protected?Overrides?Sub?OnMouseUp(e?As?MouseEventArgs)

MyBase.OnMouseUp(e)

down?=?New?Point(-1,?-1)

selected?=?editting.ToList()

editting?=?Nothing

Invalidate()

End?Sub

Protected?Overrides?Function?ProcessKeyPreview(ByRef?m?As?Message)?As?Boolean

Dim?KeyCode?As?Keys?=?CInt(m.WParam)?And?CInt(Keys.KeyCode)

Dim?d?As?Boolean

If?m.Msg?=?H100?Or?m.Msg?=?H104?Then?d?=?True?Else?If?m.Msg?=?H101?Or?m.Msg?=?H105?Then?d?=?False?Else?Return?MyBase.ProcessKeyPreview(m)

If?KeyCode?=?Keys.ShiftKey?Then

shift?=?d

ElseIf?KeyCode?=?Keys.Menu?Then

alt?=?d

End?If

Return?MyBase.ProcessKeyPreview(m)

End?Function

Protected?Overrides?Sub?OnPaint(e?As?PaintEventArgs)

MyBase.OnPaint(e)

For?Each?c?As?Control?In?IIf(editting?Is?Nothing,?selected,?editting)

e.Graphics.DrawRectangle(New?Pen(Color.Gray)?With?{.DashStyle?=?Drawing2D.DashStyle.DashDot},?c.Left?-?1,?c.Top?-?1,?c.Width?+?1,?c.Height?+?1)

Next

If?(down.X??0)?Then?e.Graphics.DrawRectangle(New?Pen(Color.Gray)?With?{.DashStyle?=?Drawing2D.DashStyle.DashDot},?rect)

End?Sub

End?Class

vb.net畫一個矩形圖片的代碼

g?=?Me.picDisplay.CreateGraphics

Dim?mybrush?As?Brush?=?New?SolidBrush(Map_Empty_Color)

Dim?rect2?As?System.Drawing.Rectangle?=?New?System.Drawing.Rectangle(0,?0,?Map_Width,?Map_Height)

g.FillRectangle(mybrush,?rect2)

在vb.net中,矩形只能從左向右畫么

對于VB來說,其實是無所謂左右的。它只是把參數(shù)傳遞給底層的繪圖接口而已。

對于底層接口來說,繪制矩形是可以有方向的。可以把四個參數(shù)對調(diào)就反過來了。

vb.net畫填充的方形矩形

Dim canvas As New ShapeContainer

' To draw anoval, substitute

' OvalShapefor RectangleShape.

DimtheShape As NewRectangleShape

' Set theform as the parent of the ShapeContainer.

canvas.Parent = Me

' Set theShapeContainer as the parent of the Shape.

theShape.Parent = canvas

' Set thesize of the shape.

theShape.Size = New System.Drawing.Size(200,300)

' Set thelocation of the shape.

theShape.Location = New System.Drawing.Point(100,100)

' To draw arounded rectangle, add the following code:

theShape.CornerRadius = 12

theShape.FillStyle = FillStyle.Solid

theShape.FillColor = Color.Red

當(dāng)前標(biāo)題:vb.net繪制矩形 vb怎么設(shè)置圓角矩形
網(wǎng)頁路徑:http://jinyejixie.com/article16/dopshgg.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供電子商務(wù)、用戶體驗、響應(yīng)式網(wǎng)站、網(wǎng)頁設(shè)計公司移動網(wǎng)站建設(shè)、微信公眾號

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請盡快告知,我們將會在第一時間刪除。文章觀點不代表本網(wǎng)站立場,如需處理請聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時需注明來源: 創(chuàng)新互聯(lián)

營銷型網(wǎng)站建設(shè)
巨鹿县| 乌海市| 无锡市| 怀集县| 文化| 会东县| 泊头市| 九寨沟县| 饶河县| 宁强县| 屏东县| 龙川县| 三原县| 巩留县| 安泽县| 科技| 英山县| 屏山县| 京山县| 原阳县| 衡山县| 宁化县| 东至县| 出国| 新兴县| 肥东县| 桃园市| 苍梧县| 怀柔区| 揭东县| 深水埗区| 堆龙德庆县| 浪卡子县| 上思县| 安远县| 晋城| 桓台县| 高台县| 龙泉市| 南宁市| 习水县|