473,770 Members | 2,082 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to set a thickness to a line being drawn?

blazedaces
284 Contributor
Hey, I have an application that draws a polyline with Graphics':

Expand|Select|Wrap|Line Numbers
  1. g.drawPolyline(getXPoints(),getYPoints(),nPoints);
It's drawn onto a background image and so the background image is so many pixels wide (the line I'm trying to "copy" or draw), but this drawn polyline is very thin, probably 1 pixel wide. Any way to change the thickness of a drawn line like this? Like another class? I've looked at graphics2D and I see no extra possibility there.

The only thing I can cook up is trying to manually either draw multiple polylines by drawing multiple points around it to "hack" thickness of a single line, don't know exactly how I would do that yet though.

Thought maybe there's something simple out there like a way to set a composite of graphics2D and somehow there is a line width I don't know. I didn't see anything like that, but maybe you guys know...

If you guys have other ideas on how to "hack" a thicker line too, would be appreciated.

Btw, background: I have a picture of a graph and instead of reading points from it one by one I wrote a program which draws some circles (its a polar graph) and I measured the pixels so it matches up great. It's intended that after I "draw" on top of the pictured graph, I'll have the points stored and can then write them to a file (that will do something else, but I'm not there yet).

That's why I want a thicker line, because I want it to draw over the line that's in the graph's picture. Mostly it's for visibility reasons though, so I can see I've drawn it correctly. Also, is orange the best color for visibility on top of let's say black or green or white? I thought it would stick out...

Thanks for any and all help/information.

-blazed
Jun 8 '07 #1
2 8043
JosAH
11,448 Recognized Expert MVP
That Graphics object passed in to your drawComponent method is actually
a Graphics2D methods (you can cast the first to the second). The second class
implements a method setStroke(Strok e stroke). The Stroke object determines
how things should be drawn. Also have a look at the BasicStroke class.

kind regards,

Jos
Jun 8 '07 #2
blazedaces
284 Contributor
That Graphics object passed in to your drawComponent method is actually
a Graphics2D methods (you can cast the first to the second). The second class
implements a method setStroke(Strok e stroke). The Stroke object determines
how things should be drawn. Also have a look at the BasicStroke class.

kind regards,

Jos
Thanks a bunch dude.

-blazed
Jun 8 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
2849
by: Stuart Norris | last post by:
Dear Group, I am new to c# and windows form designer - coming from a Motif background. I am attempting to develop an application for a touch screen and I need to have a menu system with a larger font to allow ease of selection. I have used OwnerDraw menus implementing the DrawItemEventHandler and
1
13063
by: MikeY | last post by:
I'm trying to find a way for changing the thickness of the groupbox borders. I've searched on this site but can't seem to find anything of this subject. Does anyone have a suggestion. Thanks in advance MikeY
0
1241
by: alexandre_irrthum | last post by:
Hi there, I am puzzled by the comportment of the line function from the ImageDraw module with regard to the way it draws or does not draw the last pixel of a line. Below I test this function on a 3x3 image and show schematic representations of obtained images (where o means a drawn pixel) import Image, ImageDraw
1
1632
by: alexandre_irrthum | last post by:
Hi there, Sorry to repost this, but I didn't get any answer one month ago. In essence, it seems that the ImageDraw line function draws lines one pixel shorter in some circumstances. This could be very annoying for some applications where precise geometry does matter. Below I test this function on a 3x3 image and show schematic representations of obtained images (where o means a drawn pixel)
1
3574
by: A.Neves | last post by:
Hi, I need to draw a curve with the thickness changing as function of some variable. How can I do this in C#? Any help would be very much appreciated. Thanks.
2
3523
by: John | last post by:
Hi there, I need to create a rectangle between two points so that I can check what is inside it using Contains(). The problem I am having is how to make the rectangle be able to cope with the angle between the two points, see the image in the link for what I mean. http://homepage.ntlworld.com/andrew.baldock/bloodbowl/select.png I am not interested in displaying anything in the rectangle, I just need
10
15390
by: vsts2007 | last post by:
I wrote a code for vertical lines in report which has memo fields... but the thickness of the line very less.. is it possible to increase the thickness of the line... VSTS
2
9022
by: mathewgk80 | last post by:
Hi all, I would like to know whether we can increase the thickness of a horizontal line.. <html> <head> <title>HR</title> </head> <body> <hr>
1
4763
by: thanawala27 | last post by:
Hi, I have created the graph using zedgraphs. The graph has 3 curves. Now, I wanted to increase the thickness of the curve. This is the code i have used while printing the graph. LineItem myCurve = myPane.AddCurve("Ch1", list1, Color.Blue, SymbolType.None);
0
9432
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10232
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10059
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10008
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,...
0
9873
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8891
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7420
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
6682
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();...
3
2822
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.