Click here to Skip to main content
16,004,919 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionHow to HIbernate or make the computer go stand by using vb.net code Pin
Mohit Namdeo14-Mar-06 6:47
Mohit Namdeo14-Mar-06 6:47 
AnswerRe: How to HIbernate or make the computer go stand by using vb.net code Pin
DanChin14-Mar-06 7:11
DanChin14-Mar-06 7:11 
AnswerRe: How to HIbernate or make the computer go stand by using vb.net code Pin
progload15-Mar-06 16:36
progload15-Mar-06 16:36 
QuestionCommand to get relative path Pin
Divya Rathi14-Mar-06 6:24
Divya Rathi14-Mar-06 6:24 
AnswerRe: Command to get relative path Pin
Steve Pullan14-Mar-06 11:59
Steve Pullan14-Mar-06 11:59 
AnswerRe: Command to get relative path Pin
sathish s14-Mar-06 19:13
sathish s14-Mar-06 19:13 
QuestionForms being Truncated Pin
daveryan7814-Mar-06 6:22
daveryan7814-Mar-06 6:22 
QuestionGradient Brush Pin
Tyrone_whitey14-Mar-06 5:51
Tyrone_whitey14-Mar-06 5:51 
Okay this looks nasty. Real Nasty. So here's the code.

Its supposed to be three parallel color polygons but, it doesn't look like that.

This is the first time i'm using the gradient brush so, if any of the experienced Vb programmers could help me make it look neater than what it is, that would be appreciated.

Private Sub frmSplash_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles MyBase.Paint

'Declares procedure level varaibles.
Dim brGradient As System.Drawing.Drawing2D.LinearGradientBrush
Dim points() As PointF

'Defines the rectangle.
Dim clientRectangle As New System.Drawing.Rectangle(0, 0, _
Me.Width, Me.Height)

'Sets the Gradient Brush color for the red polygon.
brGradient = New System.Drawing.Drawing2D.LinearGradientBrush(clientRectangle, _
Color.Black, Color.Red, _
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)

'Draws the points for the red polygon.
points = New PointF() {New PointF(0, 0), _
New PointF(0, 30), _
New PointF(ToSingle(Me.Width / 2.3), 320), _
New PointF(ToSingle(Me.Width / 2), 320), _
New PointF(ToSingle(Me.Width / 2), 295), _
New PointF(35, 0), _
New PointF(0, 0)}
'Fills the red polygon using the points and gradient brush.
e.Graphics.FillPolygon(brGradient, points)

'Closes the Gradient brush.
brGradient.Dispose()


'Sets the Gradient Brush color for the green polygon.
brGradient = New System.Drawing.Drawing2D.LinearGradientBrush(clientRectangle, _
Color.Black, Color.Green, _
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)

'Draws the points for the green polygon.
points = New PointF() {New PointF(125, 0), _
New PointF(125, 30), _
New PointF(400, 320), _
New PointF(435, 320), _
New PointF(435, 295), _
New PointF(160, 0), _
New PointF(125, 0)}

'Fills the green polygon using the points and gradient brush.
e.Graphics.FillPolygon(brGradient, points)

'Closes the Gradient brush.
brGradient.Dispose()

'Sets the Gradient Brush color for the blue polygon.
brGradient = New System.Drawing.Drawing2D.LinearGradientBrush(clientRectangle, _
Color.Black, Color.Blue, _
System.Drawing.Drawing2D.LinearGradientMode.Horizontal)
'Draws the points for the blue polygon.
points = New PointF() {New PointF(255, 0), _
New PointF(255, 30), _
New PointF(525, 320), _
New PointF(560, 320), _
New PointF(560, 295), _
New PointF(290, 0), _
New PointF(255, 0)}

'Fills the blue polygon using the points and gradient brush.
e.Graphics.FillPolygon(brGradient, points)

'Closes the Gradient brush.
brGradient.Dispose()


Ty

-- modified at 11:54 Tuesday 14th March, 2006
AnswerRe: Gradient Brush Pin
Chatura Dilan14-Mar-06 14:15
Chatura Dilan14-Mar-06 14:15 
GeneralRe: Gradient Brush Pin
Tyrone_whitey15-Mar-06 2:20
Tyrone_whitey15-Mar-06 2:20 
GeneralRe: Gradient Brush Pin
Chatura Dilan16-Mar-06 13:41
Chatura Dilan16-Mar-06 13:41 
QuestionCustom Paper Size Pin
Madni Abbasi14-Mar-06 5:40
Madni Abbasi14-Mar-06 5:40 
AnswerRe: Custom Paper Size Pin
Duncan Edwards Jones14-Mar-06 10:40
professionalDuncan Edwards Jones14-Mar-06 10:40 
GeneralRe: Custom Paper Size Pin
Madni Abbasi14-Mar-06 18:53
Madni Abbasi14-Mar-06 18:53 
AnswerRe: Custom Paper Size Pin
Madni Abbasi15-Mar-06 18:51
Madni Abbasi15-Mar-06 18:51 
Questionvb.net IE object Find and Navigate Links Pin
bemahesh14-Mar-06 5:37
bemahesh14-Mar-06 5:37 
QuestionCannot run with debug Pin
bricel14-Mar-06 5:04
bricel14-Mar-06 5:04 
AnswerRe: Cannot run with debug Pin
Dave Kreskowiak14-Mar-06 14:22
mveDave Kreskowiak14-Mar-06 14:22 
Questionform hide and show Pin
campbells14-Mar-06 4:27
campbells14-Mar-06 4:27 
AnswerRe: form hide and show Pin
albCode14-Mar-06 4:56
albCode14-Mar-06 4:56 
QuestionHow to save & retrieve photos in a database Pin
Arun Hegde14-Mar-06 3:43
Arun Hegde14-Mar-06 3:43 
AnswerRe: How to save & retrieve photos in a database Pin
kayos59214-Mar-06 3:52
kayos59214-Mar-06 3:52 
AnswerRe: How to save & retrieve photos in a database Pin
Vasudevan Deepak Kumar14-Mar-06 4:08
Vasudevan Deepak Kumar14-Mar-06 4:08 
AnswerRe: How to save & retrieve photos in a database Pin
Madni Abbasi14-Mar-06 5:47
Madni Abbasi14-Mar-06 5:47 
QuestionDisplaying Binary Image to PICTUREBOX Pin
thealca14-Mar-06 2:06
thealca14-Mar-06 2:06 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.