Ejemplo n.º 1
0
 internal void renderTip()
 {
     if ((Caption != String.Empty) && (Bounds != Rectangle.Empty))
     {
         // create the canvas
         _clientBounds.Height = 50;
         Rectangle bounds = calculateSize();
         bounds.X = Bounds.X;
         bounds.Y = Bounds.Y;
         Bounds = bounds;
         cStoreDc drawDc = new cStoreDc();
         drawDc.Width = Bounds.Width;
         drawDc.Height = Bounds.Height;
         positionWindow();
         // show the window
         showWindow(true);
         // draw the background to the temp dc
         drawBackground(drawDc.Hdc);
         // draw image and text
         if ((ItemImage != null) && (UseIcon))
             drawIcon(drawDc.Hdc);
         if (Title != String.Empty)
             drawTitle(drawDc.Hdc);
         drawCaption(drawDc.Hdc);
         // draw the tempdc to the window
         IntPtr hdc = GetDC(_hTipWnd);
         BitBlt(hdc, 0, 0, Bounds.Width, Bounds.Height, drawDc.Hdc, 0, 0, 0xCC0020);
         ReleaseDC(_hTipWnd, hdc);
         // cleanup
         drawDc.Dispose();
     }
 }
Ejemplo n.º 2
0
 internal void drawButtonFader(ToolStripItem item, IntPtr hdc, int opacity)
 {
     // create a buffered temporary canvas
     Rectangle bounds = item.Bounds;
     cStoreDc backDc = new cStoreDc();
     backDc.Height = bounds.Height;
     backDc.Width = bounds.Width;
     // create graphics
     using (Graphics g = Graphics.FromHdc(backDc.Hdc))
     {
         // blit in the background
         BitBlt(backDc.Hdc, 0, 0, bounds.Width, bounds.Height, hdc, 0, 0, 0xCC0020);
         RectangleF boundsF = new RectangleF(Point.Empty, bounds.Size);
         if ((item is ToolStripButton) || (item is ToolStripDropDownButton) || (item is ToolStripOverflowButton))
         {
             if (Parent.ButtonHoverEffect == ButtonHoverType.Flat)
                 Parent.drawFlatMask(g, boundsF, opacity);
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Glass)
                 Parent.drawGlassButton(g, boundsF, opacity);
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Glow)
                 Parent.drawDiffusedGlow(g, boundsF, opacity);
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Raised)
                 Parent.drawRaisedButton(g, boundsF, opacity);
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Bevelled)
                 Parent.drawBevelledMask(g, boundsF, opacity);
         }
         else if (item is ToolStripSplitButton)
         {
             ToolStripSplitButton button = (ToolStripSplitButton)item;
             RectangleF buttonF = button.ButtonBounds;
             RectangleF dropF = button.DropDownButtonBounds;
             if (Parent.ButtonHoverEffect == ButtonHoverType.Flat)
             {
                 Parent.drawFlatMask(g, dropF, opacity);
                 Parent.drawFlatMask(g, buttonF, opacity);
             }
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Glass)
             {
                 Parent.drawGlassButton(g, dropF, opacity);
                 Parent.drawGlassButton(g, buttonF, opacity);
             }
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Glow)
             {
                 Parent.drawDiffusedGlow(g, dropF, opacity);
                 Parent.drawDiffusedGlow(g, buttonF, opacity);
             }
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Raised)
             {
                 Parent.drawRaisedButton(g, dropF, opacity);
                 Parent.drawRaisedButton(g, buttonF, opacity);
             }
             else if (Parent.ButtonHoverEffect == ButtonHoverType.Bevelled)
             {
                 Parent.drawBevelledMask(g, dropF, opacity);
                 Parent.drawBevelledMask(g, buttonF, opacity);
             }
             bounds = button.DropDownButtonBounds;
             bounds.X += (bounds.Width - 4) / 2;
             Parent.drawArrow(g, bounds);
         }
     }
     bounds = item.Bounds;
     // blit to screen
     using (Graphics g = Graphics.FromHwnd(ToolStrip.Handle))
     {
         BitBlt(g.GetHdc(), bounds.X, bounds.Y, bounds.Width, bounds.Height, backDc.Hdc, 0, 0, 0xCC0020);
         g.ReleaseHdc();
         backDc.Dispose();
     }
 }