Changeset 1098
- Timestamp:
- 6/3/2009 2:49:06 AM (4 years ago)
- File:
-
- 1 edited
-
trunk/eraser6/Eraser.Util/UxThemeApi.cs (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/eraser6/Eraser.Util/UxThemeApi.cs
r1097 r1098 152 152 153 153 e.Graphics.ReleaseHdc(); 154 rect.Inflate(-Margin, -Margin); 155 e.Graphics.FillRectangle(new SolidBrush(e.BackColor), rect); 154 156 } 155 157 … … 159 161 Rectangle rect = e.AffectedBounds; 160 162 rect.Width = GutterWidth; 161 rect.Inflate(-1, -1); 162 rect.Offset(1, 0); 163 rect.Inflate(-2, -2); 164 rect.Offset(1, 1); 165 rect.Size = new Size(rect.Width, rect.Height + 1); 163 166 164 167 NativeMethods.DrawThemeBackground(hTheme, hDC, … … 238 241 NativeMethods.POPUPITEMSTATES.MPI_DISABLED)); 239 242 243 Rectangle newRect = e.TextRectangle; 244 newRect.Offset(1, 0); 245 e.TextRectangle = newRect; 240 246 Rectangle rect = new Rectangle(e.TextRectangle.Left, 0, 241 247 e.Item.Width - e.TextRectangle.Left, e.Item.Height); … … 277 283 } 278 284 279 private staticint GutterWidth285 private int GutterWidth 280 286 { 281 287 get 282 288 { 283 return 2 * (SystemInformation.MenuCheckSize.Width + SystemInformation.BorderSize.Width); 289 Rectangle margins = Rectangle.Empty; 290 Size checkSize = Size.Empty; 291 292 NativeMethods.GetThemeMargins(hTheme, IntPtr.Zero, 293 (int)NativeMethods.MENUPARTS.MENU_POPUPCHECK, 0, 294 (int)NativeMethods.TMT_MARGINS.TMT_SIZINGMARGINS, 295 IntPtr.Zero, ref margins); 296 NativeMethods.GetThemePartSize(hTheme, IntPtr.Zero, 297 (int)NativeMethods.MENUPARTS.MENU_POPUPCHECK, 0, 298 IntPtr.Zero, NativeMethods.THEMESIZE.TS_TRUE, ref checkSize); 299 return 2 * checkSize.Width; 300 } 301 } 302 303 private int Margin 304 { 305 get 306 { 307 Size borderSize = Size.Empty; 308 NativeMethods.GetThemePartSize(hTheme, IntPtr.Zero, 309 (int)NativeMethods.MENUPARTS.MENU_POPUPBORDERS, 0, 310 IntPtr.Zero, NativeMethods.THEMESIZE.TS_TRUE, ref borderSize); 311 return borderSize.Width; 284 312 } 285 313 } … … 321 349 [DllImport("Gdi32.dll")] 322 350 public extern static IntPtr SelectObject(IntPtr hdc, IntPtr hgdiobj); 351 352 [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 353 public static extern IntPtr GetThemeMargins(SafeThemeHandle hTheme, 354 IntPtr hdc, int iPartId, int iStateId, int iPropId, ref Rectangle prc, 355 ref Rectangle pMargins); 356 357 [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 358 public static extern IntPtr GetThemeMargins(SafeThemeHandle hTheme, 359 IntPtr hdc, int iPartId, int iStateId, int iPropId, IntPtr prc, 360 ref Rectangle pMargins); 361 362 [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 363 public static extern IntPtr GetThemePartSize(SafeThemeHandle hTheme, 364 IntPtr hdc, int iPartId, int iStateId, ref Rectangle prc, 365 THEMESIZE eSize, ref Size psz); 366 367 [DllImport("UxTheme.dll", CharSet = CharSet.Unicode)] 368 public static extern IntPtr GetThemePartSize(SafeThemeHandle hTheme, 369 IntPtr hdc, int iPartId, int iStateId, IntPtr prc, 370 THEMESIZE eSize, ref Size psz); 323 371 324 372 public enum MENUPARTS … … 374 422 MSM_DISABLED = 2, 375 423 } 424 425 public enum TMT_MARGINS 426 { 427 TMT_SIZINGMARGINS = 3601, 428 TMT_CONTENTMARGINS, 429 TMT_CAPTIONMARGINS 430 } 431 432 public enum THEMESIZE 433 { 434 TS_MIN, 435 TS_TRUE, 436 TS_DRAW 437 } 376 438 } 377 439 }
Note: See TracChangeset
for help on using the changeset viewer.
