Ho cercato su google, ma non ho trovato niente di interessante, ne non la dichiarazione della funzione BitBlt. Ma come si usa? Potresti farmi un esempietto sapendo che Bar è la PictureBox e io disegno tutto nell'evento paint?
Public Declare Function BitBlt Lib "gdi32" Alias "BitBlt" (ByVal hDestDC As Integer, ByVal x As Integer, ByVal y As Integer, ByVal nWidth As Integer, ByVal nHeight As Integer, ByVal hSrcDC As Integer, ByVal xSrc As Integer, ByVal ySrc As Integer, ByVal dwRop As Integer) As Integer
Eccovi il codice:
codice:
Private Sub Bar_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Bar.Paint
'dal verde al giallo
Dim DRed As Integer = ColorB.R - ColorA.R
Dim DGreen As Integer = ColorB.G - ColorA.G
Dim DBlue As Integer = ColorB.B - ColorA.B
' pos:100=x:width-1 -> x=pos*(width-1)/100
Dim max As Integer = Position * (Bar.Width - 1) / 100
Dim XRed As Double = DRed / max
Dim XGreen As Double = DGreen / max
Dim XBlue As Double = DBlue / max
Dim i As Integer
Dim ared As Double = ColorA.R
Dim agreen As Double = ColorA.G
Dim ablue As Double = ColorA.B
Dim penna As Pen = New Pen(Color.FromArgb(ared, agreen, ablue))
For i = 0 To max - 1
penna.Color = Color.FromArgb(Math.Round(ared), Math.Round(agreen), Math.Round(ablue))
e.Graphics.DrawLine(penna, i, 0, i, Bar.Height - 1)
If DRed <> 0 Then
ared += XRed
End If
If DGreen <> 0 Then
agreen += XGreen
End If
If DBlue <> 0 Then
ablue += XBlue
End If
Next
e.Graphics.DrawRectangle(Pens.Black, 0, 0, Bar.Width - 1, Bar.Height - 1)
e.Graphics.DrawString(Position.ToString & " %", New Font("Arial", 8), Brushes.Blue, Bar.Width / 2 - 2, Bar.Height / 2 - 2)
Bar.Invalidate()
End Sub