138 |
{ |
{ |
139 |
using (Graphics g = ownerForm.CreateNonClientGraphics()) |
using (Graphics g = ownerForm.CreateNonClientGraphics()) |
140 |
{ |
{ |
141 |
|
int i = 0; |
142 |
|
|
143 |
// Measure the menus if they need to be. |
// Measure the menus if they need to be. |
144 |
if (itemBounds == null) |
if (itemBounds == null) |
145 |
{ |
{ |
146 |
MeasureItemBounds(g); |
MeasureItemBounds(g); |
147 |
} |
} |
148 |
for (int i = 0; i < MenuItems.Count; i++) |
for (i = 0; i < MenuItems.Count; i++) |
149 |
{ |
{ |
150 |
DrawMenuItem(g, i, false); |
DrawMenuItem(g, i, false); |
151 |
} |
} |
152 |
|
// Fill in the rest of the menu, or the whole lot if no items |
153 |
|
if(i > 0) |
154 |
|
{ |
155 |
|
i--; |
156 |
|
g.FillRectangle(SystemBrushes.Menu, new Rectangle( |
157 |
|
itemBounds[i].X + itemBounds[i].Width, 0, |
158 |
|
ownerForm.Width - MenuPaddingSize.Width, |
159 |
|
SystemInformation.MenuHeight)); |
160 |
|
} |
161 |
|
else |
162 |
|
{ |
163 |
|
g.FillRectangle(SystemBrushes.Menu, new Rectangle |
164 |
|
(MenuPaddingOrigin.X, MenuPaddingOrigin.Y, |
165 |
|
ownerForm.Width - MenuPaddingSize.Width, |
166 |
|
ownerForm.Height - MenuPaddingSize.Height)); |
167 |
|
} |
168 |
} |
} |
169 |
} |
} |
170 |
|
|