⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 dibapi.cpp

📁 《数字图象工程案例》原码
💻 CPP
字号:
#include "stdafx.h"
#include "DIBAPI.h"
#include "Designer.h"
extern int global_STEP;

extern CPoint ScrollPosforRYTX;

extern float global_mjwm;
extern CBrush CBrushWG;


void Drawnewbase(CDC *dc,int type,	COLORREF color_fg,COLORREF color_common,
				 float fcoeff,int widthnum,int heightnum,int steplen)
{	

	CPen PenFG,PenComm;
	int icreatepenfg = PenFG.CreatePen(PS_SOLID, 2, color_fg);
	int icreatepencomm = PenComm.CreatePen(PS_SOLID,1,color_common);
	
	if (icreatepenfg != 0 )
	   dc->SelectObject(&PenFG);
     
	int temp = (int)(steplen*fcoeff);
	
   if(type !=-2)
	{
	
	for(int i=0;i<=widthnum;i++)
	{
		if (i%10 != 0 )
		{	
		    dc->SelectObject(&PenComm);
			
		}
		else 
        {   
			
			dc->SelectObject(&PenFG);
        } 
			dc->MoveTo(i*steplen+OFFSET,OFFSET);
	    	dc->LineTo(i*steplen+OFFSET,temp*heightnum+OFFSET);
	}
	for(i = 0;i<=heightnum;i++)
	{
		if (i%10 != 0 )
		{	
		 dc->SelectObject(&PenComm);
		}
		else
		{
     	  dc->SelectObject(&PenFG);
		}
		dc->MoveTo(OFFSET,i*temp+OFFSET);
		dc->LineTo(steplen*widthnum+OFFSET,i*temp+OFFSET);
      
	}
   }
	PenFG.DeleteObject();	
	PenComm.DeleteObject();
	
}

CPoint gLocatePoint(CPoint point,float m_jwm,CPoint scroll)
{	
	
	int temp = (int)(global_STEP*m_jwm);
	CPoint tp;
	point.x +=scroll.x;
	point.y +=scroll.y;


		if((point.x-OFFSET)%global_STEP ==0)
			point.x++;
		tp.x = (point.x-OFFSET)/global_STEP;



	
		if((point.y - OFFSET)/temp == 0 )
			point.y++;
		tp.y = (long)((point.y -OFFSET)/(temp));

	return tp;
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -