|
1 | 1 | using System; |
2 | 2 | using System.Collections.Generic; |
3 | | -using System.Text; |
4 | 3 | using System.Drawing; |
5 | 4 | using System.Windows.Forms; |
6 | | -using System.Reflection; |
7 | 5 | using System.ComponentModel; |
8 | 6 |
|
9 | 7 | namespace Aga.Controls.Tree.NodeControls |
@@ -175,10 +173,7 @@ public override void Draw(TreeNodeAdv node, DrawContext context) |
175 | 173 | Rectangle focusRect = new Rectangle(bounds.X, context.Bounds.Y, |
176 | 174 | bounds.Width, context.Bounds.Height); |
177 | 175 |
|
178 | | - Brush backgroundBrush; |
179 | | - Color textColor; |
180 | | - Font font; |
181 | | - CreateBrushes(node, context, label, out backgroundBrush, out textColor, out font, ref label); |
| 176 | + CreateBrushes(node, context, label, out Brush backgroundBrush, out Color textColor, out Font font, ref label); |
182 | 177 |
|
183 | 178 | if (backgroundBrush != null) |
184 | 179 | context.Graphics.FillRectangle(backgroundBrush, focusRect); |
@@ -238,22 +233,24 @@ private void CreateBrushes(TreeNodeAdv node, DrawContext context, string text, o |
238 | 233 | if (!context.Enabled) |
239 | 234 | textColor = SystemColors.GrayText; |
240 | 235 |
|
241 | | - if (DrawTextMustBeFired(node)) |
242 | | - { |
243 | | - DrawEventArgs args = new DrawEventArgs(node, this, context, text); |
244 | | - args.Text = label; |
245 | | - args.TextColor = textColor; |
246 | | - args.BackgroundBrush = backgroundBrush; |
247 | | - args.Font = font; |
| 236 | + if (!DrawTextMustBeFired(node)) |
| 237 | + return; |
248 | 238 |
|
249 | | - OnDrawText(args); |
| 239 | + var args = new DrawEventArgs(node, this, context, text) |
| 240 | + { |
| 241 | + Text = label, |
| 242 | + TextColor = textColor, |
| 243 | + BackgroundBrush = backgroundBrush, |
| 244 | + Font = font |
| 245 | + }; |
250 | 246 |
|
251 | | - textColor = args.TextColor; |
252 | | - backgroundBrush = args.BackgroundBrush; |
253 | | - font = args.Font; |
254 | | - label = args.Text; |
255 | | - } |
256 | | - } |
| 247 | + OnDrawText(args); |
| 248 | + |
| 249 | + textColor = args.TextColor; |
| 250 | + backgroundBrush = args.BackgroundBrush; |
| 251 | + font = args.Font; |
| 252 | + label = args.Text; |
| 253 | + } |
257 | 254 |
|
258 | 255 | public string GetLabel(TreeNodeAdv node) |
259 | 256 | { |
|
0 commit comments