The Straight Dope

Go Back   Straight Dope Message Board > Main > General Questions

Reply
 
Thread Tools Display Modes
  #1  
Old 04-05-2000, 05:41 PM
DougC DougC is offline
Guest
 
Join Date: Mar 1999
- - - Visual Basic 6.0: I want to draw lines in a picture box using the [line] method, but I want the lines to be in different colors. The help files give two ways:
1. - using the RGB (n,n,n) method at the end of the [line] statement, or,
2. - setting the pictureboxname.foreground value to one of the hex numbers in the default palette, before the [line] statement you wish it to affect.
- My problem is, neither works. All I get is black lines; I can't get any other color. I notice that if you try to use a hex number not in the existing (default) palette, when you try to move the cursor off that line the computer immediately returns an error. Am I doing this right? - MC
Reply With Quote
Advertisements  
  #2  
Old 04-06-2000, 02:05 AM
SoulFrost SoulFrost is offline
BANNED
 
Join Date: Apr 1999
Location: Nomadic
Posts: 1,634
Not much of a VB guru, but here's something you might try.

Make the lines a few points thicker. I had a similar problem once, and the color worked fine on everything except my spiderweb-thin lines....

Oh, and move the picture-box, temporarily. Make sure that the lines aren't being drawn onto the form, then covered by the graphic.

Doubt it'll help, but good luck anyway!

-David
Reply With Quote
  #3  
Old 04-06-2000, 09:10 AM
RussellM RussellM is offline
Guest
 
Join Date: Feb 2000
Depending on the color range you need, you could use QBColor(n) instead of the RGB function.

These options certainly worked for me

Picture1.Line (iXstart, iYStart)-(iXFinish, iYFinish), RGB(iColor * 64, 0, 0)

Picture1.Line (iXstart, iYStart)-(iXFinish, iYFinish), QBColor(iColor)


I wouldn't worry about the lines being drawn in a different colour on another control - if you can see black lines on the picture control, they won't be getting printed anywhere else.

Noddy question - you can actually see different colours with your current configuration?


Russell
Reply With Quote
  #4  
Old 04-07-2000, 08:20 AM
DougC DougC is offline
Guest
 
Join Date: Mar 1999
- - - I can only get one color of line to show per picturebox, and only if I use drawmode #13 and change the forecolor property in the properties window. IF I try to use any three runtime methods, all I get is black lines. If I switch the drawmode style, I get odd colors showing up, in some cases, depending on the drawmode but I need several different colors. The most I get playing with the drawmode is two. Hmmmm . . . - MC
Reply With Quote
Reply

Bookmarks

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


All times are GMT -5. The time now is 07:21 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

Send questions for Cecil Adams to: cecil@chicagoreader.com

Send comments about this website to: webmaster@straightdope.com

Terms of Use / Privacy Policy

Advertise on the Straight Dope!
(Your direct line to thousands of the smartest, hippest people on the planet, plus a few total dipsticks.)

Publishers - interested in subscribing to the Straight Dope?
Write to: sdsubscriptions@chicagoreader.com.

Copyright © 2013 Sun-Times Media, LLC.