c#聊天气泡功能怎么做 - 爱问答

(爱问答)

c#聊天气泡功能怎么做

就像这个

C#绘制三角形并填充,使用winform实现qq天气


首先是需求,需要制作一个聊天气泡, 但是winform中有没有类似Android的.9图,只有自己设计图形拼接气泡。第一种是绘制空心三角形,第二种是绘制三角形区域,可以指定RGB颜色。privatevoid Form1_Paint(object sender, PaintEventArgs e)        {            Pen pen = new Pen(Color.Red, 1);                        e.Graphics.DrawLine(pen, 10, 10, 50, 10);            e.Graphics.DrawLine(pen, 10, 10, 50, 50);            e.Graphics.DrawLine(pen, 50, 10, 50, 50);            Color color = System.Drawing.Color.FromArgb(((int)(((byte)(34)))), ((int)(((byte)(54)))), ((int)(((byte)(82)))));            Brush brushes = new SolidBrush(color);            Point[] point new Point[3];            point[0] = new Point(50,100);            point[1] = new Point(100,50);            point[2] = new Point(100,100);            e.Graphics.FillPolygon(brushes, point);        } 效果:可以作为气泡中的箭头,另外四个角用椭圆: Winform仿制qq微信聊天窗口气泡 绘制圆角矩形的代码://窗口圆角   privatevoid Main_Paint(object sender, PaintEventArgs e)        {            List<Point> list = new List<Point>();            int width = this.Width;            int height = this.Height;            #region 四个圆角            //左上              list.Add(new Point(0, 47));            list.Add(new Point(1, 42));            list.Add(new Point(2, 38));            list.Add(new Point(3, 36));            list.Add(new Point(4, 33));            list.Add(new Point(5, 32));            list.Add(new Point(6, 29));            list.Add(new Point(7, 27));            list.Add(new Point(8, 26));            list.Add(new Point(9, 24));            list.Add(new Point(10, 22));            list.Add(new Point(11, 21));            list.Add(new Point(12, 20));            list.Add(new Point(13, 19));            list.Add(new Point(14, 17));            list.Add(new Point(15, 16));            list.Add(new Point(16, 15));            list.Add(new Point(17, 14));            list.Add(new Point(19, 13));            list.Add(new Point(20, 12));            list.Add(new Point(21, 11));            list.Add(new Point(22, 10));            list.Add(new Point(24, 9));            list.Add(new Point(26, 8));            list.Add(new Point(27, 7));            list.Add(new Point(29, 6));            list.Add(new Point(32, 5));            list.Add(new Point(33, 4));            list.Add(new Point(36, 3));            list.Add(new Point(38, 2));            list.Add(new Point(42, 1));            list.Add(new Point(47, 0));            //右上              list.Add(new Point(width - 47, 0));            list.Add(new Point(width - 42, 1));            list.Add(new Point(width - 38, 2));            list.Add(new Point(width - 36, 3));            list.Add(new Point(width - 33, 4));            list.Add(new Point(width - 32, 5));            list.Add(new Point(width - 29, 6));            list.Add(new Point(width - 27, 7));            list.Add(new Point(width - 26, 8));            list.Add(new Point(width - 24, 9));            list.Add(new Point(width - 22, 10));            list.Add(new Point(width - 21, 11));            list.Add(new Point(width - 20, 12));            list.Add(new Point(width - 19, 13));            list.Add(new Point(width - 17, 14));            list.Add(new Point(width - 16, 15));            list.Add(new Point(width - 15, 16));            list.Add(new Point(width - 14, 17));            list.Add(new Point(width - 13, 19));            list.Add(new Point(width - 12, 20));            list.Add(new Point(width - 11, 21));            list.Add(new Point(width - 10, 22));            list.Add(new Point(width - 9, 24));            list.Add(new Point(width - 8, 26));            list.Add(new Point(width - 7, 27));            list.Add(new Point(width - 6, 29));            list.Add(new Point(width - 5, 32));            list.Add(new Point(width - 4, 33));            list.Add(new Point(width - 3, 36));            list.Add(new Point(width - 2, 38));            list.Add(new Point(width - 1, 42));            list.Add(new Point(width - 0, 47));            //右下              list.Add(new Point(width - 0, height - 47));            list.Add(new Point(width - 1, height - 42));            list.Add(new Point(width - 2, height - 38));            list.Add(new Point(width - 3, height - 36));            list.Add(new Point(width - 4, height - 33));            list.Add(new Point(width - 5, height - 32));            list.Add(new Point(width - 6, height - 29));            list.Add(new Point(width - 7, height - 27));            list.Add(new Point(width - 8, height - 26));            list.Add(new Point(width - 9, height - 24));            list.Add(new Point(width - 10, height - 22));            list.Add(new Point(width - 11, height - 21));            list.Add(new Point(width - 12, height - 20));            list.Add(new Point(width - 13, height - 19));            list.Add(new Point(width - 14, height - 17));            list.Add(new Point(width - 15, height - 16));            list.Add(new Point(width - 16, height - 15));            list.Add(new Point(width - 17, height - 14));            list.Add(new Point(width - 19, height - 13));            list.Add(new Point(width - 20, height - 12));            list.Add(new Point(width - 21, height - 11));            list.Add(new Point(width - 22, height - 10));            list.Add(new Point(width - 24, height - 9));            list.Add(new Point(width - 26, height - 8));            list.Add(new Point(width - 27, height - 7));            list.Add(new Point(width - 29, height - 6));            list.Add(new Point(width - 32, height - 5));            list.Add(new Point(width - 33, height - 4));            list.Add(new Point(width - 36, height - 3));            list.Add(new Point(width - 38, height - 2));            list.Add(new Point(width - 42, height - 1));            list.Add(new Point(width - 47, height - 0));            //左下              list.Add(new Point(47, height - 0));            list.Add(new Point(42, height - 1));            list.Add(new Point(38, height - 2));            list.Add(new Point(36, height - 3));            list.Add(new Point(33, height - 4));            list.Add(new Point(32, height - 5));            list.Add(new Point(29, height - 6));            list.Add(new Point(27, height - 7));            list.Add(new Point(26, height - 8));            list.Add(new Point(24, height - 9));            list.Add(new Point(22, height - 10));            list.Add(new Point(21, height - 11));            list.Add(new Point(20, height - 12));            list.Add(new Point(19, height - 13));            list.Add(new Point(17, height - 14));            list.Add(new Point(16, height - 15));            list.Add(new Point(15, height - 16));            list.Add(new Point(14, height - 17));            list.Add(new Point(13, height - 19));            list.Add(new Point(12, height - 20));            list.Add(new Point(11, height - 21));            list.Add(new Point(10, height - 22));            list.Add(new Point(9, height - 24));            list.Add(new Point(8, height - 26));            list.Add(new Point(7, height - 27));            list.Add(new Point(6, height - 29));            list.Add(new Point(5, height - 32));            list.Add(new Point(4, height - 33));            list.Add(new Point(3, height - 36));            list.Add(new Point(2, height - 38));            list.Add(new Point(1, height - 42));            list.Add(new Point(0, height - 47));            #endregion            Point[] points = list.ToArray();            GraphicsPath shape = new GraphicsPath();            shape.AddPolygon(points);            this.Region = new System.Drawing.Region(shape);        }


直接编码载入图片底纹,并这是大小格式与字数的函数就行

相关标签:天气

下一篇:一般的前端对JS的了解是多少?

上一篇:python这样导入库为什么不行求大神讲解下

热门标签:
excel 网盘 破解 word dll
最新更新:
微软重新评估新的Outlook的使用时机 联想推出搭载联发科Helio G80芯片组的Tab M9平板 英特尔创新大赛时间确定! 微软Edge浏览器在稳定渠道中推出Workspaces功能 英伟达RTX4060TiGPU推出MaxSun动漫主题! 谷歌地图为用户提供了街景服务! GameSir 在T4 Kaleid中推出了一款出色的控制器! 微软开始在Windows 11 中测试其画图应用程序的新深色模式! LG电子推出全球首款无线OLED电视 英伟达人工智能芯片崭露头角! Steam Deck可以玩什么游戏-Steam Deck价格限时优惠 雷蛇推出CobraPro鼠标 Kindle电子阅读器可以访问谷歌商店吗 Windows10如何加入组策略 window10图片查看器怎么没有了?