473,387 Members | 1,771 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

VS 2005 (VB) Linear Gradient Bug?

I am using Visual Studio 2005 with Visual Basic.

I am trying to create a vertical color-gradient rectangle. I want the
rectangle to go from red on top to blue on the bottom.

This is the routine I am using:

'''''''''''''''''''''''''''''''''''
RectHeight = 50

Dim RCT As New Rectangle(10, 10, 40, RectHeight)

Dim LGB As New LinearGradientBrush(RCT, Color.Red, Color.Blue,
LinearGradientMode.Vertical)

Dim NewReg = New Region(RCT)

gr.FillRegion(LGB, NewReg)
'''''''''''''''''''''''''''''''''''
If I use the above value (RectHeight = 50) for the height of the
rectangle it looks correct. If I instead use:

RectHeight = 51

Then the rectangle gets goofed. The very top line will have the
"bottom" color but the rest of the rectangle looks correct. If the
height of the rectangle is evenly divisible by 2, then it will look
correct. If the height is an odd value then the rectangle will display
the wrong color at the top line every time.

Anyone else experience this? Something stupid I am doing in the code?

Feb 12 '06 #1
0 932

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Bruno Silva | last post by:
well i'm trying to create a control that inherits from textbox or richtextbox to make the background gradient i use the following code : CODE Protected Overrides Sub OnPaint(ByVal e As...
5
by: Woody Splawn | last post by:
I have a webform where I would like to have the background color for the webform be a gradient in blue. How do I do this? What is the easiest way? What is the way most used by other developers? ...
13
by: Crirus | last post by:
The main ideea: I havea 513x513 array of values....I draw a sort of map using that values for colors... so I have a realistic lanscape (map). I want to zoom about 60 times that map...and the...
1
by: Robert W. | last post by:
In my WinForms app I've long been able to create a linear gradient effect by just intercepting the PaintEventHandler event. But I'd now like to create an inherited user control, specifically of a...
3
by: nkarnold | last post by:
My application seems to be ignoring Enable XP visual styles, which is ticked on in the application properties. the Toolbar and Menubar, which appear the nice looking shaded blue appear like that...
2
by: skylargivens | last post by:
I've created an application for Windows XP but I'm having trouble getting the right "look". I'd like my application to look somewhat like the Windows Vista sidebar:...
4
by: Jon Slaughter | last post by:
I'm drawing a linear gradient and its very "banded". The colors are far enough part that it should be plenty smooth enough but I always get the same number of bands regardless. I've tried to set...
9
by: Eric Lindsay | last post by:
How do you provide a consistent gradient fill as a background in a liquid layout? If I make a gradient fill image say 1000 pixels wide (and repeat it down the page) to suit a typical computer...
1
by: Bryon | last post by:
My current code paints a rectangular area at the top (under the menu and tool strip) and bottom (top of the status strip) of the main form with a linear gradient. The problem is that when the form...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.