个性二维码开源专题<替换定位点>

基础方法:

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);
View Code
复制代码

 

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);
View Code
复制代码

 

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);
                    }
View Code
复制代码

 

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;
View Code
复制代码

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

 

官方网站:
http://original-ad.com

码晒客讨论QQ群:
28629273

posted @   五加乘  阅读(2865)  评论(3编辑  收藏  举报
编辑推荐:
· Linux系列:如何用 C#调用 C方法造成内存泄露
· AI与.NET技术实操系列(二):开始使用ML.NET
· 记一次.NET内存居高不下排查解决与启示
· 探究高空视频全景AR技术的实现原理
· 理解Rust引用及其生命周期标识(上)
阅读排行:
· 阿里最新开源QwQ-32B,效果媲美deepseek-r1满血版,部署成本又又又降低了!
· 单线程的Redis速度为什么快?
· SQL Server 2025 AI相关能力初探
· 展开说说关于C#中ORM框架的用法!
· AI编程工具终极对决:字节Trae VS Cursor,谁才是开发者新宠?
点击右上角即可分享
微信分享提示