国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > .NET > 正文

VB.NET中使用GDI畫圖具體應用。

2024-07-10 13:03:40
字體:
來源:轉載
供稿:網友

下面的例子通過重載form1窗體的onpaint()方法繪制gdi圖形
protected overrides sub onpaint(byval e as system.windows.forms.painteventargs)
        '/////////////繪制任意直線
        dim g as graphics = e.graphics
        dim mypen as pen = new pen(color.red, 2)
        g.drawline(mypen, 100, 100, 10, 10)
        '/////////////繪制矩形(任意直線構成的封閉圖形)
        dim point1 as pointf = new pointf(100f, 100f)
        dim point2 as pointf = new pointf(200f, 100f)
        dim point3 as pointf = new pointf(200f, 200f)
        dim point4 as pointf = new pointf(100f, 200f)
        dim curvepoints as pointf() = {point1, point2, point3, point4}
        g.drawpolygon(new pen(color.blue, 2), curvepoints)
        '////////////文本表示
        dim ffamily as fontfamily = new fontfamily("arial")
        dim font as font = new font(ffamily, "20", fontstyle.bold, fontstyle.italic, graphicsunit.pixel)
        dim text as string = "i love you!"
        dim solidbrush as solidbrush = new solidbrush(color.red)
        dim pr as pointf = new pointf(100, 10)
        e.graphics.drawstring(text, font, solidbrush, pr)
        '////////////平面繪制
        dim rec as rectanglef = new rectanglef(10, 10, 200, 100)
        g.drawpie(mypen, rec, 150, 150)
        '///////////封閉圖形,0.7應該是個圓
        g.drawclosedcurve(mypen, curvepoints, 0.7, drawing.drawing2d.fillmode.alternate)
        '///////////大家自己試試看吧
        g.drawarc(mypen, 300, 300, 200, 200, 100, 100)
        g.drawcurve(mypen, curvepoints)
        g.drawbezier(mypen, 50, 50, 100, 50, 100, 100, 50, 100)
        g.drawbeziers(mypen, curvepoints)
        '//////////這可是一個圓
        dim rec1 as rectanglef = new rectanglef(10, 10, 100, 100)
        g.drawellipse(mypen, rec1)
        '//////////這是一個橢圓
        dim rec2 as rectanglef = new rectanglef(10, 10, 200, 100)
        g.drawellipse(mypen, rec2)

    end sub

這些是我自己試驗出來的,當然了,還有好多,我只是開了一個頭,大家要是發現什么好東東,別忘了通知一下:)
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 黑龙江省| 志丹县| 罗源县| 双流县| 滦平县| 贵南县| 马山县| 河北省| 汝城县| 三原县| 新宾| 高碑店市| 庆云县| 黄浦区| 北票市| 桃园市| 新源县| 西宁市| 资兴市| 丘北县| 吉安县| 富蕴县| 海淀区| 庄浪县| 沙河市| 肥西县| 娄底市| 营山县| 乌什县| 衡水市| 桦甸市| 驻马店市| 嘉祥县| 城固县| 嘉鱼县| 永嘉县| 越西县| 彰化县| 皮山县| 澄江县| 壶关县|