Click here to Skip to main content
15,911,707 members
Home / Discussions / C#
   

C#

 
AnswerRe: How to align the Pen in DrawLine() ? Pin
bob1697219-Mar-03 4:55
bob1697219-Mar-03 4:55 
Line accuracy is troublesome when working in different mapping modes. Lines work fine when defining them in MM_TEXT (without scaling) but when using modes like MM_HIMETRIC and incorporating scaling, the MFC lines always insist on having the same screen coordinate width regardless of where they translate to from the mapping mode. Alignment problems because of this behaviour are most evident with endcaps when aligning horizontal and vertical lines. At different scales, a little overhang or underhang becomes evident. Consistency at all scales is nearly impossible to achieve.
Your question concerning the alignment can be approached by taking the line and offsetting it but you will find alignment with MFC Rectangles and Circles becomes problematic (especially with borders). I spent quite a few months addressing this issue and studying how other applications approach alignment and found that there are many schools of thought, all having pro's and con's.

When you need to leftalign and rightalign bottomalign and topalign geometric shapes, you will find that line thickness and your choice of righthanded, centered, and lefthanded lines complicate the process and will require some modifications to coordinates you feed to the drawing commands. I believe there are no "One size fits all" drawing routines that will accomodate every programmers needs. The MFC drawing commands are a good place to start but I would recommend calling those functions from within your own drawing functions that take your drawing approach into consideration.
GeneralUserControl Error!! Pin
bania19-Mar-03 0:46
bania19-Mar-03 0:46 
GeneralEnterpriseServices & COM+ components Pin
Giles18-Mar-03 23:23
Giles18-Mar-03 23:23 
GeneralC# & MSSQL Pin
Marix18-Mar-03 22:00
Marix18-Mar-03 22:00 
GeneralRe: C# & MSSQL Pin
Giles19-Mar-03 9:59
Giles19-Mar-03 9:59 
GeneralOpening a document with its associated program Pin
meemo1001418-Mar-03 18:56
meemo1001418-Mar-03 18:56 
GeneralRe: Opening a document with its associated program Pin
meemo1001421-Mar-03 18:06
meemo1001421-Mar-03 18:06 
Questionhow to save animation in C# Pin
henrykao18-Mar-03 15:42
henrykao18-Mar-03 15:42 
GeneralEverything you need for email in c# here.. Pin
Member 9618-Mar-03 13:26
Member 9618-Mar-03 13:26 
GeneralRe: Everything you need for email in c# here.. Pin
jhollon13-Aug-03 5:18
jhollon13-Aug-03 5:18 
GeneralRe: Everything you need for email in c# here.. Pin
Member 9613-Aug-03 6:58
Member 9613-Aug-03 6:58 
QuestionMySQL class? Pin
zamazula18-Mar-03 13:02
zamazula18-Mar-03 13:02 
AnswerRe: MySQL class? Pin
Nathan Blomquist18-Mar-03 13:58
Nathan Blomquist18-Mar-03 13:58 
GeneralRe: MySQL class? Pin
insomnious19-Mar-03 0:41
insomnious19-Mar-03 0:41 
GeneralDB and GUI coupling Pin
bpgc18-Mar-03 12:18
bpgc18-Mar-03 12:18 
GeneralSystem ShutDown... Pin
Gogou18-Mar-03 10:54
Gogou18-Mar-03 10:54 
GeneralRe: System ShutDown... Pin
Chris Jobson19-Mar-03 10:03
Chris Jobson19-Mar-03 10:03 
GeneralDBConcurrencyException: Delete a entry in master -detail table Pin
DionChen18-Mar-03 10:17
DionChen18-Mar-03 10:17 
QuestionHow to use GetNativeVariantForObject Pin
Preben Rasmussen18-Mar-03 9:49
Preben Rasmussen18-Mar-03 9:49 
QuestionHow to retrieve a value from hidden fields in a dataGrid? Pin
zoltix18-Mar-03 7:49
zoltix18-Mar-03 7:49 
AnswerRe: How to retrieve a value from hidden fields in a dataGrid? Pin
zoltix18-Mar-03 7:51
zoltix18-Mar-03 7:51 
Questioncustom editors in property grid?? Pin
LongRange.Shooter18-Mar-03 7:00
LongRange.Shooter18-Mar-03 7:00 
AnswerRe: custom editors in property grid?? Pin
leppie18-Mar-03 9:36
leppie18-Mar-03 9:36 
GeneralRe: custom editors in property grid?? Pin
LongRange.Shooter18-Mar-03 10:31
LongRange.Shooter18-Mar-03 10:31 
GeneralRe: custom editors in property grid?? Pin
LongRange.Shooter19-Mar-03 5:39
LongRange.Shooter19-Mar-03 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.