How can I make screen scroll when mouse reach the top of scr

Discuss and ask questions about CAD VCL (Delphi and C++ Builder).

Moderators: SDS, support, admin

Post Reply
jasonz_2003
Posts: 24
Joined: 13 Apr 2006, 16:20

How can I make screen scroll when mouse reach the top of scr

Post by jasonz_2003 » 27 Jun 2010, 10:56

HI,

I have write code to moe a selected entity with mouse. My problem is when the cursor reaches the edge of the screen it does not zoom automatically. the image is currently show in FitToSize and the scrollbars are show. Only it does not scroll. Please guide how I should code to make it happen? I am using C++ Builder 2009 and CADImportVCL_CADExportVCL_7.2.5.

Thanks.

Jason

support
Posts: 3256
Joined: 30 Mar 2005, 11:36
Contact:

Re: How can I make screen scroll when mouse reach the top of

Post by support » 13 Jul 2010, 12:25

Hello.
Such functionality is possible but library modification required. We will send modified units and AddNew demo project to your mailbox. Please note the following code changes:

Code: Select all

sgPaintBox->RectZooming = false;
...
void __fastcall TfmMain::sgPaintBoxMouseMove(TObject *Sender,
	  TShiftState Shift, int X, int Y)
{
	int dx = 0, dy = 0;
	if (!PtInRect(sgPaintBox->ClientRect, Point(X, Y))) {
		if (X < 0)
			dx = X;
		else
			if (X > sgPaintBox->ClientWidth)
				dx = X - sgPaintBox->ClientWidth;
		if (Y < 0)
			dy = Y;
		else
			if (Y > sgPaintBox->ClientHeight)
				dy = Y - sgPaintBox->ClientHeight;
	 sgPaintBox->MovePictureRect(-dx, -dy);
	}
}
and additions:

Code: Select all

void __fastcall TfmMain::sgPaintBoxMouseDown(TObject *Sender, TMouseButton Button,
	  TShiftState Shift, int X, int Y)
{
	if (Button == mbLeft) {
		sgPaintBox->SetFocus();
		SetCaptureControl(sgPaintBox);
	}
}
...
void __fastcall TfmMain::sgPaintBoxMouseUp(TObject *Sender, TMouseButton Button,
	  TShiftState Shift, int X, int Y)
{
	if ((Button == mbLeft) && (GetCaptureControl() == sgPaintBox)) {
		SetCaptureControl(NULL);
	}
}
Alexander.
Technical Support E-mail: support@cadsofttools.com
Chat support on Skype: cadsofttools.support

Post Reply