基礎方法:
ChangeFillShape
//修改填充形狀 ChangeFillShape(...)

// 摘要: // 修改填充形狀 // // 參數: // g: // 圖形畫板 // // Forebrush: // 填充色 // // rect: // 區域 // // en_fillshape: // 填充形狀枚舉 // // fillshpape: // 填充形狀參數 // // Backbrush: // 背景色 // // isOutside: // 是否外修改 public Graphics ChangeFillShape(Graphics g, Brush Forebrush, Rectangle rect, EN_FillShape en_fillshape, FillShape fillshpape, Brush Backbrush, bool isOutside = false);
ChangeFixedShape
//修改定位點 ChangeFixedShape(...)

// // 摘要: // 修改定位方形 // // 參數: // en_FixedShape: // 定位方形枚舉 // // g: // 圖形畫板 // // Forebrush: // 填充色 // // rect: // 區域 // // en_fillshape: // 填充形狀枚舉 // // fillshpape: // 填充形狀參數 // // Backbrush: // 背景色 // // x: // X // // y: // Y // // isOutside: // 是否外修改 public Graphics ChangeFixedShape(EN_FixedShape en_FixedShape, Graphics g, Brush Forebrush, Rectangle rect, EN_FillShape en_fillshape, FillShape fillshpape, Brush Backbrush, int x, int y, bool isOutside = false);
1、重繪定位點

if (matrix[j][i]) { ChangeFillShape(g, Forebrush, rect, EN_FillShape.FillRectangle, new FillShape(), Forebrush); //重繪定位框 ChangeFixedShape(EN_FixedShape.Fixed1, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); ChangeFixedShape(EN_FixedShape.Fixed2, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); ChangeFixedShape(EN_FixedShape.Fixed3, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); } else { ChangeFillShape(g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush); }
2、修改定位點

for (int i = 0; i < matrix.Length; i++) { for (int j = 0; j < matrix.Length; j++) { rect = new Rectangle((j + this.SpacingW) * QrCodeEncoder.QRCodeScale, (i + this.SpacingH) * QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale, QrCodeEncoder.QRCodeScale); if (matrix[j][i]) { ChangeFillShape(g, Forebrush, rect, EN_FillShape.FillRectangle, new FillShape(), Forebrush); //重繪定位框 ChangeFixedShape(EN_FixedShape.Fixed1, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); ChangeFixedShape(EN_FixedShape.Fixed2, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); ChangeFixedShape(EN_FixedShape.Fixed3, g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush, j, i); } else { ChangeFillShape(g, Backbrush, rect, EN_FillShape.FillRectangle, new FillShape(), Backbrush); } } } this.ChangeFixedShape(Backbrush, Forebrush, g, EN_FillShape.FillPeach, EN_FillShape.FillPeach, new FillShape(), new FillShape(), true); return image;
this.ChangeFixedShape(Backbrush, new SolidBrush(Color.Red), g, EN_FillShape.FillHeart, EN_FillShape.FillPeach, new FillShape(), new FillShape(), true);
this.ChangeFixedShape(Backbrush, new SolidBrush(Color.Red), g, EN_FillShape.FillPeach, EN_FillShape.FillHeart, new FillShape(), new FillShape(), true);
this.ChangeFixedShape(Backbrush, new SolidBrush(Color.Red), g, EN_FillShape.FillHeart, EN_FillShape.FillHeart, new FillShape(), new FillShape(), true);
this.ChangeFixedShape(Backbrush, new SolidBrush(Color.Blue), g, EN_FillShape.FillPolygon, EN_FillShape.FillDiamond, new FillShape() { pointed=5}, new FillShape(), true);
個性二維碼開源專題<替換定位點>,在此介紹完畢了,謝謝大家的觀看與支持。
以下是開源地址,國外github,國內oschina.net
oschina.net:
http://git.oschina.net/cheng5x/Yc.QrCode
github:
https://github.com/cheng5x/YcQrCode
碼曬客討論QQ群:
28629273