![](/img/trans.png)
[英]How to display multiple images in a single picturebox in c# windows form?
[英]changing images in picturebox of windows form using c#
我正在嘗試根據某些條件更改Windows窗體的圖片框中的圖像,但有些卻不顯示任何圖片。
我在表單中放置了一個黑色的圖片框控件,並試圖使用c#這樣給出路徑...
public void ApplyImage(string strParam)
{
if (strParam == "Exit")
{
PB.Image = Daemon.Properties.Resources.Exit;
}
if (strParam == "Lock")
{
PB.Image = Daemon.Properties.Resources.Lock;
}
}
我錯過了什么嗎?
您是否在PB.Image == bits
代碼PB.Image == bits
上設置了PB.Image == bits
? 驗證他們是否真的遭到襲擊?
請記住,嚴格的字符串比較( variable == "Test"
)區分大小寫,比較字符串的更好方法是:
if ( String.Compare(variable, "Test", True) == 0 ) { ... }
代碼沒有錯。
現在,您應該檢查以下內容。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.