Home > Software engineering >  How to use the mouse wheel control by drawing graphics zoom?
How to use the mouse wheel control by drawing graphics zoom?

Time:09-26

Good bosses, I novice the following problems encountered in practice, has mapped out a few simple graphics, such as point, line, rectangle, polygon, etc.; How to use onm ouseWheel message on zoom in and out on the drawings? Drawing code is as follows:
 CClientDC dc (this); 
CPen pen (m_nLineStyle m_nLineWidth, m_clr);
Dc. SelectObject (& amp; Pen);
CBrush * pBrush=CBrush: : FromHandle ((HBRUSH) GetStockObject (NULL_BRUSH));
Dc. SelectObject (pBrush);

The switch (m_nDrawType)
{
Case 1:

Dc. SetPixel (point, m_clr);
break;
Case 2:
Dc. MoveTo (m_ptOrigin);
Dc. LineTo (point);
break;
Case 3:
Dc. A Rectangle (CRect (m_ptOrigin, point));
break;
Case 4:
Dc. The Ellipse (CRect (m_ptOrigin, point));
break;
Case 5:
If (m_CountPoint==0)
{
M_PointFirst=point;
}

Dc. SetPixel (point, m_clr);
PointArray [m_CountPoint + +]=point;
M_ptEnd=point;
If (m_CountPoint & gt;
=2){
Dc. Polyline (PointArray m_CountPoint);
}
break;
}
CGraph * pGraph=new CGraph (m_nDrawType m_ptOrigin, point, m_clr, m_nLineWidth, m_nLineStyle);
M_obArray. Add (pGraph);
The CView: : OnLButtonUp (nFlags, point);


, you will give an idea!!!!!!

CodePudding user response:

StretchBlt () map ~

CodePudding user response:

Zoom in, should use the mapping model to control

CodePudding user response:

Using MM_ANISOTROPIC

And pDC - & gt; SetViewportExt

CodePudding user response:

reference 1st floor VisualEleven response:
StretchBlt () maps ~

Hello, party is not convenient, how to use a

CodePudding user response:

Sds123go
reference 4 floor response:
Quote: refer to 1st floor VisualEleven response:

StretchBlt () maps ~

Hello, party is not convenient, how to use a

Baidu search relevant keywords,

CodePudding user response:

1, to save your original figure into a memory DC
2, set a scaling parameter R (float or double)
3, in the event of an roller onm ouseWheel, adjust the R value, and issue a Invaledate (,,)
4, according to the R value and the original image parameter calculation of target size,
5, in the OnPaint or ontouch, according to the original size and target size, called StretchBlt () to display images

CodePudding user response:

http://blog.csdn.net/hyman_c/article/details/50290775

CodePudding user response:

refer to 6th floor worldy response:
1, to save your original figure into a memory DC
2, set a scaling parameter R (float or double)
3, in the event of an roller onm ouseWheel, adjust the R value, and issue a Invaledate (,,)
4, according to the R value and the original image parameter calculation of target size,
5, in the OnPaint or ontouch, according to the original size and target size, called StretchBlt () to display images



StretchBlt


This is not good, for text, use this would zoom blur, I have done this function, the best is in proportion to adjust the straight line, the position of the rectangle, according to the adjusted the position of the drawing,
  • Related