【问题标题】:c# how can I represent a singal I'm getting in dBm as a 5 bars display?c#如何将我得到的dBm信号表示为5条显示?
【发布时间】:2019-03-08 17:08:33
【问题描述】:

我有一个 C# windows 窗体,显示我正在从我的设备读取的信号。

数据以 dBm 为单位,可以是 -110-->-51 dBm。

如何将其显示为信号强度显示(就像我们在手机上一样) 例如:

-110-95 1

 -94-84 2

 -83-72 3

 -71-60 4

 -59-51 5 

有什么好的和简单的想法吗? 谢谢

【问题讨论】:

    标签: c# progress-bar display


    【解决方案1】:

    最简单的选择是使用 PictureBox 并为每个信号强度设置不同的图像(我很确定手机上就是这样)

        private void SetSignalStrenghtDisplay(int strenght)
        {
            if(strenght < -110)
                pictureBox1.Image = //0%image
            else if(strenght <= -95)
                pictureBox1.Image = //20%image
            // and so on...
        }
    

    如果你不想处理图片,你总是可以尝试做你自己的 UserControl,但这需要更多的工作。

    【讨论】:

    • 所以我需要创建 5 个图像?我以前从未使用过图像功能。你能告诉我怎么做吗?假设所有图像都是: image1(for 20%) 。 image2(for 40%) etc..谢谢,
    猜你喜欢
    • 1970-01-01
    • 2016-08-07
    • 2012-08-29
    • 1970-01-01
    • 2015-06-24
    • 2015-05-19
    • 1970-01-01
    • 2020-07-10
    • 1970-01-01
    相关资源
    最近更新 更多