Solved

How to draw a line just below to the main line in VC++

Posted on 2004-04-21
17
190 Views
Last Modified: 2013-11-20
I want to draw a line in the MDI application of the MFC(VC++).
On each OnLButtonDown(UINT nFlags, CPoint point), i'll get the point & those points i'll save it in the CArray<CPoint,CPoint> member variable.
OnLButtonDblClk(UINT nFlags, CPoint point) by using for loop i'll draw the line based on the CArray<CPoint,CPoint> member variable.
As soon as line will be visible on the view. I want  another line just below to the main line. I've to calculate the points for this another line based on the Main line stored point. How should i do that.
If you have any solution for this please let me know.
With Regards
Kapil
0
Comment
Question by:kdtyagi
  • 7
  • 5
17 Comments
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10886258
Main line - x1y1, x2y2, x3y3 ...
To draw
MoveTo(x1, y1);  LineTo(x2, y2); LineTo(x3, y3); ...

Now for your second line. set an offset variable to the offset required
int Offset = 5;

MoveTo(x1, y1+Offset); LineTo(x2, y2+Offset); LineTo(x3, y3+Offset); ...
0
 

Author Comment

by:kdtyagi
ID: 10925766
For Digital waveform it doesn't work.
With Regards
Kapil
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10925815
How can it NOT work?
Maybe you should rephrase your question
0
 

Author Comment

by:kdtyagi
ID: 10935600
Sorry may be my question is not correct. I want to draw a line just replication of the original one. In this scenario the replicate of digital waveform (just below) to the original one, horizontal line won't be having any problem but the vertical will have the problem.

According to the your code it gives the shadow look, instead of shadow look i want a line just beside to the main line. The same shape should appear.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10935744
try
int Offset = 10;   //or 20 instead of 5
0
 

Author Comment

by:kdtyagi
ID: 10935991
If you will give me your email id i can send you the bitmap so that you will get the clear picture.
0
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
LVL 44

Expert Comment

by:AndyAinscow
ID: 10936450
info@ainscow.ch
0
 
LVL 44

Accepted Solution

by:
AndyAinscow earned 150 total points
ID: 10937687
Oh dear.
The line isn't just below the original.  In places it is also offset horizontally.

Roughly you need to do the following.
Find the joints (horizontal to vertical direction change or vice versa)
Based on the joints create a second array where the points are moved by both a horizontal AND vertical offset.  The direction of the horizontal offset is dependant on the direction of the line change.
Then draw the line defined by these second points.

I don't have any code for this.  It sounds complex but in reality it's just messy to code.
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11125410
I believe I have told him what he needs to do o accomplish the task.
0
 

Author Comment

by:kdtyagi
ID: 11158588
No one gave me the answer so please close this answer i'll solve myself.
With Regards
Kapil
0
 
LVL 44

Expert Comment

by:AndyAinscow
ID: 11159147
The logic he requires is what my final comment supplies.
0
 

Author Comment

by:kdtyagi
ID: 12235031
To Administrative,
How to delete the question.
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
not able to insert into temp table 68 157
Replacement selected text 2 58
bigDiff challenge 17 85
Updating statistics with error notification email in SQL server 4 75
This is to be the first in a series of articles demonstrating the development of a complete windows based application using the MFC classes.  I’ll try to keep each article focused on one (or a couple) of the tasks that one may meet.   Introductio…
Introduction: Dynamic window placements and drawing on a form, simple usage of windows registry as a storage place for information. Continuing from the first article about sudoku.  There we have designed the application and put a lot of user int…
This video will show you how to get GIT to work in Eclipse.   It will walk you through how to install the EGit plugin in eclipse and how to checkout an existing repository.
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

863 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

23 Experts available now in Live!

Get 1:1 Help Now