Hello,
i'm using a UltraWinTree, which has a assigned style set. This style set uses a specific font, which can probably be changed by the user of the application.
Now i'm trying to get the System.Drawing.Font of a UltraTreeNode from this tree at runtime. "Override.NodeAppearance.FontData" always returns me "default" or NULL/"0" values. When i call "ResolveAppearance" on the UltraTreeNode, the resulting Infragistics.Win.AppearanceData.FontData object also contains only default values. Calling CreateFont returns me NULL.
Can you please explain, how i can get the System.Drawing.Font of a UltraTreeNode?
Thank you in advance for your help!
Best regards,
Daniel
UltraTreeNode exposes a ResolveAppearance method, which is designed for exactly this purpose. In your case you would code something like this:
UltraTreeNode node;
AppearancePropFlags flags = AppearancePropFlags.FontData;
AppearanceData data = new AppearanceData();
node.ResolveAppearance(ref data, ref flags);
When execution returns from the ResolveAppearance method, the AppearanceData struct will be initialized with the resolved value(s). You could then use it's CreateFont method to create the same font as the one currently being used by that node.
Thank you for your reply. As i mentioned, i've already tried the "ResolveAppearance"-method, without success.
I've created a simple test application with one form, a button and a UltraWinTree. The button does the following:
/* Code start */
UltraTreeNode unRoot;AppearanceData data = new AppearanceData(); AppearancePropFlags flags = AppearancePropFlags.FontData;
Font foTest;
this.ultraTree1.ViewStyle = Infragistics.Win.UltraWinTree.ViewStyle.FreeForm;
unRoot = this.ultraTree1.Nodes.Add("Root");
unRoot.Text = "Test";
unRoot.ResolveAppearance(ref data, ref flags);
foTest = data.CreateFont(new Font("Microsoft Sans Serif", 8));
/* Code end */
data.FontData still contains the default values after calling ResolveAppearance. foTest is NULL after the "CreateFont"-call.
What am i doing wrong?