473,383 Members | 1,880 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,383 software developers and data experts.

Draw a line

Hi there,

I wanna draw a line using read() method? After that I would need to read the HEX values which later be used as a point (x, y). From that point, it will create a line.

Thanks




Regards,
Stephanie
Dec 11 '09 #1
9 3005
tlhintoq
3,525 Expert 2GB
"Wanna" ? Are you 10 years old?

What HEX values?

Draw using a read() method?

This just makes no sense.

I would suggest that when you have more than 30 seconds, you take some time to actually explain what it is you are trying to do and what problem you are running into.
Dec 11 '09 #2
Dheeraj Joshi
1,123 Expert 1GB
Could you explain what is the actual problem.?

Have you written any code for it.?

Regards
Dheeraj Joshi
Dec 11 '09 #3
ThatThatGuy
449 Expert 256MB
are you trying o draw a line on console..... or on a windows form...

if console then you cant take x,y points..... if windows form then its possible
Dec 12 '09 #4
:) hahaha .
Dec 12 '09 #5
Hi all,

Sorry for the kiddy way of expressing the program ;P

I am using Microsoft Visual C# 2008 Express Edition. I want to write on windows form application. I am a newbie to programming, so I have no idea how to start it.


The program look:
By using serial port, the program can send and receive data. The user will be able to enter hexadecimal values and send it. By using readbyte() or read() method to read the hexadecimal values which later be used to get points (x,y). From that points, a line will be drawn.

That's my task.

Your help will be greatly appreciated =)

Thanks.

Regards,
Stephanie
Dec 13 '09 #6
sanjib65
102 100+
Though you are new to programming, I'd suggest you to always refer to MSDN. It's a good practice and you'll learn to experiment and make errors. Unless you make errors you'd never be programmer!

So for the drawing part you consult these links:

http://msdn.microsoft.com/en-us/libr...8(VS.100).aspx

and Codes:

Expand|Select|Wrap|Line Numbers
  1. System.Drawing.Pen myPen = new System.Drawing.Pen(System.Drawing.Color.Red);
  2. System.Drawing.Graphics formGraphics;
  3. formGraphics = this.CreateGraphics();
  4. formGraphics.DrawLine(myPen, 0, 0, 200, 200);
  5. myPen.Dispose();
  6. formGraphics.Dispose();
Secondly, for the future reference you'd go to this very important link below. I think all the queries a new-bie has, are there:

http://msdn.microsoft.com/en-us/library/zftbwa2b.aspx

Happy programming!
Dec 13 '09 #7
tlhintoq
3,525 Expert 2GB
I am a newbie to programming, {...}
The program look:
By using serial port, the program can send and receive data. The user will be able to enter hexadecimal values and send it. By using readbyte() or read() method to read the hexadecimal values which later be used to get points (x,y). From that points, a line will be drawn.
Sounds like a rather specific way to start learning.
Hex values over a serial port? Why the 1998 approach? Sounds like a old-school serial port mouse, drawing tablet or joystick perhaps?

I might suggest since you are new to programming that you break down the project into smaller areas of learning. Get one part down at a time and build up from there.

Start with how to draw. You have been given some code for that.
Then I would suggest drawing based on the regular mouse coordinates because they are easy to read. This will give you a system of input for x and y.
Then worry about how to open and read the serial port, and translate your hex into x and y.

Tip: Make the mouse reading a module that raises events. Make the drawing portion a module that subscribes to those events. When you are ready to make the serial part it can raise the same events that the mouse module does. This means you will be able to use both mouse and serial with the same drawing portion. This kind of "black box" approach is key to writing software that can be maintained and expanded easily for years.
Dec 13 '09 #8
Hi Sanjib65,

Thanks for the helpful links, I will read more on that. =)

Hi tlhintoq,

I have actually to draw the lines onto a "whiteboard".
I was not allowed to use the mouse events, I have tried to do that by referring to "scribbles", my partner insists on using the hexadecimal values that I have mentioned earlier.=(.

Thanks for the helpful tips.

Regards,
Stephanie
Dec 14 '09 #9
tlhintoq
3,525 Expert 2GB
Bytes has a policy regarding assisting students with their homework.

The short version is that the volunteers here can't help you with schoolwork.
A) We don't know what material you have and have not learned in class.
B) We don't know the guidelines you must follow.
C) In the long run giving you the answers actually short changes your education.
This question is a good example of how little bits of the larger picture start trickling out... Oh, there is a {study/lab} partner. You aren't *allowed* to do mouse events.

If you are struggling with the assignment the best source to turn to is your professor.
Dec 14 '09 #10

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

Similar topics

5
by: Matt | last post by:
I am writing a recursive program to draw the lines recursively, given the range and number of intervals (n) between the range. The problem is I don't know how to draw the line in point 0.375, as...
4
by: thomasp | last post by:
I found the following code on MSDN to draw a line in VB2005. Public Sub DrawLinePoint(ByVal e As PaintEventArgs) ' Create pen. Dim blackPen As New Pen(Color.Black, 3) ' Create points that...
2
by: dan heskett | last post by:
I am owner-drawing a listbox, in an attempt to create a nice list with some custom "fields" and text layout. Essentially it works, but I must be missing something big, conceptually, because I...
0
by: news | last post by:
If anyone can recommend a more appropriate newsgroup for this question? We recently upgraded from php 4.1.2 to php 4.3.9 and ImageMagick 5.5.7 to version 6.2.5. I have a script that creates a...
4
by: Jason Huang | last post by:
Hi, In my C# Windows Form, how do I draw a Line? Thanks for help. Jason
1
by: Rich | last post by:
Hello, I have a form with a panel which contains a radiobutton. When I click the radiobutton, I invoke the Paint event of the panel using me.Invalidate. The paint event gets called and runs...
1
by: balakrishnan.dinesh | last post by:
Hi frnds, Im creating function to plot line graph in javascript . I have marked the points in graph. but what i need to do is, i want to draw the line between those marked point, but i dont...
3
by: Daniel Mark | last post by:
Hello all: I am looking the sample code posted on PIL website http://www.pythonware.com/library/pil/handbook/imagedraw.htm ################################################ <<Draw a Grey Cross...
1
by: IvoShalev | last post by:
Hi there, I just want to give some sudgestions on how to draw some plain things only using the header file <graphics.hand of course the standart files <stdio.h<conio.h<stdlib.h>. First of All...
9
by: zhaow | last post by:
Hi, All Greetings! I want to develop as appllication that requires a line-drawing function in the blank area between two forms. I have looked up the MSDN, it says that a graphics object need a...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
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
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.