Advertisement
Guest User

Untitled

a guest
Jan 14th, 2014
166
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.37 KB | None | 0 0
  1. // Fills triangle with gradient brush
  2.  
  3. void GradientTriangle( HDC MemDC,
  4.     LONG x1, LONG y1, LONG x2, LONG y2, LONG x3, LONG y3,
  5.     COLORREF top, COLORREF bottom )
  6. {
  7.     TRIVERTEX vertex[3];
  8.  
  9.     vertex[0].x     = x1;
  10.     vertex[0].y     = y1;
  11.     vertex[0].Red   = GetRValue(bottom) << 8;
  12.     vertex[0].Green = GetGValue(bottom) << 8;
  13.     vertex[0].Blue  = GetBValue(bottom) << 8;
  14.     vertex[0].Alpha = 0x0000;
  15.  
  16.     vertex[1].x     = x2;
  17.     vertex[1].y     = y2;
  18.     vertex[1].Red   = GetRValue(top) << 8;
  19.     vertex[1].Green = GetGValue(top) << 8;
  20.     vertex[1].Blue  = GetBValue(top) << 8;
  21.     vertex[1].Alpha = 0x0000;
  22.  
  23.     vertex[2].x     = x3;
  24.     vertex[2].y     = y3;
  25.     vertex[2].Red   = GetRValue(bottom) << 8;
  26.     vertex[2].Green = GetGValue(bottom) << 8;
  27.     vertex[2].Blue  = GetBValue(bottom) << 8;
  28.     vertex[2].Alpha = 0x0000;
  29.  
  30.     // Create a GRADIENT_TRIANGLE structure that
  31.     // references the TRIVERTEX vertices.
  32.  
  33.     GRADIENT_TRIANGLE gTriangle;
  34.  
  35.     gTriangle.Vertex1 = 0;
  36.     gTriangle.Vertex2 = 1;
  37.     gTriangle.Vertex3 = 2;
  38.  
  39.     // Draw a shaded triangle.
  40.  
  41.     GradientFill( MemDC, vertex, 3, &gTriangle, 1, GRADIENT_FILL_TRIANGLE);
  42. }
  43.  
  44. // draw the window's footer ( "status bar" )
  45.  
  46. void drawFooter( HDC MemDC, RECT r, COLORREF top, COLORREF bottom )
  47. {
  48.     // bottom triangle
  49.  
  50.     GradientTriangle( MemDC,
  51.         r.right, r.bottom,
  52.         ( r.right - r.left ) / 2,
  53.         r.bottom - r.top - 15,
  54.         r.left,
  55.         r.bottom,
  56.         top, bottom );
  57.  
  58.     // upper triangle
  59.  
  60.     GradientTriangle( MemDC,
  61.         r.right, r.bottom - r.top - 30,
  62.         ( r.right - r.left ) / 2,
  63.         r.bottom - r.top - 15,
  64.         r.left,
  65.         r.bottom - r.top - 30,
  66.         top, bottom );
  67.  
  68.     // left triangle
  69.  
  70.     GradientTriangle( MemDC,
  71.         r.left, r.bottom,
  72.         ( r.right - r.left ) / 2,
  73.         r.bottom - r.top - 15,
  74.         r.left,
  75.         r.bottom - r.top - 30,
  76.         top, bottom );
  77.  
  78.     // right triangle
  79.  
  80.     GradientTriangle( MemDC,
  81.         r.right,
  82.         r.bottom - r.top - 30,
  83.         ( r.right - r.left ) / 2,
  84.         r.bottom - r.top - 15,
  85.         r.right,
  86.         r.bottom,
  87.         top, bottom );
  88.  
  89.     // draw icon
  90.  
  91.     DrawIconEx( MemDC, r.left, r.bottom - r.top - 30,
  92.         hiAdmin, // a global variable for icon
  93.         30, 30, NULL, NULL, DI_NORMAL );
  94. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement