我有一个短暂的问题。
我如何在controls
等textbox
之类的Private Sub GroupBox6_Paint(sender As Object, e As PaintEventArgs) Handles GroupBox6.Paint
If txtStatus.Text = "Cancelled" Then
Try
Dim newImage As Image = Image.FromFile(FOLDER_PATH & "\completed.png")
Dim x As Single = ((GroupBox6.Width / 2) - (463 / 4))
Dim y As Single = 10
Dim width As Single = 463 / 2
Dim height As Single = 242 / 2
e.Graphics.DrawImage(newImage, x, y, width, height)
Catch ex As Exception
End Try
End If
End Sub
之上绘制这种图像。
这是我的代码:
Completed
这是我的输出:
所以我的目标是在我的textbox, label
内部groupbox
内部绘制图像Now distritribute items according to height % in funnel. So
A1 = 0.3*200 = 60
A2 = 0.25*200 = 50
A3 = 0.2*200 = 40
A4 = 0.15*200 = 30
A5 = 0.1*200 = 20
--------------------
Total = 200
On the basis of above calculated height:- 5 different BezierPath can be drawn .
Above data can be generalised to 'n' items and 'x' Height .
吗?
答案 0 :(得分:0)
您需要两个$('button').click(function(){tc.push(1); tc.push(1)})
和一个bitmaps
才能生效。第一个是picturebox
图片,第二个是png
图片:
picturebox
在表单加载事件中初始化两个图像:
Private pngImage, picBoxImage As Image
sub 显示图片框:
Private Sub Form1_Load(sender As System.Object, e As System.EventArgs) Handles MyBase.Load
pngImage = Image.FromFile(FOLDER_PATH & "\completed.png") //load it once
picBoxImage = CType(pngImage.Clone, Image)
PictureBox1.Size = New Size(CInt(463 / 2), CInt(242 / 2))
PictureBox1.Parent = GroupBox6
PictureBox1.Image = picBoxImage
PictureBox1.Visible = False //you dont want it at the beggining
End Sub
每次要显示消息时都要调用上面的子。你决定从何时何地。如果您不再需要,则需要隐藏Private Sub ShowCompletedMessage()
Dim screenLocation As Point
Dim gr As Graphics
//you can pass these values as parameters in the sub if you want to make the code more generic
Dim x As Integer = CInt(((GroupBox6.Width / 2) - (463 / 4)))
Dim y As Integer = 10
Dim width As Integer = CInt(463 / 2)
Dim height As Integer = CInt(242 / 2)
//Ensure that picturebox is not visible. If it is you don't need to take a screenshot
If PictureBox1.Visible = True Then
Return
End If
gr = Graphics.FromImage(picBoxImage)
//you need to transform the coordinates to screen ones
screenLocation = GroupBox6.PointToScreen(New Point(x, y))
//draw the portion of the screen to your bitmap
gr.CopyFromScreen(screenLocation.X, screenLocation.Y, 0, 0, New Size(width, height), CopyPixelOperation.SourceCopy)
//draw the png image on top
gr.DrawImage(pngImage, 0, 0, width, height)
PictureBox1.Location = New Point(x, y)
PictureBox1.BringToFront()
PictureBox1.Visible = True
gr.Dispose()
gr = Nothing
Return
End Sub
picturebox