国产探花免费观看_亚洲丰满少妇自慰呻吟_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

這些是我自己試驗出來的,當然了,還有好多,我只是開了一個頭,大家要是發現什么好東東,別忘了通知一下:)
發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 永川市| 南平市| 聂拉木县| 海口市| 岫岩| 天柱县| 大埔县| 安泽县| 金华市| 万盛区| 钟祥市| 错那县| 哈巴河县| 庆元县| 房山区| 石首市| 海门市| 泸定县| 昭觉县| 界首市| 盐山县| 吉隆县| 方正县| 阿瓦提县| 青阳县| 平罗县| 和平区| 双鸭山市| 镇宁| 达尔| 台东县| 浮山县| 呼图壁县| 兴和县| 长子县| 宁河县| 澳门| 叙永县| 广德县| 巴中市| 象州县|