76
Graphics / VB.NET Transparent RenderWindow
« on: May 24, 2015, 12:20:16 am »
I have no idea if what I am trying to do is even possible because I am just starting out using SFML with VB.NET.
I currently have a picturebox that displays an image. I am trying to use a control, a panel in this instance with transparent backcolor, to display on top of the picturebox, with about 50% transparency so the picturebox's image shows through the panel. The panel will have additional controls inside of it that I would like to make transparent as well, but for now I am just trying to turn the panel slightly transparent.
Here is my code so far:
This shows the backcolor of the parent form both controls are on...so that obviously is not it. I have done some searches on the forum here, but there is not a lot of VB.NET that I have found, and I am probably searching for the wrong terminology. I'm probably doing this wrong anyways.
I would appreciate a point in the right direction or a better idea of how to display a half-transparent control over an image. Thanks.
I currently have a picturebox that displays an image. I am trying to use a control, a panel in this instance with transparent backcolor, to display on top of the picturebox, with about 50% transparency so the picturebox's image shows through the panel. The panel will have additional controls inside of it that I would like to make transparent as well, but for now I am just trying to turn the panel slightly transparent.
Here is my code so far:
Public ItemWindow As RenderWindow
Sub InitGraphics()
ItemWindow = New RenderWindow(frmMain.pnlItem.Handle)
End Sub
Sub DrawInventory()
ItemWindow.Clear(ToSFMLColor(frmMain.pnlItem.BackColor))
' add items here
ItemWindow.Display()
End Sub
Public Function ToSFMLColor(ToConvert As System.Drawing.Color) As SFML.Graphics.Color
Return New SFML.Graphics.Color(ToConvert.R, ToConvert.G, ToConvert.G, ToConvert.A)
End Function
Sub InitGraphics()
ItemWindow = New RenderWindow(frmMain.pnlItem.Handle)
End Sub
Sub DrawInventory()
ItemWindow.Clear(ToSFMLColor(frmMain.pnlItem.BackColor))
' add items here
ItemWindow.Display()
End Sub
Public Function ToSFMLColor(ToConvert As System.Drawing.Color) As SFML.Graphics.Color
Return New SFML.Graphics.Color(ToConvert.R, ToConvert.G, ToConvert.G, ToConvert.A)
End Function
This shows the backcolor of the parent form both controls are on...so that obviously is not it. I have done some searches on the forum here, but there is not a lot of VB.NET that I have found, and I am probably searching for the wrong terminology. I'm probably doing this wrong anyways.
I would appreciate a point in the right direction or a better idea of how to display a half-transparent control over an image. Thanks.