Jarod Posted December 3, 2003 Posted December 3, 2003 I have a simple Windows Form with several TextBoxes and Two buttons. In the Load event, I change dynamically the text of the buttons and the caption text (depending of the user language) To do that, I get an XML file and I retreieve the correct values. For an unknown reason, my buttons are not painted (totally transparent) until I move to the next field. I use the exactly the same technique for several different forms that are painted correctly. No SuspendLayout or stuff like that... So at the end of the form, I do a myButton1.Refresh and it is ok but it is really wierd. Does someone has seen that ? Any idea ? Quote Jarod
iebidan Posted December 3, 2003 Posted December 3, 2003 can you post the code, or a sample of what's going on???? Quote Fat kids are harder to kidnap
Jarod Posted December 3, 2003 Author Posted December 3, 2003 well... here is a bitmap to show the result. No buttons : after the load, as the forms is shown With buttons : after a refresh (here I have minimized the form and restored it) For the code, I just do somthing like that : Private Sub myBase_Load(ByVal sender As Object, ByVal e As EventArgs) Handles MyBase.Load DisplayLabels() end sub Private Sub DisplayLabels() 'Get the XML string containing the labels Dim myLabelString As String = GetLabelsForContext("WIZARD")) 'labelExplorer is a Wrapper for navigating more easily in the XML, 'getting a PathNavigator, and exposing properties to get attribute from the XML Dim myLabelExplorer As New LabelExplorer(myLabelString) With myLabelExplorer While .MoveNext Select Case .TXT_CODE Case "txt0698" : DisplayLabel(btnCancel, .VALUE, .TOOLTIP, .HELP) Case "txt0699" : DisplayLabel(btnFinish, .VALUE, .TOOLTIP, .HELP) 'Do the same for other controls End Select End While End With End Sub Public Sub DisplayLabel(ByVal myControl As Control, ByVal value As String, _ ByVal tooltip As String, ByVal help As String) If Not myControl Is Nothing Then myControl.Text = value If Not tooltip Is Nothing Then ToolTip1.SetToolTip(myControl, tooltip) End If If Not help Is Nothing Then HelpProvider1.SetHelpString(myControl, help) End If End If End Sub Btw, I use that kind of code for some other forms without any problem.transparentbuttons.zip Quote Jarod
Jarod Posted December 3, 2003 Author Posted December 3, 2003 btw, we don't really see on the latest attachement. The buttons are tranparent. here is a new screenshot done on my IDE, we can see the solutionExplorer beside :-)transparentbuttons2.zip Quote Jarod
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.