473,779 Members | 1,905 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 LinearGradientB rush(RCT, Color.Red, Color.Blue,
LinearGradientM ode.Vertical)

Dim NewReg = New Region(RCT)

gr.FillRegion(L GB, 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 958

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

Similar topics

4
410
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 PaintEventArgs) MyBase.OnPaint(e) Dim gbr As LinearGradientBrush = New LinearGradientBrush(New Rectangle(0, 0, Me.Width, Me.Height), Color.White, Color.Blue, LinearGradientMode.Horizontal)
5
2435
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? Do you draw it with code or attach a .gif file as a background or what? Does one way or the other have an effect on speed? Thank You
13
2077
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 zoomed area to be drawn on full screen. I want to draw it smoth not a square of 60 pixels x 60 pixels with one color, because I can see blocks and it's not good. There is a way to interpoate the colors between rectangles to show a smoth zoom?
1
6298
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 panel. I thought I was on the right track and did achieve the effect ... until I started putting some controls on the panel. Then I got an "Invalid parameter" error but don't understand what it's referring to. Based on examples I've found,...
3
2039
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 whilst in the IDE, but when I run the app, they both go to boring grey. In the application.designer.vb self generated file, it does have PublicSubNew() MyBase.New(Global.Microsoft.VisualBasic.ApplicationServices.Authent
2
1877
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: http://www.winsupersite.com/showcase/winvista_rc1_gallery_01.asp Notice how there is a black to transparent gradient on the right side of the screen. Does anyone know any way acheive this effect using Visual Studio 2005?
4
5889
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 g.InterpolationMode = InterpolationMode.HighQualityBicubic; g.CompositingQuality = CompositingQuality.HighQuality;
9
8145
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 display, then only a small portion of the gradient will show if the viewpoint is a smaller PDA or phone display. On the other hand, if viewed full screen on a 1920 pixel wide display, I would run out of gradient on one or both sides of the page....
1
1864
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 is resized or maximized for that matter, the form still displays the last areas that were painted with gradient. Basically the form does not erase the last graphics that were painted to the form and just paints over it with the new. My code is...
0
9632
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10071
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7478
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6723
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5372
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5501
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4036
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3631
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2867
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.