English 中文(简体)
a 栏用于指示百分比,但不是一个进度栏。
原标题:a bar to indicator the percentage, but not a progress bar

我需要一个显示一定百分比的东西的栏, 比如电池引擎或硬盘的用空间大小 。 例如“ img src=” https:// i. stack.imgur.com/V3GDr. png” alt= “ 输入图像描述在这里” / >

这不是一个进度栏。 当我使用进度栏时, 每次我发送消息 < code> PBM_ SETPOS < /code> 时, 它会从 0 增加到 pos 。

栏必须能够让我手动设定值, 之后, 它会直接将颜色区域改变为指定的长度, 而不是增加 。

WINAPI是否为此目的建立了功能性结构?

问题回答

使用面板然后在面板中设置标签... 然后根据百分比用背色设置标签宽度...

守则如下:

string s27 = "select percentage from CandidateReg3 where candidateid= " + candidateid + " ";
DataTable d17 = cn.viewdatatable(s27);
if (d17.Rows.Count > 0) {
   for (int m = 0; m < d17.Rows.Count; m++) {
        percreg3 = int.Parse(d17.Rows[m]["percentage"].ToString());
        percregtotal = percreg3 + percreg;
   }
} else {
   percregtotal = percreg;
}

decimal percregtotals = (decimal)percregtotal / 100;
double percent = Convert.ToDouble(percregtotals);

// double percent = 1;
IndicatorLabel.Width = new Unit(percent * IndicatorPanel.Width.Value, UnitType.Pixel);

IndicatorLabel.ToolTip = percent.ToString("p0");
IndicatorLabel.Text = percent.ToString("p0"); 
IndicatorLabel.ForeColor=Color.White;

// IndicatorLabel.Text = "";
IndicatorLabel.BackColor = Color.Green;




相关问题
How to read exact number of bytes from a stream (tcp) socket?

In winsock, both the sync recv and the async WSARecv complete as soon as there is data available in a stream socket, regardless of the size specified (which is only the upper limit). This means that ...

AcquireCredentialsHandle returns SEC_E_NO_CREDENTIALS

I created a self-signed certificate (created using OpenSSL) and installed it into the Certificate Store using the Certificates MMC snap-in (CertMgr.msc) on Windows Vista Ultimate. I have managed to ...

Calling Win32 EnumThreadWindows() in C#

I m trying to get a call to EnumThreadWindows working, but I always get a Wrong Parameter-Error, although my code is nearly the same as this example on pinvoke.net. I don t know why this doesn t work: ...

COM Basic links

folks can you provide me the tutorial link or .pdf for learning basic COM?. i do google it.. still i recommend answers of stackoverflow so please pass me.. Thanks

Handling multiple windows WIN32 API

HI I m trying to create an application in the Win32 environment containing more than one window. How do i do that? all the Win32 Tutorials on web i found only showed how to manage one window. How do i ...

Creating a thread in DllMain?

It seems that when a thread is created from within DllMain upon DLL_PROCESS_ATTACH it won t begin until all dll s have been loaded. Since I need to make sure the thread runs before I continue, I get a ...

热门标签