本文整理汇总了C++中CSize函数的典型用法代码示例。如果您正苦于以下问题:C++ CSize函数的具体用法?C++ CSize怎么用?C++ CSize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了CSize函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: SetScrollSizes
CScribbleView::CScribbleView()
{
SetScrollSizes(MM_TEXT, CSize(0, 0));
}
示例2: UpdateData
void AusReihe::OnPaint()
{
UpdateData(TRUE);
CPaintDC dc(this); // device context for painting
dc.FillRect(rahmen, &stdbrush.white);
CPen *oldPen = dc.SelectObject(&stdpen.gray1);
if (m_xraster)
{
for (int index = 0; index < DemoData.get_anz_s(); index++)
{
int x = paddingLeft + rahmen.left + (index*(rahmen.Width() - paddingWidth)) / (DemoData.get_anz_s() - 1);
dc.MoveTo(x, rahmen.top + paddingTop);
dc.LineTo(x, rahmen.bottom - paddingBottom);
}
}
if (m_yraster)
{
for (int index = 0; index < anzHorizontalLines; index++)
{
int y = paddingTop + rahmen.top + (index*(rahmen.Height() - paddingHeight)) / (anzHorizontalLines-1);
/*if (y > rahmen.bottom - paddingBottom)
y = rahmen.bottom - paddingBottom;*/
dc.MoveTo(rahmen.left + paddingLeft, y);
dc.LineTo(rahmen.right - paddingRight, y);
}
}
CSize dataRangeHeight, dataRangeWidth, windowRangeHeight, windowRangeWidth;
dataRangeHeight = CSize(DemoData.minimum(m_selection), DemoData.maximum(m_selection));
dataRangeWidth = CSize(0, DemoData.get_anz_s()-1);
//windowRangeHeight = CSize(rahmen.top + 1*paddingTop, rahmen.bottom - 1*paddingBottom);
windowRangeHeight = CSize(paddingTop, rahmen.Height()-paddingHeight);
windowRangeWidth = CSize(rahmen.left + paddingLeft, rahmen.right - 1*paddingRight);
//draw null line
dc.SelectObject(&stdpen.black2);
if ((DemoData.minimum(m_selection) < 0) && (DemoData.maximum(m_selection) > 0))
{
int nullLine = rahmen.bottom-scalePoint(0, &dataRangeHeight, &windowRangeHeight);
dc.MoveTo(rahmen.left + paddingLeft, nullLine);
dc.LineTo(rahmen.right - paddingRight, nullLine);
}
if (m_darstellung == 0)
{
CPoint oldP, newP;
oldP = CPoint(
scalePoint(0, &dataRangeWidth, &windowRangeWidth),
rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, 0), &dataRangeHeight, &windowRangeHeight)
);
dc.MoveTo(oldP);
for (int index = 0; index < DemoData.get_anz_s(); index++)
{
dc.SelectObject(&stdpen.black5);
newP = CPoint(
scalePoint(index, &dataRangeWidth, &windowRangeWidth),
rahmen.bottom -scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight)
);
dc.LineTo(newP);
dc.SelectObject(&stdpen.gray3);
dc.MoveTo(oldP);
dc.LineTo(newP);
oldP = newP;
}
//draw the points
dc.SelectObject(&stdbrush.gray);
dc.SelectObject(&stdpen.black1);
for (int index = 0; index < DemoData.get_anz_s(); index++)
{
CPoint loc = CPoint(
scalePoint(index, &dataRangeWidth, &windowRangeWidth),
rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight)
);
dc.Ellipse(loc.x - 5, loc.y - 5, loc.x + 5, loc.y + 5);
}
}
else
{
dc.SelectObject(&stdbrush.gray);
dc.SelectObject(&stdpen.black1);
for (int index = 0; index < DemoData.get_anz_s(); index++)
{
int loc = scalePoint(index, &dataRangeWidth, &windowRangeWidth);
//dc.Rectangle(loc - 5, rahmen.bottom - scalePoint(0, &dataRangeHeight, &windowRangeHeight), loc + 5, rahmen.bottom - paddingBottom + nullLine - scalePoint(DemoData.get_wert(m_selection, index), &CSize(DemoData.minimum(m_selection), DemoData.maximum(m_selection)), &CSize(0, rahmen.Height() - paddingHeight)));
dc.Rectangle(loc, rahmen.bottom - scalePoint(0, &dataRangeHeight, &windowRangeHeight), loc + 10, rahmen.bottom - scalePoint(DemoData.get_wert(m_selection, index), &dataRangeHeight, &windowRangeHeight));
}
}
//Draw all Selected
dc.SelectObject(&stdfont.norm);
dc.SelectObject(&stdpen.black1);
dc.SelectObject(&stdbrush.yellow);
dc.SetBkMode(TRANSPARENT);
for (int index = 0; index < DemoData.get_anz_s(); index++)
{
if (infoflag[index])
{
CPoint loc = CPoint(
//.........这里部分代码省略.........
示例3: dc
// Works out an appropriate size and position of this window
void CColorPopup::SetWindowSize()
{
CSize TextSize;
// If we are showing a custom or default text area, get the font and text size.
if (m_strCustomText.GetLength() || m_strDefaultText.GetLength())
{
CClientDC dc(this);
CFont* pOldFont = (CFont*) dc.SelectObject(&m_Font);
// Get the size of the custom text (if there IS custom text)
TextSize = CSize(0,0);
if (m_strCustomText.GetLength())
TextSize = dc.GetTextExtent(m_strCustomText);
// Get the size of the default text (if there IS default text)
if (m_strDefaultText.GetLength())
{
CSize DefaultSize = dc.GetTextExtent(m_strDefaultText);
if (DefaultSize.cx > TextSize.cx) TextSize.cx = DefaultSize.cx;
if (DefaultSize.cy > TextSize.cy) TextSize.cy = DefaultSize.cy;
}
dc.SelectObject(pOldFont);
TextSize += CSize(2*m_nMargin,2*m_nMargin);
// Add even more space to draw the horizontal line
TextSize.cy += 2*m_nMargin + 2;
}
// Get the number of columns and rows
//m_nNumColumns = (int) sqrt((double)m_nNumColors); // for a square window (yuk)
m_nNumColumns = 8;
m_nNumRows = m_nNumColors / m_nNumColumns;
if (m_nNumColors % m_nNumColumns) m_nNumRows++;
// Get the current window position, and set the new size
CRect rect;
GetWindowRect(rect);
m_WindowRect.SetRect(rect.left, rect.top,
rect.left + m_nNumColumns*m_nBoxSize + 2*m_nMargin,
rect.top + m_nNumRows*m_nBoxSize + 2*m_nMargin);
// if custom text, then expand window if necessary, and set text width as
// window width
if (m_strDefaultText.GetLength())
{
if (TextSize.cx > m_WindowRect.Width())
m_WindowRect.right = m_WindowRect.left + TextSize.cx;
TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
// Work out the text area
m_DefaultTextRect.SetRect(m_nMargin, m_nMargin,
m_nMargin+TextSize.cx, 2*m_nMargin+TextSize.cy);
m_WindowRect.bottom += m_DefaultTextRect.Height() + 2*m_nMargin;
}
// if custom text, then expand window if necessary, and set text width as
// window width
if (m_strCustomText.GetLength())
{
if (TextSize.cx > m_WindowRect.Width())
m_WindowRect.right = m_WindowRect.left + TextSize.cx;
TextSize.cx = m_WindowRect.Width()-2*m_nMargin;
// Work out the text area
m_CustomTextRect.SetRect(m_nMargin, m_WindowRect.Height(),
m_nMargin+TextSize.cx,
m_WindowRect.Height()+m_nMargin+TextSize.cy);
m_WindowRect.bottom += m_CustomTextRect.Height() + 2*m_nMargin;
}
// Need to check it'll fit on screen: Too far right?
CSize ScreenSize(::GetSystemMetrics(SM_CXSCREEN), ::GetSystemMetrics(SM_CYSCREEN));
if (m_WindowRect.right > ScreenSize.cx)
m_WindowRect.OffsetRect(-(m_WindowRect.right - ScreenSize.cx), 0);
// Too far left?
if (m_WindowRect.left < 0)
m_WindowRect.OffsetRect( -m_WindowRect.left, 0);
// Bottom falling out of screen?
if (m_WindowRect.bottom > ScreenSize.cy)
{
CRect ParentRect;
m_pParent->GetWindowRect(ParentRect);
m_WindowRect.OffsetRect(0, -(ParentRect.Height() + m_WindowRect.Height()));
}
// Set the window size and position
MoveWindow(m_WindowRect, TRUE);
}
示例4: switch
void CMainFrame::SwitchView(ViewType nType)
{
CView* pOldView=(CView*)m_wndSplit[3]->GetPane(0,1);
CCreateContext context;
context.m_pCurrentDoc=pOldView->GetDocument();
pOldView->ShowWindow(SW_HIDE);
switch(nType)
{
case COLORCONVERT:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdColor),CSize(0,0),&context);
((CCmdColor*)GetControlView())->OnInitialUpdate();
break;
case FILTERING:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFilter),CSize(0,0),&context);
((CCmdFilter*)GetControlView())->OnInitialUpdate();
break;
case FOURIER:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFourier),CSize(0,0),&context);
((CCmdFourier*)GetControlView())->OnInitialUpdate();
break;
case PROJ:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdProjExt),CSize(0,0),&context);
((CCmdProjExt*)GetControlView())->OnInitialUpdate();
break;
case BLOB:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdBlob),CSize(0,0),&context);
((CCmdBlob*)GetControlView())->OnInitialUpdate();
break;
case COORD:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdCoord),CSize(0,0),&context);
((CCmdCoord*)GetControlView())->OnInitialUpdate();
break;
case GEO:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdGF),CSize(0,0),&context);
((CCmdGF*)GetControlView())->OnInitialUpdate();
break;
case STAT:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdSF),CSize(0,0),&context);
((CCmdSF*)GetControlView())->OnInitialUpdate();
break;
case TEMP:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdTM),CSize(0,0),&context);
((CCmdTM*)GetControlView())->OnInitialUpdate();
break;
case TH:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdTh),CSize(0,0),&context);
((CCmdTh*)GetControlView())->OnInitialUpdate();
break;
case VER:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdVer),CSize(0,0),&context);
((CCmdVer*)GetControlView())->OnInitialUpdate();
break;
case ALU:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdAlu),CSize(0,0),&context);
((CCmdAlu*)GetControlView())->OnInitialUpdate();
break;
case FMMNN:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFMMNN),CSize(0,0),&context);
((CCmdFMMNN*)GetControlView())->OnInitialUpdate();
break;
case FNN:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdFNN),CSize(0,0),&context);
((CCmdFNN*)GetControlView())->OnInitialUpdate();
break;
case NN:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdNN),CSize(0,0),&context);
((CCmdNN*)GetControlView())->OnInitialUpdate();
break;
case EIGEN:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdEigen),CSize(0,0),&context);
((CCmdEigen*)GetControlView())->OnInitialUpdate();
break;
case MOTION:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdMotion),CSize(0,0),&context);
((CCmdMotion*)GetControlView())->OnInitialUpdate();
break;
case DEPTH:
m_wndSplit[3]->DeleteView(0,1);
m_wndSplit[3]->CreateView(0,1,RUNTIME_CLASS(CCmdDepth),CSize(0,0),&context);
((CCmdDepth*)GetControlView())->OnInitialUpdate();
break;
//.........这里部分代码省略.........
示例5: CSize
void CBCGPRecentFilesListBox::OnDrawItemContent(CDC* pDC, CRect rect, int nIndex)
{
if (IsSeparatorItem(nIndex))
{
CBCGPListBox::OnDrawItemContent(pDC, rect, nIndex);
return;
}
if (nIndex >= 0 && nIndex < m_arIcons.GetSize())
{
HICON hIcon = m_arIcons[nIndex];
if (hIcon != NULL)
{
CSize sizeIcon = CSize (32, 32);
if (globalData.GetRibbonImageScale () != 1.)
{
sizeIcon.cx = (int) (.5 + globalData.GetRibbonImageScale () * sizeIcon.cx);
sizeIcon.cy = (int) (.5 + globalData.GetRibbonImageScale () * sizeIcon.cy);
}
::DrawIconEx (pDC->GetSafeHdc (),
rect.left + 3,
rect.top + max(0, (rect.Height() - sizeIcon.cy) / 2),
hIcon, sizeIcon.cx, sizeIcon.cy, 0, NULL,
DI_NORMAL);
rect.left += sizeIcon.cx + 1;
}
}
CRect rectText = rect;
rectText.DeflateRect (10, 0);
CString strText;
GetText (nIndex, strText);
int nPathIndex = strText.Find(_T("\n"));
if (nPathIndex < 0)
{
pDC->DrawText (strText, rectText, DT_LEFT);
}
else
{
CString strName = strText.Left(nPathIndex);
CString strPath = strText.Mid(nPathIndex + 1);
const int nMargin = max(0, (rectText.Height() - pDC->GetTextExtent(strName).cy - pDC->GetTextExtent(strPath).cy) / 3);
UINT uiDTFlags = DT_SINGLELINE | DT_END_ELLIPSIS;
CFont* pOldFont = pDC->SelectObject (&globalData.fontBold);
ASSERT (pOldFont != NULL);
rectText.top += nMargin;
int nTextHeight = pDC->DrawText(strName, rectText, uiDTFlags);
pDC->SelectObject (pOldFont);
rectText.top += nTextHeight + nMargin;
pDC->DrawText(strPath, rectText, uiDTFlags);
}
}
示例6: m_FirstPoint
CSketcherView::CSketcherView(): m_FirstPoint(CPoint(0,0)), m_SecondPoint(CPoint(0,0)), m_pTempElement(nullptr), m_pSelected(nullptr), m_MoveMode(false), m_CursorPos(CPoint(0,0)), m_FirstPos(CPoint(0,0)), m_Scale(1)
{
SetScrollSizes(MM_TEXT, CSize(0,0)); // Set arbitrary scrollers
}
示例7: OnGetSizeInfo
//////////////////
// Get size information for a single entry (WINRECT). Returns size info in
// the SIZEINFO argument. For a group, calculate size info as aggregate of
// subentries.
//
void CWinMgr::OnGetSizeInfo(SIZEINFO& szi, WINRECT* wrc, CWnd* pWnd)
{
szi.szMin = SIZEZERO; // default min size = zero
szi.szMax = SIZEMAX; // default max size = infinite
szi.szDesired = wrc->GetRect().Size(); // default desired size = current
if (wrc->IsGroup()) {
// For groups, calculate min, max, desired size as aggregate of children
szi.szDesired = SIZEZERO;
BOOL bRow = wrc->IsRowGroup();
CWinGroupIterator it;
for (it=wrc; it; it.Next()) {
WINRECT* wrc2 = it;
SIZEINFO szi2;
OnGetSizeInfo(szi2, wrc2, pWnd);
if (bRow) {
szi.szMin.cx = max(szi.szMin.cx, szi2.szMin.cx);
szi.szMin.cy += szi2.szMin.cy;
szi.szMax.cx = min(szi.szMax.cx, szi2.szMax.cx);
szi.szMax.cy = min(szi.szMax.cy + szi2.szMax.cy, INFINITY);
szi.szDesired.cx = max(szi.szDesired.cx, szi2.szDesired.cx);
szi.szDesired.cy += szi2.szDesired.cy;
} else {
szi.szMin.cx += szi2.szMin.cx;
szi.szMin.cy = max(szi.szMin.cy, szi2.szMin.cy);
szi.szMax.cx = min(szi.szMax.cx + szi2.szMax.cx, INFINITY);
szi.szMax.cy = min(szi.szMax.cy, szi2.szMax.cy);
szi.szDesired.cx += szi2.szDesired.cx;
szi.szDesired.cy = max(szi.szDesired.cy, szi2.szDesired.cy);
}
}
// Add margins.
int w2,h2;
wrc->GetMargins(w2,h2); // get margins
w2<<=1; h2<<=1; // double
szi.szMin.cx += max(0,w2); // negative margins ==> don't include in min
szi.szMin.cy += max(0,h2); // ditto
szi.szDesired.cx += abs(w2); // for desired size, use abs vallue
szi.szDesired.cy += abs(h2); // ditto
} else {
// not a group
WINRECT* parent = wrc->Parent();
ASSERT(parent);
CRect& rcParent = parent->GetRect();
BOOL bRow = parent->IsRowGroup();
int hw, hwMin, hwTotal, pct;
switch (wrc->Type()) {
case WRCT_FIXED:
hw = hwMin = wrc->GetParam(); // ht/wid is parameter
if (hw<0) { // if fixed val is negative:
hw = -hw; // use absolute val for desired..
hwMin = 0; // ..and zero for minimum
}
if (bRow) {
szi.szMax.cy = szi.szDesired.cy = hw;
szi.szMin.cy = hwMin;
} else {
szi.szMax.cx = szi.szDesired.cx = hw;
szi.szMin.cx = hwMin;
}
break;
case WRCT_PCT:
pct = wrc->GetParam();
ASSERT(0<pct && pct<100);
hwTotal = bRow ? rcParent.Height() : rcParent.Width();
hw = (hwTotal * pct) / 100;
szi.szDesired = bRow ? CSize(rcParent.Width(), hw) :
CSize(hw, rcParent.Height());
break;
case WRCT_TOFIT:
if (wrc->HasToFitSize()) {
szi.szDesired = wrc->GetToFitSize();
}
break;
case WRCT_REST:
break;
default:
ASSERT(FALSE);
}
// If the entry is a window, send message to get min/max/tofit size.
// Only set tofit size if type is TOFIT.
//
if (wrc->IsWindow() && pWnd) {
CWnd* pChild = pWnd->GetDlgItem(wrc->GetID());
if (pChild) {
//.........这里部分代码省略.........
示例8: size
void ImageProcessorDlg::Impl::test(ViewPane& view)
{
#if 0
CImageDecoderPtr d= photos_[0]->GetDecoder();
Dib bmp;
CSize size(500,500);
if (d->DecodeImg(bmp, size, false) != IS_OK)
return;
size = CSize(bmp.GetWidth(), bmp.GetHeight());
ExceptionInfo exc;
GetExceptionInfo(&exc);
Image* img= ConstituteImage(bmp.GetWidth(), bmp.GetHeight(), "RGB", CharPixel, bmp.GetBuffer(), &exc);
if (img)
{
double radius= 10.0;
double sigma= 1.0;
double amount= 1.0;
double threshold= 0.01;
// Image* sharp= UnsharpMaskImage(img, radius, sigma, amount, threshold, &exc);
int w= size.cy * 16 / 9;
Image* sharp= LiquidRescaleImage(img, w, size.cy, 1.0, 0.0, &exc);
if (sharp)
{
//ImageInfo ii;
//GetImageInfo(&ii);
//strcpy(sharp->filename, "c:\\sharp.img");
size.cx = sharp->columns;
size.cy = sharp->rows;
const PixelPacket* pix= AcquireImagePixels(sharp, 0, 0, size.cx, size.cy, &exc);
Dib b(size.cx, size.cy, 24);
for (int y= size.cy - 1; y >= 0; --y)
{
BYTE* line= b.LineBuffer(y);
for (int x= 0; x < size.cx; ++x)
{
line[0] = pix->red;
line[1] = pix->green;
line[2] = pix->blue;
line += 3;
pix++;
}
}
b.Swap(bmp);
DestroyImage(sharp);
}
DestroyImage(img);
}
view.DisplayBitmap(bmp);
bmp.Save(L"c:\\resized.bmp");
#endif
}
示例9: CSize
////////////////////////////////////////////////////////////////////////////////
//
// FUNCTION: GetSize
//
// DESCRIPTION: Returns Width and Height object
//
// RETURNS:
//
// NOTES:
//
// MODIFICATIONS:
//
// Name Date Version Comments
// N T ALMOND 29012002 1.0 Origin
//
////////////////////////////////////////////////////////////////////////////////
CSize ImageEx::GetSize()
{
return CSize(GetWidth(), GetHeight());
}
示例10: CSize
DWORD CmdDrawZoom::CmdDrawAjustZooming::SetPoint(DWORD MouseAction, CPoint pt)
{
CmdDrawZoom *p = dynamic_cast<CmdDrawZoom*>(m_pOwner);
if (enCmdMouseNone == MouseAction)
{
LP_MATERIALINFO pTempInfo = p->m_pReceiver->getComicStripData()->getSelectedInfo();
if (NULL == pTempInfo)
{
return FALSE;
}
CSize size = CSize(pt.x - pTempInfo->GetLTPoint().x, pt.y - pTempInfo->GetLTPoint().y);
size.cx = max(size.cx, 24);
size.cy = max(size.cy, 24);
pTempInfo->SetFinalSize(size);
if (pTempInfo->isPenDraw) {
int width = pTempInfo->m_image.GetWidth();
int height = pTempInfo->m_image.GetHeight();
if (width<size.cx || height<size.cy)
{
int newWidth = max(width, size.cx);
int newHeight = max(height, size.cy);
CxImage tempImage = pTempInfo->m_image;
pTempInfo->m_image.Create(newWidth, newHeight, 24, CXIMAGE_FORMAT_PNG);
RGBQUAD rgb = pTempInfo->m_image.GetPixelColor(1,1);
pTempInfo->m_image.SetTransIndex(0);
pTempInfo->m_image.SetTransColor(rgb);
HDC memdcOrg = CreateCompatibleDC(NULL);
HBITMAP hbitmapOrg = tempImage.MakeBitmap();
HGDIOBJ pOldGDIOBJOrg = SelectObject(memdcOrg, hbitmapOrg);
HDC memdc = CreateCompatibleDC(NULL);
HBITMAP hbitmap = pTempInfo->m_image.MakeBitmap();
HGDIOBJ pOldGDIOBJ = SelectObject(memdc, hbitmap);
BitBlt(memdc, 0, 0, width, height, memdcOrg, 0, 0, SRCCOPY);
pTempInfo->m_image.CreateFromHBITMAP(hbitmap);
SelectObject(memdc, pOldGDIOBJ);
DeleteObject(hbitmap);
DeleteDC(memdc);
SelectObject(memdcOrg, pOldGDIOBJOrg);
DeleteObject(hbitmapOrg);
DeleteDC(memdcOrg);
}
}
p->m_pReceiver->UpdateComicStrip(pTempInfo->nIDOwner);
}
else if (enCmdMouseLUp == MouseAction)
{
LP_MATERIALINFO pTempInfo = p->m_pReceiver->getComicStripData()->getSelectedInfo();
if (NULL == pTempInfo)
{
return FALSE;
}
CSize size = CSize(pt.x - pTempInfo->GetLTPoint().x, pt.y - pTempInfo->GetLTPoint().y);
size.cx = max(size.cx, 24);
size.cy = max(size.cy, 24);
pTempInfo->SetFinalSize(size);
if (pTempInfo->isPenDraw) {
int width = pTempInfo->m_image.GetWidth();
int height = pTempInfo->m_image.GetHeight();
if (width<size.cx || height<size.cy)
{
CxImage tempImage = pTempInfo->m_image;
pTempInfo->m_image.Create(size.cx, size.cy, 24, CXIMAGE_FORMAT_PNG);
RGBQUAD rgb = pTempInfo->m_image.GetPixelColor(1,1);
pTempInfo->m_image.SetTransIndex(0);
pTempInfo->m_image.SetTransColor(rgb);
HDC memdcOrg = CreateCompatibleDC(NULL);
HBITMAP hbitmapOrg = tempImage.MakeBitmap();
HGDIOBJ pOldGDIOBJOrg = SelectObject(memdcOrg, hbitmapOrg);
HDC memdc = CreateCompatibleDC(NULL);
HBITMAP hbitmap = pTempInfo->m_image.MakeBitmap();
HGDIOBJ pOldGDIOBJ = SelectObject(memdc, hbitmap);
BitBlt(memdc, 0, 0, width, height, memdcOrg, 0, 0, SRCCOPY);
pTempInfo->m_image.CreateFromHBITMAP(hbitmap);
SelectObject(memdc, pOldGDIOBJ);
DeleteObject(hbitmap);
DeleteDC(memdc);
SelectObject(memdcOrg, pOldGDIOBJOrg);
DeleteObject(hbitmapOrg);
DeleteDC(memdcOrg);
}
}
p->m_pReceiver->SaveFile();
p->m_pReceiver->UpdateComicStrip(pTempInfo->nIDOwner);
p->m_pDsState = &p->m_dsZoomBgn;
p->m_pReceiver->SetCursor();
p->m_nDrawState = enDrawIdle;
}
return TRUE;
}
示例11: sizeof
BOOL CSplash::OnInitDialog()
{
CDialog::OnInitDialog();
CString strFileName;
strFileName.Format("%s",LoginInformation.path);
strFileName+="splash.bmp";
hbmp = (HBITMAP)::LoadImage(AfxGetInstanceHandle(), \
strFileName, IMAGE_BITMAP, 0, 0, LR_CREATEDIBSECTION|LR_LOADFROMFILE);
////////////////////该断程序用来取得加载的BMP的信息////////////////////////
m_bitmap.Attach( hbmp );
// DIBSECTION ds;
// BITMAPINFOHEADER &bminfo = ds.dsBmih;
m_bitmap.GetObject( sizeof(BITMAP), &bmp );
// TODO: Add extra initialization here
/* m_bitmap.LoadBitmap(IDB_BITMAP_SPLASH);
BITMAP bmp;
m_bitmap.GetObject(sizeof(BITMAP),&bmp);
*/
CRect rtOld,rtProgress;
GetWindowRect(rtOld);
CPoint point = rtOld.TopLeft();//pl(bmp.bmWidth-100,bmp.bmHeight-50),pr(bmp.bmWidth-10,bmp.bmHeight-20);
CRect rtNew = CRect(point,CSize(bmp.bmWidth,bmp.bmHeight));
MoveWindow(rtNew);
//调整流动条控件位置
rtProgress.left=20;
rtProgress.top=bmp.bmHeight-52;
rtProgress.right=bmp.bmWidth-20;
rtProgress.bottom=rtProgress.top+30;
m_progress.MoveWindow(rtProgress);
::SetWindowPos(GetSafeHwnd() , HWND_TOPMOST , rtNew.left ,rtNew.top , rtNew.Width() , rtNew.Height(), SWP_NOSIZE );
CenterWindow();
AnimateWindow(m_hWnd,300,AW_SLIDE|AW_CENTER);
Invalidate();
// DWORD pid;
// ::CreateThread(NULL,NULL,::ConnectData,(LPVOID)this,0,&pid);
// ::CreateThread(NULL,NULL,Schedule,(LPVOID)this,0,&pid);
// UINT connectData(LPVOID);
AfxBeginThread(ConnectData,(LPVOID)this);
AfxBeginThread(Schedule,(LPVOID)this);
return TRUE; // return TRUE unless you set the focus to a control
// EXCEPTION: OCX Property Pages should return FALSE
}
示例12: SetTimer
void CShaderEdit::OnUpdate()
{
if (m_nIDEvent == (UINT_PTR)-1) {
m_nIDEvent = SetTimer(1, 100, NULL);
}
CString text;
int nStartChar = 0, nEndChar = -1;
GetSel(nStartChar, nEndChar);
if (nStartChar == nEndChar) {
GetWindowText(text);
while (nStartChar > 0 && _istalnum(text.GetAt(nStartChar-1))) {
nStartChar--;
}
}
if (nStartChar < nEndChar) {
text = text.Mid(nStartChar, nEndChar - nStartChar);
text.TrimRight('(');
text.MakeLower();
m_acdlg.m_list.ResetContent();
CString key, value;
POSITION pos = m_acdlg.m_inst.GetStartPosition();
while (pos) {
POSITION cur = pos;
m_acdlg.m_inst.GetNextAssoc(pos, key, value);
if (key.Find(text) == 0) {
CAtlList<CString> sl;
Explode(value, sl, '|', 2);
if (sl.GetCount() != 2) {
continue;
}
CString name = sl.RemoveHead();
CString description = sl.RemoveHead();
int i = m_acdlg.m_list.AddString(name);
m_acdlg.m_list.SetItemDataPtr(i, cur);
}
}
if (m_acdlg.m_list.GetCount() > 0) {
int lineheight = GetLineHeight();
CPoint p = PosFromChar(nStartChar);
p.y += lineheight;
ClientToScreen(&p);
CRect r(p, CSize(100, 100));
m_acdlg.MoveWindow(r);
m_acdlg.SetWindowPos(&wndTopMost, 0, 0, 0, 0, SWP_NOMOVE|SWP_NOSIZE|SWP_NOACTIVATE);
m_acdlg.ShowWindow(SW_SHOWNOACTIVATE);
m_nEndChar = nEndChar;
return;
}
}
m_acdlg.ShowWindow(SW_HIDE);
}
示例13: Assert
DWORD CRichtextLayout::CalcSize(CCalcInfo* pci, SIZE* psize, SIZE* psizeDefault)
{
Assert(ElementOwner());
Assert(pci);
Assert(psize);
CScopeFlag csfCalcing(this);
CRichtext* pTextarea = DYNCAST(CRichtext, ElementOwner());
Listen();
CSaveCalcInfo sci(pci, this);
CSize sizeOriginal;
DWORD grfReturn;
GetSize(&sizeOriginal);
if(_fForceLayout)
{
pci->_grfLayout |= LAYOUT_FORCE;
_fForceLayout = FALSE;
}
grfReturn = (pci->_grfLayout & LAYOUT_FORCE);
if(pci->_grfLayout & LAYOUT_FORCE)
{
_fSizeThis = TRUE;
_fAutoBelow = FALSE;
_fPositionSet = FALSE;
_fContainsRelative = FALSE;
}
BOOL fRecalcText = FALSE;
BOOL fNormalMode = pci->_smMode==SIZEMODE_NATURAL ||
pci->_smMode==SIZEMODE_SET ||
pci->_smMode==SIZEMODE_FULLSIZE;
BOOL fWidthChanged = (fNormalMode ? psize->cx!=sizeOriginal.cx : FALSE);
BOOL fHeightChanged = (fNormalMode ? psize->cy!=sizeOriginal.cy : FALSE);
fRecalcText = (fNormalMode && (IsDirty()
|| _fSizeThis
|| fWidthChanged
|| fHeightChanged))
|| (pci->_grfLayout&LAYOUT_FORCE)
|| (pci->_smMode==SIZEMODE_MMWIDTH && !_fMinMaxValid)
|| (pci->_smMode==SIZEMODE_MINWIDTH && (!_fMinMaxValid || _xMin<0));
// If this site is in need of sizing, then size it
if(fRecalcText)
{
//BUGBUG (gideons) should modify Cols and Rows if user resizes
CUnitValue uvWidth = pTextarea->GetFirstBranch()->GetCascadedwidth();
CUnitValue uvHeight = pTextarea->GetFirstBranch()->GetCascadedheight();
int charX = 1;
int charY = 1;
// If dirty, ensure display tree nodes exist
if(_fSizeThis && (EnsureDispNode(pci, (grfReturn&LAYOUT_FORCE))==S_FALSE))
{
grfReturn |= LAYOUT_HRESIZE | LAYOUT_VRESIZE;
}
SetWrap();
_fContentsAffectSize = FALSE;
if(uvWidth.IsNullOrEnum() || uvHeight.IsNullOrEnum())
{
charX = pTextarea->GetAAcols();
Assert(charX > 0);
charY = pTextarea->GetAArows();
Assert(charY > 0);
}
grfReturn |= CalcSizeHelper(pci, charX, charY, psize);
if(fNormalMode)
{
grfReturn |= super::CalcSize(pci, psize);
}
if(psizeDefault)
{
*psizeDefault = *psize;
}
// If size changes occurred, size the display nodes
if(fNormalMode && grfReturn&(LAYOUT_FORCE|LAYOUT_HRESIZE|LAYOUT_VRESIZE))
{
SizeDispNode(pci, *psize);
SizeContentDispNode(CSize(_dp.GetMaxWidth(), _dp.GetHeight()));
}
if(pci->_smMode == SIZEMODE_MMWIDTH)
{
// for minmax mode min width is returned in cy.
_xMin = psize->cy = psize->cx;
}
}
//.........这里部分代码省略.........
示例14: ASSERT_VALID
//******************************************************************************
void CBCGPRibbonLabel::OnCalcTextSize (CDC* pDC)
{
ASSERT_VALID (this);
ASSERT_VALID (pDC);
if (IsMenuMode () || m_bIsPaletteGroup || !m_bIsAlwaysLarge)
{
CFont* pOldFont = NULL;
if (IsMenuMode () || m_bIsPaletteGroup)
{
pOldFont = pDC->SelectObject (&globalData.fontBold);
ASSERT_VALID (pOldFont);
}
CBCGPRibbonButton::OnCalcTextSize (pDC);
if (pOldFont != NULL)
{
pDC->SelectObject (pOldFont);
}
return;
}
//------------------
// Multi-line label:
//------------------
ASSERT_VALID (m_pParent);
const CSize sizeImageLarge = m_pParent->GetImageSize (TRUE);
if (sizeImageLarge == CSize (0, 0))
{
ASSERT (FALSE);
return;
}
const int nMaxHeight = 2 * sizeImageLarge.cy;
int nTextHeight = 0;
int nTextWidth = 0;
CString strText = m_strText;
for (int dx = 10; dx < 200; dx += 10)
{
CRect rectText (0, 0, dx, 10000);
nTextHeight = pDC->DrawText (strText, rectText,
DT_WORDBREAK | DT_CALCRECT);
nTextWidth = rectText.Width ();
if (nTextHeight <= nMaxHeight && nTextWidth >= nTextHeight)
{
break;
}
}
m_sizeTextRight.cx = nTextWidth;
m_sizeTextRight.cy = nTextHeight;
}
示例15: CSize
void CMainFrame::InitializeRibbon()
{
CString strTemp;
strTemp.LoadString(IDS_RIBBON_FILE);
// Load panel images:
m_PanelImages.SetImageSize(CSize(16, 16));
m_PanelImages.Load(IDB_BUTTONS);
// Init main button:
m_MainButton.SetImage(IDB_MAIN_AMT);
m_MainButton.SetText(_T("\nf"));
m_MainButton.SetToolTipText(strTemp);
m_wndRibbonBar.SetApplicationButton(&m_MainButton, CSize (45, 45));
CMFCRibbonMainPanel* pMainPanel = m_wndRibbonBar.AddMainCategory(strTemp, IDB_AMT_FILESMALL, IDB_AMT_FILELARGE);
strTemp.LoadString(IDS_RIBBON_NEW);
pMainPanel->Add(new CMFCRibbonButton(ID_EDIT_REFRESH, _T("Refresh\nr"), 25, 14));
pMainPanel->Add(new CMFCRibbonSeparator(TRUE));
strTemp.LoadString(IDS_RIBBON_PRINT);
CMFCRibbonButton* pBtnPrint = new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 6, 6);
pBtnPrint->SetKeys(_T("p"), _T("w"));
strTemp.LoadString(IDS_RIBBON_PRINT_LABEL);
pBtnPrint->AddSubItem(new CMFCRibbonLabel(strTemp));
strTemp.LoadString(IDS_RIBBON_PRINT);
pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT, strTemp, 7, 7, TRUE));
strTemp.LoadString(IDS_RIBBON_PRINT_SETUP);
pBtnPrint->AddSubItem(new CMFCRibbonButton(ID_FILE_PRINT_SETUP, strTemp, 11, 11, TRUE));
pMainPanel->Add(pBtnPrint);
pMainPanel->Add(new CMFCRibbonSeparator(TRUE));
pMainPanel->Add(new CMFCRibbonButton(ID_FILE_LOGOUT, _T("&Logout"), 0, 0, TRUE));
//pMainPanel->Add(new CMFCRibbonSeparator(TRUE));
//strTemp.LoadString(IDS_RIBBON_CLOSE);
//pMainPanel->Add(new CMFCRibbonButton(ID_FILE_CLOSE, strTemp, 9, 9));
strTemp.LoadString(IDS_RIBBON_RECENT_DOCS);
pMainPanel->AddRecentFilesList(strTemp);
strTemp.LoadString(IDS_RIBBON_EXIT);
pMainPanel->AddToBottom(new CMFCRibbonMainPanelButton(ID_APP_EXIT, strTemp, 15));
// Add "Home" category with "Clipboard" panel:
strTemp.LoadString(IDS_RIBBON_HOME);
CMFCRibbonCategory* pCategoryHome = m_wndRibbonBar.AddCategory(strTemp, IDB_AMT_WRITESMALL, IDB_AMT_WRITELARGE);
// Create "Clipboard" panel:
strTemp.LoadString(IDS_RIBBON_CLIPBOARD);
CMFCRibbonPanel* pPanelClipboard = pCategoryHome->AddPanel(strTemp, m_PanelImages.ExtractIcon(27));
strTemp.LoadString(IDS_RIBBON_PASTE);
CMFCRibbonButton* pBtnPaste = new CMFCRibbonButton(ID_EDIT_PASTE, strTemp, 0, 0);
pPanelClipboard->Add(pBtnPaste);
strTemp.LoadString(IDS_RIBBON_CUT);
pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_CUT, strTemp, 1));
strTemp.LoadString(IDS_RIBBON_COPY);
pPanelClipboard->Add(new CMFCRibbonButton(ID_EDIT_COPY, strTemp, 2));
// Create "Filter" panel:
CMFCRibbonPanel* pPanelFilter = pCategoryHome->AddPanel(_T("Filter"));
pPanelFilter->Add(new CMFCRibbonButton(ID_EDIT_SHOW_ALL, _T("Show All\ns"), 16));
pPanelFilter->AddSeparator();
pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_ORPHANS, _T("Show Orphans\no")));
pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_NOT_MATCHING, _T("Show Differences\nd")));
pPanelFilter->Add(new CMFCRibbonCheckBox(ID_EDIT_SHOW_MATCHING, _T("Show Matching\nm")));
CMFCRibbonPanel* pPanelSelection = pCategoryHome->AddPanel(_T("Selection"));
strTemp.LoadString(IDS_RIBBON_SELECTALL);
pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_SELECT_ALL, strTemp, 21));
pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_CLEARALL, _T("Clear All\na"), 22));
pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_EXPANDALL, _T("Expand All"), 23));
pPanelSelection->AddSeparator();
pPanelSelection->Add(new CMFCRibbonButton(ID_EDIT_ADDTOREP, _T("Migrate\nm"), 14));
CMFCRibbonPanel* pPanelView = pCategoryHome->AddPanel(_T("View"));
pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_CRLF, _T("CR/LF")));
pPanelView->Add(new CMFCRibbonCheckBox(ID_VIEW_WHITESPACE, _T("Whitespace")));
CMFCRibbonPanel* pPanelDiferences = pCategoryHome->AddPanel(_T("Differences"));
pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_PREVIOUS, _T("Previous\nn")));
pPanelDiferences->Add(new CMFCRibbonButton(ID_DIFFERENCES_NEXT, _T("Next\np")));
CMFCRibbonPanel* pPanelDependees = pCategoryHome->AddPanel(_T("Dependees"));
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_FINDSERVICES, _T("Find Services")));
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATEDEPENDENCIES, _T("Recalculate Cache")));
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_CALCULATECROSSREFERENCE, _T("Calculate Crossreference")));
pPanelDependees->AddSeparator();
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCFROMSELECTION, _T("Sync From Selection")));
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_SYNCTOSELECTION, _T("Sync To Selection")));
pPanelDependees->Add(new CMFCRibbonButton(ID_DEPENDEES_COPYCROSSREFERENCE, _T("Copy Crossreference")));
// Add elements to the right side of tabs:
strTemp.LoadString(IDS_RIBBON_STYLE);
CMFCRibbonButton* pVisualStyleButton = new CMFCRibbonButton(-1, strTemp, -1, -1);
pVisualStyleButton->SetMenu(IDR_THEME_MENU, FALSE /* No default command */, TRUE /* Right align */);
//.........这里部分代码省略.........