GDI繪製網格

2021-09-10 06:55:02 字數 616 閱讀 5200

//網格寬300,高600

bitmap image = new bitmap(300,600);

//建立繪圖物件graphics

graphics graphics = graphics.fromimage (image);

//清除畫布,背景顏色為紅色

graphics.clear(color.red);

//通過迴圈畫出橫線

for (int i = 0; i < 30; i++)

//通過迴圈畫出豎線

for (int i = 0; i < 20; i++)

this.backgroundimage = image;

//加邊框

graphics.drawrectangle(new pen(color.black), 0, 0, image.width - 1, image.height - 1);

//設定平鋪方式

GDI 繪製圓角矩形

繪製圓角矩形 pen p new pen c,real nsize 畫矩形上面的邊 graphics.drawline p,rc.left width 2,rc.top,rc.right width 2,rc.top 畫矩形下面的邊 graphics.drawline p,rc.left width...

GDI 測算文字繪製範圍

啥也不羅嗦,上 gdiplus solidbrush brush gdiplus color 124,25,28 gdiplus rectf bound size sz hdc hdc gs.gethdc settextcharacterextra hdc,0 settextjustificatio...

7 利用GDI 繪製文字

s 要繪製的字串。它定義字串的文字格式。它確定所繪製文字的顏色和紋理。結構,它指定所繪製文字的左上角。drawstring string s,font font,brush brush,pointf point drawstring string s,font font,brush brush,fl...