Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI706.ASC

 
Output of file : TI706.ASC contained in archive : C_ALL.ZIP







PRODUCT : Borland C++ NUMBER : 706
VERSION : 2.0
OS : DOS
DATE : August 12, 1992 PAGE : 1/2

TITLE : Fix for BCWDEMO Line Drawing Example




BCWDEMO does not draw lines appropriately if drawn from lower
right to upper left. The below replacement code fixes the
problem.

Basically, the code ordering must be changed and a new
conditional statement substituted for the old. Below code --
replacement function -- fixes the line drawing problem.

/****************************************************************
* function DoLButtonUp
* When the left mouse button is released, this routine
* allows other windows to receive mouse messages and saves
* the position of the mouse as the other corner of a bounding
* rectangle for the shape.
***************************************************************/

void DoLButtonUp(HWND hWnd, LONG lParam)
{
ReleaseCapture();

/*
* if the origin of the line has changed, it should be drawn
* from upper right to lower left and therefore has negative
* slope. Otherwise it will have positive slope.
*/

if (CurrentShape == LINE)
thisShape[CurrentPoint].Slope =
(thisShape[CurrentPoint].Points.left < LOWORD(lParam) &&
thisShape[CurrentPoint].Points.top < HIWORD(lParam)) ||
(thisShape[CurrentPoint].Points.left > LOWORD(lParam) &&
thisShape[CurrentPoint].Points.top > HIWORD(lParam))
? 1 : -1;























PRODUCT : Borland C++ NUMBER : 706
VERSION : 2.0
OS : DOS
DATE : August 12, 1992 PAGE : 2/2

TITLE : Fix for BCWDEMO Line Drawing Example




/*
* For rectangles to work with the IntersectRect function,
* they must be stored as left, top, right, bottom.
*/
SetRect(&thisShape[CurrentPoint].Points,
min(thisShape[CurrentPoint].Points.left,
LOWORD(lParam)),
min(thisShape[CurrentPoint].Points.top,
HIWORD(lParam)),
max(thisShape[CurrentPoint].Points.left,
LOWORD(lParam)),
max(thisShape[CurrentPoint].Points.top,
HIWORD(lParam)));
/*
* Mark this region on the window as
* needing redrawing and force an update.
*/
InvalidateRect(hWnd, &thisShape[CurrentPoint].Points, 0);
UpdateWindow(hWnd);
mouseDown = 0;
oldx = -1;
oldy = -1;
}

DISCLAIMER: You have the right to use this technical information
subject to the terms of the No-Nonsense License Statement that
you received with the Borland product to which this information
pertains.























  3 Responses to “Category : C++ Source Code
Archive   : C_ALL.ZIP
Filename : TI706.ASC

  1. Very nice! Thank you for this wonderful archive. I wonder why I found it only now. Long live the BBS file archives!

  2. This is so awesome! 😀 I’d be cool if you could download an entire archive of this at once, though.

  3. But one thing that puzzles me is the “mtswslnkmcjklsdlsbdmMICROSOFT” string. There is an article about it here. It is definitely worth a read: http://www.os2museum.com/wp/mtswslnk/