Page 1 of 1

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

Posted: 27 Jun 2010, 10:56
by jasonz_2003
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

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

Posted: 13 Jul 2010, 12:25
by support
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.