渐 变
来源:互联网 发布:英国研究生申请 知乎 编辑:程序博客网 时间:2024/06/08 10:58
private:
int ColorR;
int ColorG;
// vcB1View.cpp : implementation of the CVcB1View class
//
#include "stdafx.h"
#include "vcB1.h"
#include "vcB1Doc.h"
#include "vcB1View.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// CVcB1View
IMPLEMENT_DYNCREATE(CVcB1View, CView)
BEGIN_MESSAGE_MAP(CVcB1View, CView)
//{{AFX_MSG_MAP(CVcB1View)
ON_WM_LBUTTONDOWN()
//}}AFX_MSG_MAP
// Standard printing commands
ON_COMMAND(ID_FILE_PRINT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_DIRECT, CView::OnFilePrint)
ON_COMMAND(ID_FILE_PRINT_PREVIEW, CView::OnFilePrintPreview)
END_MESSAGE_MAP()
/////////////////////////////////////////////////////////////////////////////
// CVcB1View construction/destruction
CVcB1View::CVcB1View()
{
// TODO: add construction code here
// TODO: add construction code here
ColorR = 255;
ColorG = 255;
}
CVcB1View::~CVcB1View()
{
}
BOOL CVcB1View::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
return CView::PreCreateWindow(cs);
}
/////////////////////////////////////////////////////////////////////////////
// CVcB1View drawing
void CVcB1View::OnDraw(CDC* pDC)
{
CVcB1Doc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
// TODO: add draw code for native data here
// TODO: add draw code for native data here
CRect m_rcClient;
// file://得到客户区域的填充矩形
GetClientRect(&m_rcClient);
int nWidth = m_rcClient.Width();
int nHeight = m_rcClient.Height();
CRect rectangle;
//file://分割客户区域成小矩形,逐个填充
for(int i = 0;i < nWidth;i++ )
{
rectangle.SetRect(i, 0, i+1, nHeight);
pDC->FillSolidRect(&rectangle, RGB(ColorR, ColorG, 255-MulDiv(i, 255, nWidth)));
}
}
/////////////////////////////////////////////////////////////////////////////
// CVcB1View printing
BOOL CVcB1View::OnPreparePrinting(CPrintInfo* pInfo)
{
// default preparation
return DoPreparePrinting(pInfo);
}
void CVcB1View::OnBeginPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add extra initialization before printing
}
void CVcB1View::OnEndPrinting(CDC* /*pDC*/, CPrintInfo* /*pInfo*/)
{
// TODO: add cleanup after printing
}
/////////////////////////////////////////////////////////////////////////////
// CVcB1View diagnostics
#ifdef _DEBUG
void CVcB1View::AssertValid() const
{
CView::AssertValid();
}
void CVcB1View::Dump(CDumpContext& dc) const
{
CView::Dump(dc);
}
CVcB1Doc* CVcB1View::GetDocument() // non-debug version is inline
{
ASSERT(m_pDocument->IsKindOf(RUNTIME_CLASS(CVcB1Doc)));
return (CVcB1Doc*)m_pDocument;
}
#endif //_DEBUG
/////////////////////////////////////////////////////////////////////////////
// CVcB1View message handlers
void CVcB1View::OnLButtonDown(UINT nFlags, CPoint point)
{
// TODO: Add your message handler code here and/or call default
//生成小于255的随机数,给ColorR和ColorG赋值
int nRand = rand();
float fMap = (float)255/RAND_MAX;
ColorR = (UINT)(float)nRand*fMap + 0.5f;
nRand = rand();
fMap = (float)255/RAND_MAX;
ColorG = (UINT)(float)nRand*fMap + 0.5f;
//更新界面
Invalidate();
CView::OnLButtonDown(nFlags, point);
}
- 渐 变
- 变
- 变
- 变
- 变
- 变
- 变...
- 变
- 变
- 变
- 协变、抗变
- 逆变、协变
- java协变,逆变,不可变
- 广发行重组再生变 花旗渐占星展上风
- 变了
- 思变......
- 变了
- 变了
- android:shape的使用
- qemu调试cortex m3程序
- Java JSplitPane_1
- 【iOS-Cocos2d游戏开发之三】CCScene切换的所有特效(28种)以及设置屏幕横竖屏!
- 傲游3的广告过滤自定义规则【Mark一下】对CSS语法学习还是挺不错了~~可定义站点样式
- 渐 变
- Android layout xml总结
- IOS成长之路-解析xml数据
- 渐变 2
- java string举例说明1
- java string举例说明2
- java string举例说明3
- 对象引用与对象的区别
- java IO举例说明1