Click here to Skip to main content
15,887,341 members
Home / Discussions / Managed C++/CLI
   

Managed C++/CLI

 
GeneralRe: Can not convert from short __gc* to short* Pin
George L. Jackson29-Aug-07 13:00
George L. Jackson29-Aug-07 13:00 
QuestionCalling into .NET Class Lib from a C++ app Pin
concoran28-Aug-07 21:04
concoran28-Aug-07 21:04 
AnswerRe: Calling into .NET Class Lib from a C++ app Pin
led mike29-Aug-07 5:13
led mike29-Aug-07 5:13 
GeneralRe: Calling into .NET Class Lib from a C++ app Pin
concoran30-Aug-07 14:05
concoran30-Aug-07 14:05 
GeneralRe: Calling into .NET Class Lib from a C++ app Pin
led mike31-Aug-07 4:20
led mike31-Aug-07 4:20 
QuestionC++/CLI Zooming Pin
BuckBrown28-Aug-07 12:45
BuckBrown28-Aug-07 12:45 
AnswerRe: C++/CLI Zooming Pin
Luc Pattyn28-Aug-07 12:49
sitebuilderLuc Pattyn28-Aug-07 12:49 
GeneralRe: C++/CLI Zooming Pin
BuckBrown29-Aug-07 13:02
BuckBrown29-Aug-07 13:02 
Hi Luc,

Here is the code that allows me to use the mouse to draw a rectangle around an area of the display that I want to fill the display with, hence zooming. The aspect ratio is kept constant so if the rectangle is too high or too wide then it adjust the heighth or width accordingly. The Translate function positions the origin. The Scale function sets the scaling in the x and y directions. This TransformPointsExample function is called from OnPaint(PaintEventArgs^ e).

private: void TransformPointsExample(PaintEventArgs^ e)
{
float aspect_ratio = (float)nDisplayHeight / nDisplayWidth;
float zoombox_height = (float)zoomRectEndPos.Y - zoomRectStartPos.Y;
float zoombox_width = (float)zoomRectEndPos.X - zoomRectStartPos.X;

if(zoombox_height / zoombox_width > aspect_ratio)
zoombox_width = zoombox_height / aspect_ratio;
else
zoombox_height = zoombox_width * aspect_ratio;

float y_scale = (float)nDisplayHeight / zoombox_height;
float x_scale = (float)nDisplayWidth / zoombox_width;

Matrix^ myMatrix = gcnew Matrix();
myMatrix->Translate(-(float)zoomRectStartPos.X, -(float)zoomRectStartPos.Y);
myMatrix->Scale(x_scale, y_scale, MatrixOrder::Append);
e->Graphics->Transform = myMatrix;
}

Buck
GeneralRe: C++/CLI Zooming [modified] Pin
Luc Pattyn29-Aug-07 13:17
sitebuilderLuc Pattyn29-Aug-07 13:17 
GeneralRe: C++/CLI Zooming Pin
Mark Salsbery29-Aug-07 14:18
Mark Salsbery29-Aug-07 14:18 
GeneralRe: C++/CLI Zooming Pin
Luc Pattyn29-Aug-07 15:41
sitebuilderLuc Pattyn29-Aug-07 15:41 
GeneralRe: C++/CLI Zooming Pin
Mark Salsbery29-Aug-07 18:40
Mark Salsbery29-Aug-07 18:40 
GeneralRe: C++/CLI Zooming Pin
Luc Pattyn29-Aug-07 23:31
sitebuilderLuc Pattyn29-Aug-07 23:31 
GeneralRe: C++/CLI Zooming Pin
Mark Salsbery30-Aug-07 4:56
Mark Salsbery30-Aug-07 4:56 
AnswerRe: C++/CLI Zooming Pin
Mark Salsbery28-Aug-07 12:56
Mark Salsbery28-Aug-07 12:56 
QuestionRuberbanding graphics without repainting entire screen Pin
BuckBrown28-Aug-07 10:01
BuckBrown28-Aug-07 10:01 
AnswerRe: Ruberbanding graphics without repainting entire screen Pin
Luc Pattyn28-Aug-07 12:30
sitebuilderLuc Pattyn28-Aug-07 12:30 
GeneralRe: Ruberbanding graphics without repainting entire screen Pin
BuckBrown28-Aug-07 12:43
BuckBrown28-Aug-07 12:43 
QuestionMethod definitions in header files Pin
Xpnctoc28-Aug-07 9:11
Xpnctoc28-Aug-07 9:11 
AnswerRe: Method definitions in header files Pin
led mike29-Aug-07 5:21
led mike29-Aug-07 5:21 
AnswerRe: Method definitions in header files Pin
George L. Jackson29-Aug-07 7:37
George L. Jackson29-Aug-07 7:37 
GeneralRe: Method definitions in header files Pin
Xpnctoc29-Aug-07 8:29
Xpnctoc29-Aug-07 8:29 
GeneralRe: Method definitions in header files [modified] Pin
George L. Jackson29-Aug-07 12:01
George L. Jackson29-Aug-07 12:01 
GeneralRe: Method definitions in header files Pin
Mark Salsbery29-Aug-07 12:33
Mark Salsbery29-Aug-07 12:33 
GeneralRe: Method definitions in header files [modified] Pin
George L. Jackson29-Aug-07 12:54
George L. Jackson29-Aug-07 12:54 

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.