📄 pixel.cpp
字号:
// Pixel.cpp : Implementation of CPixel
#include "stdafx.h"
#include "Picture.h"
#include "Pixel.h"
/////////////////////////////////////////////////////////////////////////////
// CPixel
STDMETHODIMP CPixel::get_Color(baseColors *pVal)
{
*pVal = m_color;
return S_OK;
}
STDMETHODIMP CPixel::put_Color(baseColors newVal)
{
HRESULT hr = S_OK;
// Test if the new color is valid or not
if (newVal < 0 || newVal > 15)
return AtlReportError(CLSID_Pixel, IDS_BAD_COLOR,
IID_IPixel, 0, _Module.GetModuleInstance());
if (SUCCEEDED(hr = IsReadOnly()))
m_color = newVal;
return hr;
}
STDMETHODIMP CPixel::get_Row(long *pVal)
{
*pVal = m_row;
return S_OK;
}
STDMETHODIMP CPixel::put_Row(long newVal)
{
HRESULT hr = S_OK;
if (SUCCEEDED(hr = IsReadOnly()))
m_row = newVal;
return hr;
}
STDMETHODIMP CPixel::get_Column(long *pVal)
{
*pVal = m_col;
return S_OK;
}
STDMETHODIMP CPixel::put_Column(long newVal)
{
HRESULT hr = S_OK;
if (SUCCEEDED(hr = IsReadOnly()))
m_col = newVal;
return hr;
}
HRESULT CPixel::IsReadOnly()
{
// Test if this pixel is in readonly mode
if (m_bReadOnly)
return AtlReportError(CLSID_Pixel, IDS_READONLY_PIXEL,
IID_IPixel, 0, _Module.GetModuleInstance());
else
return S_OK;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -