VB 狀態條

我做了一個程式

想把狀態條當成溫度計顯示

誰知道怎麼把狀態條變成直向的

或是怎麼設計一個狀態條

Update:

ProgressBar

Update 2:

TO:franken

你好像有文字被圖片擋住了~?

2 Answers

Rating
  • 7 years ago
    Favorite Answer

    參考我之前寫的,應該符合你的需求:

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click Dim G As Graphics = Me.GroupBox1.CreateGraphics Dim drawFont As New Font("細明體, style=Bold", 10) Dim rect As New Rectangle(10, 20, 30, 220) Dim Temp As Single G.Clear(Me.GroupBox1.BackColor) Dim A As Integer = 50 For I = 0 To 220 Step 11 If I Mod 22 = 0 Then G.DrawLine(Pens.Red, 42, 20 + I, 52, 20 + I) G.DrawString(A.ToString.PadLeft(2), drawFont, Brushes.Black, 52, 13 + I) A = A - 5 Else G.DrawLine(Pens.Black, 42, 20 + I, 47, 20 + I) End If Next I With G Application.DoEvents() .SmoothingMode = Drawing2D.SmoothingMode.HighQuality .DrawRectangle(Pens.Black, rect) .FillRectangle(Brushes.Blue, rect) Randomize() Temp = Rnd() * 50 Dim Scale As Single = Temp * 4.4 .FillRectangle(Brushes.Yellow, 10, 20, 30, 220 - Scale) End With G.Dispose() End Sub

    圖片參考:http://imgcld.yimg.com/8/n/AD01854113/o/2013013111...

    2013-01-31 11:56:27 補充:

    我是以亂數產生溫度值

    程式碼沒有斷行,自己整理一下吧。

    2013-01-31 17:17:20 補充:

    程式碼沒有被擋住喔!

    Source(s): me, me
    • Login to reply the answers
  • 阿戊
    Lv 7
    7 years ago

    用個picturebox在裏面畫實心方框,或是在其中再放另一個不同顏色的物件 用移動來做效果!

    (ps:樓主說的那個應該是 進度bar 吧...)

    • Login to reply the answers
Still have questions? Get your answers by asking now.