请选择 进入手机版 | 继续访问电脑版
查看: 206|回复: 0

[.NET开发] 高可配置的 MDI 的 Tab 控件

3万

主题

3万

帖子

10万

积分

管理员

Rank: 9Rank: 9Rank: 9

积分
100197
发表于 2015-11-23 17:52:10
http://www.codeproject.com/KB/tabs/MDITabControl.aspx
  1. ' returns a new gradient brush with the glass look
  2. Friend Function CreateGlassGradientBrush( _
  3. ByVal Rectangle As Rectangle, ByVal Color1 As Color, _
  4. ByVal Color2 As Color) As Drawing2D.LinearGradientBrush
  5. ' creates a new gradient brush
  6. Dim b As New Drawing2D.LinearGradientBrush(Rectangle, _
  7. Color1, Color2, Drawing2D.LinearGradientMode.Vertical)
  8. ' creates a new bitmap to to render the gradient
  9. Dim x As New Bitmap(1, Rectangle.Height)
  10. Dim g As Graphics = Graphics.FromImage(x)
  11. ' paint the gradient on the bitmap
  12. g.FillRectangle(b, New Rectangle(0, 0, 1, Rectangle.Height))
  13. ' create a new color blend with 4 colors and copy the
  14. ' colors from the bitmat
  15. Dim c As New Drawing2D.ColorBlend(4)
  16. c.Colors(0) = x.GetPixel(0, 0)
  17. c.Colors(1) = x.GetPixel(0, x.Height / 3)
  18. ' the trick is here the 3rd color is the last color in
  19. ' the bitmap
  20. c.Colors(2) = x.GetPixel(0, x.Height - 1)
  21. ' and the last color is the one at 1/3
  22. c.Colors(3) = x.GetPixel(0, x.Height / 3)
  23. c.Positions(0) = 0
  24. c.Positions(1) = 0.335
  25. c.Positions(2) = 0.335
  26. c.Positions(3) = 1
  27. ' assign the color blend to the brush
  28. b.InterpolationColors = c
  29. g.Dispose()
  30. x.Dispose()
  31. Return b
  32. End Function
复制代码


回复

使用道具 举报