The following example contains two Comboboxes which List the available KnowColors by using the Following Code. Note:Code to Add all available Know Colors to Combobox
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Dim col As KnownColor For col = KnownColor.ActiveBorder To KnownColor.YellowGreen ComboBox1.Items.Add(col) ComboBox2.Items.Add(col) Next End Sub
Note:In the Selected Index Changed Event of Both the Combobox write the Following Code
Private Sub ComboBoxChanger(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ComboBox1.SelectedIndexChanged, ComboBox2.SelectedIndexChanged Dim g As Graphics = Me.CreateGraphics() Dim cl1 As KnownColor = ComboBox1.SelectedItem ' The Selected Item is converted to a KnownColor Dim cl2 As KnownColor = ComboBox2.SelectedItem ' The Selected Item is converted to a KnownColor Refresh() Dim graidentBrush As New Drawing2D.LinearGradientBrush(ClientRectangle, Color.FromKnownColor(cl1), Color.FromKnownColor(cl2), Drawing2D.LinearGradientMode.BackwardDiagonal)' This is for The Gradient Effect g.FillRectangle(graidentBrush, ClientRectangle) End Sub
Regards Hefin Dsouza Download the Sample Source Code
AttachmentsDownload Source Codes (28007-26182-GradientFun.rar)
|
No responses found. Be the first to respond and make money from revenue sharing program.
|