I have a method that does:
which calls:
Checking ToolStripProfessionalRenderer.cs I find:
With these constructors and I assue I called the top one:
It also has ths methods. I assume since I haven't set professionalColorTable it is Null and ProfessionalColors.ColorTable is returned. I think this is also Null.
Checking ProfessionalColors.cs I find:
Here again it appears that professionalColorTable is null so the method would return professionalColorTable which is Null. Bottom line is: I am callig FillNameAndColors with argunent equal to Nothing
However, my indexIntoProps loop in the method at the top seems to work fine and I seem to get a list of the color from whatever theme I have select in Windows.
Of course I've checked the argument with the debugger and it is a fine ProfessionalColorTable with reasonable arguments.
So I can not be passing Nothing as the above analysis would indicate.
Can you see where I've gone wrong above?
And why are current theme colors returned?
VB.NET:
nameAndColors = FillNameAndColors((New ToolStripProfessionalRenderer()).ColorTable)
VB.NET:
Private Function FillNameAndColors(ProfessionalTableIn As ProfessionalColorTable) As StringWithColorSortStringOrColor()
Dim nameAndColors As StringWithColorSortStringOrColor()
Dim myRendererTableType As Type
myRendererTableType = ProfessionalTableIn.GetType
Dim propInfoList As Reflection.PropertyInfo()
propInfoList = myRendererTableType.GetProperties()
Dim numProps As Integer = propInfoList.Length
ReDim nameAndColors(numProps - 1)
For indexIntoProps As Integer = 0 To numProps - 1
C#:
public class ToolStripProfessionalRenderer : ToolStripRenderer
{
private ProfessionalColorTable professionalColorTable;
C#:
public ToolStripProfessionalRenderer()
{
}
internal ToolStripProfessionalRenderer(bool isDefault) : base(isDefault)
{
}
public ToolStripProfessionalRenderer(ProfessionalColorTable professionalColorTable)
{
this.professionalColorTable = professionalColorTable;
}
C#:
public ProfessionalColorTable ColorTable
{
get
{
if (professionalColorTable == null)
{
return ProfessionalColors.ColorTable;
}
return professionalColorTable;
}
}
C#:
private static ProfessionalColorTable professionalColorTable = null;
internal static ProfessionalColorTable ColorTable
{
get
{
if (professionalColorTable == null)
{
professionalColorTable = new ProfessionalColorTable();
}
return (professionalColorTable
}
}
However, my indexIntoProps loop in the method at the top seems to work fine and I seem to get a list of the color from whatever theme I have select in Windows.
Of course I've checked the argument with the debugger and it is a fine ProfessionalColorTable with reasonable arguments.
So I can not be passing Nothing as the above analysis would indicate.
Can you see where I've gone wrong above?
And why are current theme colors returned?
Last edited by a moderator: