2 gradients?
2 gradients?
2 gradients?
2 gradients?
2 gradients?
2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients?
2 gradients? 2 gradients?
2 gradients?
Go Back  Xtreme Visual Basic Talk > > > 2 gradients?


Reply
 
Thread Tools Display Modes
  #1  
Old 08-19-2004, 08:15 PM
akrocks's Avatar
akrocks akrocks is offline
Junior Contributor
 
Join Date: Mar 2003
Location: the great plains...
Posts: 398
Default 2 gradients?


im trying to show two gradients on a panel.. its throwing some odd error... is it possible to have to gradients drawn by the same control?

Code:
Private Sub Panel2_Paint(ByVal sender As Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel2.Paint Dim canvas As Graphics = e.Graphics Dim gradientrect As New Rectangle(0, 0, Me.Width / 2, Me.Height) Dim paintbrush As New LinearGradientBrush(gradientrect, Color.Blue, Color.White, LinearGradientMode.Horizontal) canvas.FillRectangle(paintbrush, gradientrect) paintbrush.Dispose() canvas.Dispose() 'works up to here (works if the following is commented out) Dim canvas2 As Graphics = e.Graphics Dim gradientrect2 As New Rectangle(Me.Width / 2, 0, Me.Width / 2, Me.Height) Dim paintbrush2 As New LinearGradientBrush(gradientrect2, Color.White, Color.Blue, LinearGradientMode.Horizontal) canvas2.FillRectangle(paintbrush2, gradientrect2) paintbrush2.Dispose() canvas2.Dispose() End Sub


Quote:
Originally Posted by Error
An unhandled exception of type 'System.ArgumentException' occurred in system.windows.forms.dll

Additional information: Invalid parameter used.
*"Public Class Form1" is highlighted in green in code editor.*
Reply With Quote
  #2  
Old 08-20-2004, 03:51 AM
liwo's Avatar
liwo liwo is offline
Centurion
 
Join Date: Oct 2003
Location: Germany
Posts: 116
Default

use

Dim canvas As Graphics = Panel2.CreateGraphics

and

Dim canvas2 As Graphics = Panel2.CreateGraphics
__________________
Please use [vb][/vb] Tags instead of [code][/code] Tags when posting VB Code. Thank you.
Reply With Quote
  #3  
Old 08-20-2004, 04:19 PM
akrocks's Avatar
akrocks akrocks is offline
Junior Contributor
 
Join Date: Mar 2003
Location: the great plains...
Posts: 398
Default

ok, thanks! but there is a vertical line where the new gradient starts.. how can i remove this?
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Forum Jump

Advertisement:





Free Publications
The ASP.NET 2.0 Anthology
101 Essential Tips, Tricks & Hacks - Free 156 Page Preview. Learn the most practical features and best approaches for ASP.NET.
subscribe
Programmers Heaven C# School Book -Free 338 Page eBook
The Programmers Heaven C# School book covers the .NET framework and the C# language.
subscribe
Build Your Own ASP.NET 3.5 Web Site Using C# & VB, 3rd Edition - Free 219 Page Preview!
This comprehensive step-by-step guide will help get your database-driven ASP.NET web site up and running in no time..
subscribe
2 gradients?
2 gradients?
2 gradients? 2 gradients?
2 gradients?
2 gradients?
2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients? 2 gradients?
2 gradients?
2 gradients?
 
2 gradients?
2 gradients?
 
-->