Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Windows Forms / Drawing / April 2005

Tip: Looking for answers? Try searching our database.

restore previous color

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gv - 29 Apr 2005 23:15 GMT
Hi all,

I can draw a rectangle and fill with the code below:
before drawing another one at a different location how do
I restore the orginal color at the location?

Public Sub DrawRectangle(ByVal StartWidth As Single, ByVal StartHeight As
Single, ByVal Width As Single, _
                        ByVal Height As Single, ByVal FillColor As Color)

       'Draw a regular rectangle

       Dim NewBrush As SolidBrush
       Dim NewRect As RectangleF

       Try
           NewRect = New RectangleF
           With NewRect
               .X = StartWidth
               .Y = StartHeight
               .Width = Width
               .Height = Height
           End With

           NewBrush = New SolidBrush(FillColor)
           NewGraphics.FillRectangle(NewBrush, NewRect)
           NewBrush.Dispose()
           NewBrush = Nothing

       Catch ex As Exception
           Throw ex
       End Try

   End Sub

thanks
Gerry
Morten Wennevik - 30 Apr 2005 08:48 GMT
Hi gv,

Draw the same rectangle with the original color, or call Invalidate(Rectangle)

> Hi all,
>
[quoted text clipped - 33 lines]
> thanks
> Gerry

Signature

Happy coding!
Morten Wennevik [C# MVP]


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.