如何在Windows窗体中创建图例? [英] How to create a legend in windows form?

查看:65
本文介绍了如何在Windows窗体中创建图例?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想创建一个传奇,显示颜色指示器,如II级为红色,III级为绿色,IV级为蓝色。如何创建?

I want to create a legend that show color indicator like red color for grade II, green for grade III and blue for grade IV. How to create that?

推荐答案

最简单的方法之一是放置一些 Panel controls,指定背景颜色。它也可以通过编程方式完成:

One of the simplest way is to place some Panel controls, the specify the background colour. It can be done programmatically too:

<跨度>&NBSP;&NBSP;&NBSP;
panel1.BackColor = Color 。红色;

    panel1.BackColor = Color.Red;

也可以使用  图片控件和一些预先制作的图像,看起来更像是一个矩形。

It is also possible to use Picture controls with some pre-made images, looking better that just a rectangle.

但如果您指的是其他地方(如网格等),请提供详细信息。


这篇关于如何在Windows窗体中创建图例?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆