コード例 #1
0
 public static void DrawGlassBackground(this VisualStyleRenderer rnd, IDeviceContext dc, Rectangle bounds, Rectangle clipRectangle)
 {
     DrawWrapper(rnd, dc, bounds,
         delegate(IntPtr memoryHdc)
         {
             RECT rBounds = new RECT(bounds);
             RECT rClip = new RECT(clipRectangle);
             // Draw background
             DrawThemeBackground(rnd.Handle, memoryHdc, rnd.Part, rnd.State, ref rBounds, ref rClip);
         }
     );
 }
コード例 #2
0
 public static void DrawGlassIcon(this VisualStyleRenderer rnd, Graphics g, Rectangle bounds, ImageList imgList, int imgIndex)
 {
     DrawWrapper(rnd, g, bounds,
         delegate(IntPtr memoryHdc)
         {
             RECT rBounds = new RECT(bounds);
             DrawThemeIcon(rnd.Handle, memoryHdc, rnd.Part, rnd.State, ref rBounds, imgList.Handle, imgIndex);
         }
     );
 }
コード例 #3
0
 static extern void GetThemeMargins(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, int iPropId, IntPtr prc, out RECT pMargins);
コード例 #4
0
 static extern int DrawThemeTextEx(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, string text, int iCharCount, int dwFlags, ref RECT pRect, ref DrawThemeTextOptions pOptions);
コード例 #5
0
 static extern int DrawThemeIcon(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref RECT pRect, IntPtr himl, int iImageIndex);
コード例 #6
0
 static extern int DrawThemeBackground(IntPtr hTheme, IntPtr hdc, int iPartId, int iStateId, ref RECT pRect, ref RECT pClipRect);
コード例 #7
0
        /*public static void DrawGlowingText(this VisualStyleRenderer rnd, IDeviceContext dc, Rectangle bounds, string text, Font font, Color color, System.Windows.Forms.TextFormatFlags flags)
        {
            using (SafeGDIHandle primaryHdc = new SafeGDIHandle(dc))
            {
                // Create a memory DC so we can work offscreen
                using (SafeCompatibleDCHandle memoryHdc = new SafeCompatibleDCHandle(primaryHdc))
                {
                    // Create a device-independent bitmap and select it into our DC
                    BITMAPINFO info = new BITMAPINFO(bounds.Width, -bounds.Height);
                    using (SafeDCObjectHandle dib = new SafeDCObjectHandle(memoryHdc, GDI.CreateDIBSection(primaryHdc, ref info, 0, 0, IntPtr.Zero, 0)))
                    {
                        // Create and select font
                        using (SafeDCObjectHandle fontHandle = new SafeDCObjectHandle(memoryHdc, font.ToHfont()))
                        {
                            // Draw glowing text
                            DrawThemeTextOptions dttOpts = new DrawThemeTextOptions(true);
                            dttOpts.TextColor = color;
                            dttOpts.GlowSize = 10;
                            dttOpts.AntiAliasedAlpha = true;
                            RECT textBounds = new RECT(4, 0, bounds.Right - bounds.Left, bounds.Bottom - bounds.Top);
                            DrawThemeTextEx(rnd.Handle, memoryHdc, rnd.Part, rnd.State, text, text.Length, (int)flags, ref textBounds, ref dttOpts);

                            // Copy to foreground
                            const int SRCCOPY = 0x00CC0020;
                            GDI.BitBlt(primaryHdc, bounds.Left, bounds.Top, bounds.Width, bounds.Height, memoryHdc, 0, 0, SRCCOPY);
                        }
                    }
                }
            }
        }*/
        public static void DrawText(this VisualStyleRenderer rnd, IDeviceContext dc, ref Rectangle bounds, string text, System.Windows.Forms.TextFormatFlags flags, DrawThemeTextOptions options)
        {
            RECT rc = new RECT(bounds);
            using (SafeGDIHandle hdc = new SafeGDIHandle(dc))
                DrawThemeTextEx(rnd.Handle, hdc, rnd.Part, rnd.State, text, text.Length, (int)flags, ref rc, ref options);
            bounds = rc.ToRectangle();
        }
コード例 #8
0
 public static void DrawGlowingText(this VisualStyleRenderer rnd, IDeviceContext dc, Rectangle bounds, string text, Font font, Color color, System.Windows.Forms.TextFormatFlags flags)
 {
     DrawWrapper(rnd, dc, bounds,
         delegate(IntPtr memoryHdc) {
             // Create and select font
             using (SafeDCObjectHandle fontHandle = new SafeDCObjectHandle(memoryHdc, font.ToHfont()))
             {
                 // Draw glowing text
                 DrawThemeTextOptions dttOpts = new DrawThemeTextOptions(true);
                 dttOpts.TextColor = color;
                 dttOpts.GlowSize = 10;
                 dttOpts.AntiAliasedAlpha = true;
                 RECT textBounds = new RECT(4, 0, bounds.Right - bounds.Left, bounds.Bottom - bounds.Top);
                 DrawThemeTextEx(rnd.Handle, memoryHdc, rnd.Part, rnd.State, text, text.Length, (int)flags, ref textBounds, ref dttOpts);
             }
         }
     );
 }