2 colors combo for back color of Windows controls

  • Thread starter Thread starter VJ
  • Start date Start date
V

VJ

How do I use shade effect as colors. For example when I change the backcolor
of my tab page, how do I set it to a faded 2 color combination?

VJ
 
* "VJ said:
How do I use shade effect as colors. For example when I change the backcolor
of my tab page, how do I set it to a faded 2 color combination?

You will have to draw the background yourself using a
'System.Drawing.Drawing2D.LinearGradientBrush' as brush.
 
Hi.. , could you point me to some examples of doing this? I am totally new
to this graphics things..

VJ
 
Hi,

Add Imports System.Drawing.Drawing2D to the top of your code file. In
the paint event for the tab page try something like this.

Private Sub TabPage1_Paint(ByVal sender As Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles TabPage1.Paint
Dim g As Graphics = e.Graphics
Dim sf As New StringFormat
Dim brText As New SolidBrush(TabPage1.ForeColor)
Dim rDraw As RectangleF

Dim br As New LinearGradientBrush(TabPage1.Bounds,
TabPage1.BackColor, Color.White, 90, False)

Dim bl As New Blend

bl.Factors = New Single() {0.0F, 0.1F, 0.5F, 0.7F, 0.7F, 0.5F, 0.3F,
0.2F, 0}

bl.Positions = New Single() {0, 0.1F, 0.2F, 0.5F, 0.6F, 0.7F, 0.8F,
0.9F, 1.0F}

br.Blend = bl

g.FillRectangle(br, RectangleF.op_Implicit(TabPage1.Bounds))


End Sub

Ken
---------------------
VJ said:
Hi.. , could you point me to some examples of doing this? I am totally new
to this graphics things..

VJ
 
Back
Top