コード例 #1
1
ファイル: View.cpp プロジェクト: quinsmpang/Tools
BOOL CView::LoadPictureFile(LPCTSTR szFile)
{
	if (m_pPicture)
	{
		m_pPicture->Release();
		m_pPicture = NULL;
	}

	TRACE(szFile);
	TRACE("\n");

	m_xCurrentScroll = 0;
	m_yCurrentScroll = 0;
	ShowScrollBar(SB_HORZ, FALSE);
	ShowScrollBar(SB_VERT, FALSE);

	// Create IPicture from image file
	if (S_OK == ::OleLoadPicturePath(T2OLE(szFile), NULL, 0, 0,	IID_IPicture, (LPVOID *)&m_pPicture))
	{
		CMainFrame* pFrame = GetPicApp()->GetMainFrame();
		pFrame->SendMessage(UWM_FILELOADED, 0, (LPARAM)szFile);
		Invalidate();
		return TRUE;
	}
	else
	{
		TRACE("Failed to load picture\n");

		// Set Frame title back to default
		CMainFrame* pFrame = GetPicApp()->GetMainFrame();
		pFrame->SendMessage(UWM_FILELOADED, 0, (LPARAM)LoadString(IDW_MAIN).c_str());
		return FALSE;
	}
}
コード例 #2
0
//To on and off the scrollbars of the listbox
void COXMultiComboBox::COXComboLBox::AdjustHScroll()
{
	int nTotalHeight = ((COXMultiComboBox*)m_pWndCombo)->GetTotalHeight();
	int nTotalWidth = ((COXMultiComboBox*)m_pWndCombo)->GetTotalWidth();
	int nBorderWidth = GetSystemMetrics(SM_CXBORDER);
	int nBorderHeight = GetSystemMetrics(SM_CYBORDER);
	int nScrollbarWidth = GetSystemMetrics(SM_CXVSCROLL);
	int nScrollbarHeight = GetSystemMetrics(SM_CYHSCROLL);
	CRect rcDrop;
	((COXMultiComboBox*)m_pWndCombo)->GetDroppedControlRect(&rcDrop);
	if( (nTotalHeight > rcDrop.Height()-2*nBorderHeight) ||
		((nTotalWidth > rcDrop.Width() - 2*nBorderWidth) &&
		(nTotalHeight > rcDrop.Height()-nScrollbarHeight - 2*nBorderHeight)) )
		m_fVertScrollVisible = TRUE;
	else
		m_fVertScrollVisible = FALSE;

	int nMargin=nTotalWidth-rcDrop.Width()+2*nBorderWidth;
	if(m_fVertScrollVisible)
		nMargin+=nScrollbarWidth;
	if( nMargin>0 )
		m_fHorzScrollVisible = TRUE;
	else
		m_fHorzScrollVisible = FALSE;

	if(m_fHorzScrollVisible)
		ShowScrollBar(SB_BOTH,TRUE);
	else
		ShowScrollBar(SB_HORZ,FALSE);
	ShowScrollBar(SB_VERT,m_fVertScrollVisible);

}
コード例 #3
0
ファイル: xydrawbox.cpp プロジェクト: adamadanandy/XYDiaCap
void XYDrawbox::RefreshAllScrollBar()
{
	//Horizontal Scrollbar Refresh Setting
	if (this->isXScroll)
	{
		ShowScrollBar(this->hwndThis, SB_HORZ, TRUE);
		scrollinfo.fMask = SIF_ALL;
		scrollinfo.nMax = this->lengthXScroll;
		scrollinfo.nMin = 0;
		scrollinfo.nPage = this->lengthXPage;
		scrollinfo.nPos = this->posXScroll;
		SetScrollInfo(this->hwndThis, SB_HORZ, &scrollinfo, TRUE);
	}
	else
	{
		ShowScrollBar(this->hwndThis, SB_HORZ, FALSE);
	}
	//Vertical Scrollbar Refresh Setting
	if (this->isYScroll)
	{
		ShowScrollBar(this->hwndThis, SB_VERT, TRUE);
		scrollinfo.fMask = SIF_ALL;
		scrollinfo.nMax = this->lengthYScroll;
		scrollinfo.nMin = 0;
		scrollinfo.nPage = this->lengthYPage;
		scrollinfo.nPos = this->posYScroll;
		SetScrollInfo(this->hwndThis, SB_VERT, &scrollinfo, TRUE);
	}
	else
	{
		ShowScrollBar(this->hwndThis, SB_VERT, FALSE);
	}
}
コード例 #4
0
bool CDisplayDlg::EndFullScreen()
{
    m_IsFullScreen = false;
    ShowScrollBar(SB_HORZ,TRUE);
    ShowScrollBar(SB_VERT,TRUE);
    return SetSize(m_left,m_top,m_cx,m_cy);
}
コード例 #5
0
ファイル: NFOView.cpp プロジェクト: wowh/SimpleNfoViewer
void NFOView::CheckScrollbar(void)
{
    RECT viewWindowRect;
    GetClientRect(_handle, &viewWindowRect);

    HDC viewWindowDC = GetDC(_handle);
    HFONT hFont = (HFONT)SendMessage(_handle, WM_GETFONT, NULL, NULL);
    SelectObject(viewWindowDC, hFont);
    TEXTMETRICW tm;
    GetTextMetricsW(viewWindowDC, &tm); 
    ReleaseDC(_handle, viewWindowDC);

    // check vertical scrollbar
    int lineCount = SendMessage(_handle, EM_GETLINECOUNT, NULL, NULL);
    int lineCountOfViewWindow = viewWindowRect.bottom / tm.tmHeight;
    ShowScrollBar(_handle, SB_VERT, lineCount > lineCountOfViewWindow);

    // check horizontal scrollbar
    int maxLineLength = 0;
    for (int lineNum = 0; lineNum < lineCount; lineNum++)
    {
        int charIndex = SendMessage(_handle, EM_LINEINDEX, (WPARAM)lineNum, NULL);
        if (-1 != charIndex)
        {
            int lineLength = SendMessage(_handle, EM_LINELENGTH, (WPARAM)charIndex, NULL);
            if (lineLength > maxLineLength)
            {
                maxLineLength = lineLength;
            }
        }
    }
    int lineLengthOfViewWindow = viewWindowRect.right / tm.tmAveCharWidth;
    ShowScrollBar(_handle, SB_HORZ, maxLineLength > lineLengthOfViewWindow);
}
コード例 #6
0
ファイル: TCEdit.cpp プロジェクト: JohnWilliam1988/TCIDE
void CTCEdit::TCSetHorizScroll(bool set)
{
	m_Horiz = set;
	if(m_isMulityLine && m_Horiz)
		ShowScrollBar(SB_HORZ,TRUE);
	else
		ShowScrollBar(SB_HORZ,FALSE);
}
コード例 #7
0
ファイル: TCEdit.cpp プロジェクト: JohnWilliam1988/TCIDE
void CTCEdit::TCSetVertiScroll(bool set)
{
	m_Verti = set;
	if(m_isMulityLine && m_Verti)
		ShowScrollBar(SB_VERT,TRUE);
	else
		ShowScrollBar(SB_VERT,FALSE);
}
コード例 #8
0
ファイル: View.cpp プロジェクト: quinsmpang/Tools
LRESULT CView::OnWindowPosChanged(WPARAM /*wParam*/, LPARAM /*lParam*/)
{
	if (m_pPicture)
	{
		CRect rcImage = GetImageRect();
		DWORD dwStyle = (DWORD)GetWindowLongPtr(GWL_STYLE);
		DWORD dwExStyle = (DWORD)GetWindowLongPtr(GWL_EXSTYLE);
		AdjustWindowRectEx(&rcImage, dwStyle, FALSE, dwExStyle);

		CRect rcView = GetClientRect();
		AdjustWindowRectEx(&rcView, dwStyle, FALSE, dwExStyle);

		SCROLLINFO si;
		ZeroMemory(&si, sizeof(SCROLLINFO));
		si.cbSize = sizeof(si);
		si.fMask  = SIF_RANGE | SIF_PAGE | SIF_POS;
		si.nMin   = 0;

		if (rcView.Width()  >= rcImage.Width())
		{
			m_xCurrentScroll = 0;
			ShowScrollBar(SB_HORZ, FALSE);
		}
		else
		{
			si.nMax   = rcImage.Width();
			si.nPage  = rcView.Width();
			si.nPos   = m_xCurrentScroll;
			SetScrollInfo(SB_HORZ, si, TRUE);
			ShowScrollBar(SB_HORZ, TRUE);
		}

		if (rcView.Height() >= rcImage.Height())
		{
			m_yCurrentScroll = 0;
			ShowScrollBar(SB_VERT, FALSE);
		}
		else
		{
			si.nMax   = rcImage.Height();
			si.nPage  = rcView.Height();
			si.nPos   = m_yCurrentScroll;
			SetScrollInfo(SB_VERT, si, TRUE);
			ShowScrollBar(SB_VERT, TRUE);
		}

		int xNewPos = MIN(m_xCurrentScroll, rcImage.Width() - rcView.Width());
		m_xCurrentScroll = MAX(xNewPos, 0);
		int yNewPos = MIN(m_yCurrentScroll, rcImage.Height() - rcView.Height());
		m_yCurrentScroll = MAX(yNewPos, 0);

		// Paint the window directly to eliminate flicker
		CClientDC dcView(this);
		Paint(dcView);
	}

	return 0L;
}
コード例 #9
0
static int winCanvasSetDYAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_VERT)
  {
    double posy, ymin, ymax;
    float dy;
    int iposy, ipagey;

    if (!iupStrToFloatDef(value, &dy, 0.1f))
      return 1;

    ymin = iupAttribGetFloat(ih, "YMIN");
    ymax = iupAttribGetFloat(ih, "YMAX");
    posy = ih->data->posy;

    iupCanvasCalcScrollIntPos(ymin, ymax, dy, posy, 
                              IUP_SB_MIN, IUP_SB_MAX, &ipagey, &iposy);

    winCanvasSetScrollInfo(ih->handle, IUP_SB_MIN, IUP_SB_MAX, ipagey, SB_VERT, iupAttribGetBoolean(ih, "YAUTOHIDE"));

    if (dy >= (ymax-ymin))
    {
      if (iupAttribGetBoolean(ih, "YAUTOHIDE"))
      {
        iupAttribSet(ih, "YHIDDEN", "YES");
        ShowScrollBar(ih->handle, SB_VERT, FALSE);
        SetScrollPos(ih->handle, SB_VERT, IUP_SB_MIN, FALSE);
      }
      else
      {
        EnableScrollBar(ih->handle, SB_VERT, ESB_DISABLE_BOTH);
        SetScrollPos(ih->handle, SB_VERT, IUP_SB_MIN, TRUE);
      }

      ih->data->posy = (float)ymin;
      return 1;
    }
    else
    {
      if (iupAttribGetBoolean(ih, "YAUTOHIDE"))
      {
        iupAttribSet(ih, "YHIDDEN", "NO");
        ShowScrollBar(ih->handle, SB_VERT, TRUE);
      }
      else
        EnableScrollBar(ih->handle, SB_VERT, ESB_ENABLE_BOTH);

      /* also update position because it could have being changed */
      iupCanvasCalcScrollRealPos(ymin, ymax, &posy,
                                 IUP_SB_MIN, IUP_SB_MAX, ipagey, &iposy);
      SetScrollPos(ih->handle, SB_VERT, iposy, TRUE);
      ih->data->posy = (float)posy;
    }
  }
  return 1;
}
コード例 #10
0
static int winCanvasSetDXAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_HORIZ)
  {
    double posx, xmin, xmax;
    float dx;
    int iposx, ipagex;

    if (!iupStrToFloatDef(value, &dx, 0.1f))
      return 1;

    xmin = iupAttribGetFloat(ih, "XMIN");
    xmax = iupAttribGetFloat(ih, "XMAX");
    posx = ih->data->posx;

    iupCanvasCalcScrollIntPos(xmin, xmax, dx, posx, 
                              IUP_SB_MIN, IUP_SB_MAX, &ipagex, &iposx);

    winCanvasSetScrollInfo(ih->handle, IUP_SB_MIN, IUP_SB_MAX, ipagex, SB_HORZ, iupAttribGetBoolean(ih, "XAUTOHIDE"));

    if (dx >= (xmax-xmin))
    {
      if (iupAttribGetBoolean(ih, "XAUTOHIDE"))
      {
        iupAttribSet(ih, "XHIDDEN", "YES");
        ShowScrollBar(ih->handle, SB_HORZ, FALSE);
        SetScrollPos(ih->handle, SB_HORZ, IUP_SB_MIN, FALSE);
      }
      else
      {
        EnableScrollBar(ih->handle, SB_HORZ, ESB_DISABLE_BOTH);
        SetScrollPos(ih->handle, SB_HORZ, IUP_SB_MIN, TRUE);
      }

      ih->data->posx = (float)xmin;
    }
    else
    {
      if (iupAttribGetBoolean(ih, "XAUTOHIDE"))
      {
        iupAttribSet(ih, "XHIDDEN", "NO");
        ShowScrollBar(ih->handle, SB_HORZ, TRUE);
      }
      else
        EnableScrollBar(ih->handle, SB_HORZ, ESB_ENABLE_BOTH);

      /* also update position because it could have being changed */
      iupCanvasCalcScrollRealPos(xmin, xmax, &posx, 
                                 IUP_SB_MIN, IUP_SB_MAX, ipagex, &iposx);
      SetScrollPos(ih->handle, SB_HORZ, iposx, TRUE);
      ih->data->posx = (float)posx;
    }
  }
  return 1;
}
コード例 #11
0
void CDisplayDlg::FullScreen()
{

    m_IsFullScreen  = true;
    MoveWindow(0,0,m_ScreenWidth,m_ScreenHeight);
    ScrollWindowEx(GetScrollPos(SB_HORZ),GetScrollPos(SB_VERT),NULL, NULL, NULL, NULL, SW_ERASE|SW_SCROLLCHILDREN);
    SetScrollPos(SB_HORZ,0);
    SetScrollPos(SB_VERT,0);
    ShowScrollBar(SB_HORZ,FALSE);
    ShowScrollBar(SB_VERT,FALSE);
}
コード例 #12
0
ファイル: viewprev.cpp プロジェクト: rickerliang/OpenNT
// Actual zoom code.
void CPreviewView::DoZoom(UINT nPage, CPoint point)
{
	if (m_nZoomState == ZOOM_OUT)
	{
		// taking over scroll bars
		m_nPages = m_nZoomOutPages;
		ShowScrollBar(SB_HORZ, FALSE);      //hide the horizontal bar

		BOOL bShowBar = m_pPreviewInfo->GetMaxPage() < 0x8000 &&
			m_pPreviewInfo->GetMaxPage() -
			m_pPreviewInfo->GetMinPage() <= 32767U;

		ShowScrollBar(SB_VERT, bShowBar);       //Show the vertical bar

		if (bShowBar)
		{
			SetScrollRange(SB_VERT, m_pPreviewInfo->GetMinPage(),
								m_pPreviewInfo->GetMaxPage(), FALSE);

			SetScrollPos(SB_VERT, m_nCurrentPage, TRUE);
		}

		SetCurrentPage(m_nCurrentPage, TRUE);
	}
	else
	{
		m_nPages = 1;       // only one page in zoomed states

		m_pPageInfo[0].sizeZoomOutRatio = m_pPageInfo[nPage].sizeZoomOutRatio;
		m_pPageInfo[0].sizeUnscaled = m_pPageInfo[nPage].sizeUnscaled;

		// Sets the printer page
		SetCurrentPage(m_nCurrentPage + nPage, FALSE);

		SetScaledSize(0);

		CSize* pRatio = &m_pPageInfo[nPage].sizeScaleRatio;

		// convert Hit Point from screen 1:1
		point.x = MulDiv(point.x, pRatio->cx, pRatio->cy);
		point.y = MulDiv(point.y, pRatio->cx, pRatio->cy);

		// Adjust point for page position
		point += (CSize)m_pPageInfo[0].rectScreen.TopLeft();

		// Scroll to center
		CenterOnPoint(point);
	}
}
コード例 #13
0
ファイル: xydrawbox.cpp プロジェクト: adamadanandy/XYDiaCap
BOOL XYDrawbox::InitWnd()
{
	SetWndProclpParam(this);
	std::cout << "WNDPROC :D:" << (this->wndProcThis) << std::endl;
	if (XYWndBase::InitWnd() == FALSE)
	{
		std::cout << "WARNING!!" << std::endl;
		return FALSE;
	}
	else
	{
		ShowScrollBar(this->hwndThis, SB_HORZ, FALSE);
		ShowScrollBar(this->hwndThis, SB_VERT, FALSE);
	}
	return TRUE;
}
コード例 #14
0
ファイル: WatchBarList.cpp プロジェクト: xiaoyugm/chtproject
void CWatchBarList::OnWindowPosChanged(WINDOWPOS FAR* lpwndpos) 
{
	CListCtrl::OnWindowPosChanged(lpwndpos);
	
    ShowScrollBar(SB_HORZ, FALSE);
    ModifyStyle(WS_HSCROLL, 0, SWP_DRAWFRAME);
}
コード例 #15
0
void CBirchCtrl::ResetScrollBar()
{
	// Flag to avoid a call from OnSize while resetting the scrollbar
	m_bScrollBarMessage = TRUE;

	CRect rFrame;

	GetClientRect( rFrame );

	// Need for scrollbars?
	if( rFrame.Height() > m_iDocHeight + 8 )
	{
		ShowScrollBar( SB_VERT, FALSE );	// Hide it
		SetScrollPos( SB_VERT, 0 );
	}
	else
	{
		SCROLLINFO	si;
		si.cbSize = sizeof(SCROLLINFO);
		si.fMask = SIF_PAGE | SIF_RANGE;
		si.nPage = rFrame.Height()/*/m_iLineHeight*/;
		si.nMax = (m_iDocHeight + 8)/*/m_iLineHeight*/;
		si.nMin = 0 ;

		SetScrollInfo( SB_VERT, &si );
		EnableScrollBarCtrl( SB_VERT, TRUE );
	}

	m_bScrollBarMessage = FALSE;
}
コード例 #16
0
ファイル: boe.dlgutil.cpp プロジェクト: PBrookfield/cboe-msvc
void end_shop_mode()
{
	RECT dummy_rect = {0,0,0,0};

    if(PSD[SDF_ASK_ABOUT_TEXT_BOX] == 1)
    	ShowWindow(talk_edit_box, SW_SHOW);

	ShowScrollBar(shop_sbar,SB_CTL,false);
	if (store_pre_shop_mode == 20) {
		sprintf(old_str1,"You conclude your business.");
		sprintf(old_str2,"");
		sprintf(one_back1,"You conclude your business.");
		sprintf(one_back2,"");

		strnum1 = strnum2 = oldstrnum1 = oldstrnum2 = 0;
		place_talk_str((char *)old_str1,"",0,dummy_rect);
		}
		else {
			DeleteObject(talk_gworld);
			talk_gworld = NULL;
			}

	overall_mode = store_pre_shop_mode;
	create_clip_region();
	if (overall_mode == MODE_TALK_TOWN)
		overall_mode = MODE_TOWN;
	if (overall_mode == MODE_TOWN) {
		center = c_town.p_loc;
		update_explored(center);
		}
	stat_screen_mode = 0;
	put_item_screen(stat_window,0);
	put_pc_screen();
	refresh_screen(0);
}
コード例 #17
0
// ConfigObjectTreeView message handlers
int ConfigObjectTreeView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
	if (CFormView::OnCreate(lpCreateStruct) == -1)
		return -1;

	ShowScrollBar(SB_BOTH,FALSE);
	// TODO:  Add your specialized creation code here
	CRect rectDummy;
	rectDummy.SetRectEmpty();

	findToolBar.Create(this, AFX_DEFAULT_TOOLBAR_STYLE, IDR_CONFIGOBJECT_TREE_TOOLBAR);
	findToolBar.LoadToolBar(IDR_CONFIGOBJECT_TREE_TOOLBAR, 0, 0, TRUE /* 已锁定*/);

	OnChangeVisualStyle();

	findToolBar.SetPaneStyle(findToolBar.GetPaneStyle() | CBRS_TOOLTIPS | CBRS_FLYBY);

	findToolBar.SetPaneStyle(findToolBar.GetPaneStyle() & ~(CBRS_GRIPPER | CBRS_SIZE_DYNAMIC | CBRS_BORDER_TOP | CBRS_BORDER_BOTTOM | CBRS_BORDER_LEFT | CBRS_BORDER_RIGHT));

	findToolBar.SetOwner(this);

	// 所有命令将通过此控件路由,而不是通过主框架路由:
	findToolBar.SetRouteCommandsViaFrame(FALSE);

	AdjustLayout();

	return 0;
}
コード例 #18
0
void ConfigObjectTreeView::AdjustLayout()
{
	if (GetSafeHwnd() == NULL)
	{
		return;
	}

	ShowScrollBar(SB_BOTH,FALSE);

	CRect rectClient;
	GetClientRect(rectClient);

	/*计算提示文本串“管理对象:”的文本高度,用于排列各控件*/
	int groupTextHeight = 0;
	if(objectTreeGroup.GetSafeHwnd() != NULL)
	{
		groupTextHeight = ControlLayoutHelper::CalculateHeaderTextHeight(objectTreeGroup);

		objectTreeGroup.SetWindowPos(NULL, 0, 0, rectClient.Width()+1, rectClient.Height(), SWP_NOACTIVATE | SWP_NOZORDER);
	}

	int cyTlb = findToolBar.CalcFixedLayout(FALSE, TRUE).cy;
	findToolBar.SetWindowPos(NULL, rectClient.left, rectClient.top+groupTextHeight, rectClient.Width(), cyTlb, SWP_NOACTIVATE | SWP_NOZORDER);

	if(configObjectTreeCtrl.GetSafeHwnd() != NULL)
	{
		configObjectTreeCtrl.SetWindowPos(NULL, rectClient.left + 1, rectClient.top + groupTextHeight + cyTlb + 1, rectClient.Width() - 2, rectClient.Height() - groupTextHeight- cyTlb - 2, SWP_NOACTIVATE | SWP_NOZORDER);
	}
}
コード例 #19
0
ファイル: scroll.c プロジェクト: aragaer/wine
static void scrollbar_test3(void)
{
    BOOL    ret;

    ret = ShowScrollBar( hScroll, SB_CTL, FALSE );
    ok( ret, "The ShowScrollBar() should not failed.\n" );
    ok( !IsWindowVisible( hScroll ), "The scrollbar window should not be visible\n" );

    ret = ShowScrollBar( hScroll, SB_CTL, TRUE );
    ok( ret, "The ShowScrollBar() should not failed.\n" );
    ok( !IsWindowVisible( hScroll ), "The scrollbar window should be visible\n" );

    ret = ShowScrollBar( NULL, SB_CTL, TRUE );
    ok( !ret, "The ShowScrollBar() should failed.\n" );

}
コード例 #20
0
ファイル: View3.cpp プロジェクト: Ireneph/samples
void CView3::OnWindowPosChanging(WINDOWPOS FAR* lpwndpos) 
{
	CFormView::OnWindowPosChanging(lpwndpos);
	
	// Hide horizontal scrollbar:
	ShowScrollBar (SB_HORZ, FALSE);
	ModifyStyle (WS_HSCROLL, 0, SWP_DRAWFRAME);
}
コード例 #21
0
ファイル: iupwin_canvas.c プロジェクト: Archs/iup-aio
static int winCanvasSetDXAttrib(Ihandle* ih, const char *value)
{
  if (ih->data->sb & IUP_SB_HORIZ)
  {
    double posx, xmin, xmax;
    float dx;
    int iposx, ipagex;

    if (!iupStrToFloat(value, &dx))
      return 1;

    xmin = iupAttribGetFloat(ih, "XMIN");
    xmax = iupAttribGetFloat(ih, "XMAX");
    posx = ih->data->posx;

    iupCanvasCalcScrollIntPos(xmin, xmax, dx, posx, 
                              IUP_SB_MIN, IUP_SB_MAX, &ipagex, &iposx);

    if (dx >= (xmax-xmin))
    {
      if (iupAttribGetBoolean(ih, "XAUTOHIDE"))
        ShowScrollBar(ih->handle, SB_HORZ, FALSE);
      else
        EnableScrollBar(ih->handle, SB_HORZ, ESB_DISABLE_BOTH);

      ih->data->posx = (float)xmin;
      SetScrollPos(ih->handle, SB_HORZ, IUP_SB_MIN, TRUE);
      return 1;
    }
    else
    {
      ShowScrollBar(ih->handle, SB_HORZ, TRUE);
      EnableScrollBar(ih->handle, SB_HORZ, ESB_ENABLE_BOTH);
    }

    winCanvasSetScrollInfo(ih->handle, IUP_SB_MIN, IUP_SB_MAX, iposx, ipagex, SB_HORZ);

    /* update position because it could be corrected */
    iupCanvasCalcScrollRealPos(xmin, xmax, &posx, 
                               IUP_SB_MIN, IUP_SB_MAX, ipagex, &iposx);

    ih->data->posx = (float)posx;
  }
  return 1;
}
コード例 #22
0
/* 
 * shoulded be called before scrollwnd is used
 * hWnd: the scrolled window
 */
int scrollwnd_init (HWND hWnd, PSWDATA pswdata)
{
    if (!pswdata)
        return -1;

    SetWindowAdditionalData2 (hWnd, 0);
    ShowScrollBar (hWnd, SB_HORZ, FALSE);
    ShowScrollBar (hWnd, SB_VERT, FALSE);

    svInitData (hWnd, pswdata);
    SetWindowAdditionalData2 (hWnd, (DWORD) pswdata);

    /* set scrollbar status */
    scrolled_set_hscrollinfo (hWnd, &pswdata->scrdata);
    scrolled_set_vscrollinfo (hWnd, &pswdata->scrdata);
                                    
    return 0;
}
コード例 #23
0
ファイル: CANVAS.CPP プロジェクト: wcardozo/fengyuan
void KCanvasWindow::SetScaleColor(int newscale, COLORREF backcolor)
{
	RECT rect;

	if ((newscale==scale) && (canvas_backcolor==backcolor))
		return;

	if (backcolor)  // no black
		canvas_backcolor = backcolor;

	// newscale==0 will force repaint
	if (newscale) 
		scale = newscale;

	GetClientRect(m_hWnd, &rect);

	if ((maxx/scale+page_margin*2) < rect.right)
		ShowScrollBar(m_hWnd, SB_HORZ, FALSE);		   // no scroll bar needed	
	else
	{
		ShowScrollBar(m_hWnd, SB_HORZ, TRUE);

		EnableScrollBar(m_hWnd, SB_HORZ, ESB_ENABLE_BOTH);
		SetScrollRange(m_hWnd, SB_HORZ, 0, (maxx/scale+page_margin*2) - rect.right, FALSE);
	}
	// always reset scrool bar position, 
	// we need that inf WS_PAINT processing, even if we don't have show scroll bar
	SetScrollPos(m_hWnd, SB_HORZ, 0, FALSE);
	
	if ((maxy/scale+page_margin*2) < rect.bottom)
		ShowScrollBar(m_hWnd, SB_VERT, FALSE);
	else
	{	
		ShowScrollBar(m_hWnd, SB_VERT, TRUE);

		SetScrollRange(m_hWnd, SB_VERT, 0, (maxy/scale+page_margin*2) - rect.bottom, FALSE);
	}
	// always reset scrool bar position, 
	// we need that inf WS_PAINT processing, even if we don't have show scroll bar
	SetScrollPos(m_hWnd, SB_VERT, 0, FALSE);
	
	InvalidateRect(m_hWnd, NULL, TRUE);
}
コード例 #24
0
ファイル: npmngplg.c プロジェクト: 03050903/Torque3D
static void find_window_size(PluginInstance *This)
{
	RECT r;
	if(This->scrolling) {  // make sure scrollbars exist if needed
		ShowScrollBar(This->fhWnd,SB_BOTH,TRUE);
	}
	GetClientRect(This->fhWnd, &r);
	This->windowwidth=r.right;
	This->windowheight=r.bottom;
}
コード例 #25
0
ファイル: iupwin_canvas.c プロジェクト: gcfavorites/tastools
static int winCanvasSetDYAttrib(Ihandle *ih, const char *value)
{
  if (ih->data->sb & IUP_SB_VERT)
  {
    double posy, ymin, ymax;
    float dy;
    int iposy, ipagey;

    if (!iupStrToFloat(value, &dy))
      return 1;

    ymin = iupAttribGetFloat(ih, "YMIN");
    ymax = iupAttribGetFloat(ih, "YMAX");
    posy = ih->data->posy;

    iupCanvasCalcScrollIntPos(ymin, ymax, dy, posy, 
                              IUP_SB_MIN, IUP_SB_MAX, &ipagey, &iposy);

    if (dy >= (ymax-ymin))
    {
      if (iupAttribGetBoolean(ih, "YAUTOHIDE"))
        ShowScrollBar(ih->handle, SB_VERT, FALSE);
      else
        EnableScrollBar(ih->handle, SB_VERT, ESB_DISABLE_BOTH);
      return 1;
    }
    else
    {
      ShowScrollBar(ih->handle, SB_VERT, TRUE);
      EnableScrollBar(ih->handle, SB_VERT, ESB_ENABLE_BOTH);
    }

    winCanvasSetScrollInfo(ih->handle, IUP_SB_MIN, IUP_SB_MAX, iposy, ipagey, SB_VERT);

    /* update position because it could be corrected */
    iupCanvasCalcScrollRealPos(ymin, ymax, &posy, 
                               IUP_SB_MIN, IUP_SB_MAX, ipagey, &iposy);

    ih->data->posy = (float)posy;
  }
  return 1;
}
コード例 #26
0
ファイル: treelist.c プロジェクト: HeckMina/dprofiler
VOID
TreeListResetScrollBar(
	__in PTREELIST_OBJECT Object
	)
{
	RECT Rect;
	LONG ClientWidth;
	LONG HeaderWidth;
	SCROLLINFO si = {0};

	GetClientRect(Object->hWnd, &Rect);
	ClientWidth = Rect.right - Rect.left;
	HeaderWidth = TreeListGetHeaderWidth(Object);

	//
	// if the width of header is beyond the limit of treelist's client area
	// scrollbar is enabled
	//

	if(HeaderWidth > ClientWidth) {
		si.cbSize = sizeof(si);
        si.fMask  = SIF_RANGE | SIF_PAGE; 
        si.nMin   = 0; 
        si.nMax   = HeaderWidth; 
        si.nPage  = ClientWidth; 
		SetScrollInfo(Object->hWnd, SB_HORZ, &si, TRUE);
		ShowScrollBar(Object->hWnd, SB_HORZ, TRUE);
		Object->ScrollOffset = 0;
	}
	else {
		si.cbSize = sizeof(si);
        si.fMask  = SIF_RANGE | SIF_PAGE; 
        si.nMin   = 0; 
        si.nMax   = 0; 
        si.nPage  = 0; 
		SetScrollInfo(Object->hWnd, SB_HORZ, &si, TRUE);
		ShowScrollBar(Object->hWnd, SB_HORZ, FALSE);
		Object->ScrollOffset = 0;
	}

}
コード例 #27
0
void CXTPCoreTreeControl::UpdateScrollBar()
{
	if (m_bInUpdateScrollBar)
		return;

	m_bInUpdateScrollBar = TRUE;

	CXTPClientRect rc(this);
	m_bScrollVisible = rc.Height() < m_nClientHeight;

	if (m_bScrollVisible)
	{
		ShowScrollBar(SB_VERT, TRUE);

		SCROLLINFO  si ;

		si.cbSize = sizeof(SCROLLINFO) ;
		si.fMask = SIF_PAGE | SIF_RANGE ;

		GetScrollInfo(SB_VERT, &si, si.fMask);

		UINT nControlHeight = (UINT)rc.Height();

		if (si.nPage != nControlHeight || si.nMax != m_nClientHeight - 1 || si.nMin != 0)
		{
			si.nPage = nControlHeight ;
			si.nMax = m_nClientHeight - 1;
			si.nMin = 0 ;
			si.fMask = SIF_PAGE | SIF_RANGE ;
			SetScrollInfo(SB_VERT, &si) ;
		}
		EnableScrollBarCtrl(SB_VERT, TRUE);
	}
	else
	{
		SetScrollPos(SB_VERT, 0);
		ShowScrollBar(SB_VERT, FALSE);
	}

	m_bInUpdateScrollBar = FALSE;
}
コード例 #28
0
ファイル: treelist.c プロジェクト: songbei6/WinObjEx64
VOID TreeListHandleHeaderNotify(
    HWND hwndBox,
    HWND hwndTree,
    HWND hwndHeader
)
{
    LONG        cx, i, c, headerheight;
    RECT        hr, ir;
    SCROLLINFO  scroll;

    RtlSecureZeroMemory(&hr, sizeof(hr));
    GetWindowRect(hwndHeader, &hr);
    headerheight = hr.bottom - hr.top;

    cx = 0;
    c = Header_GetItemCount(hwndHeader);
    for (i = 0; i < c; i++) {
        Header_GetItemRect(hwndHeader, i, &hr);
        if (hr.right > cx)
            cx = hr.right;
    }

    GetClientRect(hwndBox, &hr);
    if (cx > hr.right) {
        RtlSecureZeroMemory(&scroll, sizeof(scroll));
        scroll.cbSize = sizeof(scroll);
        scroll.fMask = SIF_ALL;
        GetScrollInfo(hwndBox, SB_HORZ, &scroll);

        GetClientRect(hwndHeader, &ir);
        if ((ir.right > cx) && (scroll.nPos + (int)scroll.nPage == scroll.nMax)) {
            SetWindowPos(hwndHeader, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
            SetWindowPos(hwndTree, 0, 0, headerheight, hr.right, hr.bottom - headerheight, SWP_NOZORDER);
            scroll.nPos = 0;
        }

        scroll.nMax = cx;
        scroll.nPage = hr.right;
        SetScrollInfo(hwndBox, SB_HORZ, &scroll, TRUE);
        GetClientRect(hwndBox, &hr);
        GetWindowRect(hwndTree, &ir);
        ir.right -= ir.left;
        SetWindowPos(hwndTree, 0, 0, 0, ir.right, hr.bottom - headerheight, SWP_NOMOVE | SWP_NOZORDER);
        SetWindowPos(hwndHeader, 0, 0, 0, cx, headerheight, SWP_NOMOVE | SWP_NOZORDER);
    }
    else {
        ShowScrollBar(hwndBox, SB_HORZ, FALSE);
        GetClientRect(hwndBox, &hr);
        SetWindowPos(hwndHeader, 0, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOZORDER);
        SetWindowPos(hwndTree, 0, 0, headerheight, hr.right, hr.bottom - headerheight, SWP_NOZORDER);
    }
    RedrawWindow(hwndTree, NULL, NULL, RDW_INVALIDATE | RDW_NOERASE);
}
コード例 #29
0
//---------------------------------------------------------------------------
void __fastcall TFormCosts::Button1Click(TObject *Sender)
{
    if(Edit1->Text != "" && Edit2->Text != "")
    {
        if(CheckBox1->Checked)
        {
            //if(StrToInt(Label4->Caption) - StrToInt(Edit2->Text) >= 0)
            //{
                if(ComboBox1->Text == "Одноразовый")
                {
                    int Income = IniFile->ReadInteger("Resource", "ofMonth", 0) - StrToInt(Edit2->Text);
                    IniFile->WriteInteger("Resource", "ofMonth", Income);
                }             
                if(ADOQuery1->Active)
                {
                    ADOQuery1->Active = false;
                }
                ADOQuery1->SQL->Text = "INSERT INTO Costs VALUES('"+IntToStr(FilingYID())+"', '"+Edit1->Text+"', '"+Edit2->Text+"', '"+ComboBox1->Text+"', '"+DateTimePicker1->Date+"', '1', '0')";
                ADOQuery1->ExecSQL();
            /*}
            else
            {
                ShowMessage("Недостаточно средств!");
            }*/
        }
        else
        {
            if(ADOQuery1->Active)
            {
                ADOQuery1->Active = false;
            }
            ADOQuery1->SQL->Text = "INSERT INTO Costs VALUES('"+IntToStr(FilingYID())+"', '"+Edit1->Text+"', '"+Edit2->Text+"', '"+ComboBox1->Text+"', '"+DateTimePicker1->Date+"', '0', '0')";
            ADOQuery1->ExecSQL();
        }
        
        
    }
    else
    {    
        ShowMessage("Заполните поля!");
    }
    if(ADOQuery1->Active)
	{
		ADOQuery1->Active = false;
        ADOQuery2->Active = false;
	}
	ADOQuery1->SQL->Text = "SELECT * FROM Costs";
    ADOQuery2->SQL->Text = "SELECT * FROM Costs";
	ADOQuery1->Active = true;
    ADOQuery2->Active = true;
    Label4->Caption = IniFile->ReadString("Resource", "ofMonth", "0");
    ShowScrollBar(DBGrid1->Handle, SB_BOTH, false);
}
コード例 #30
0
ファイル: scroll.c プロジェクト: AmesianX/wine
static void test_ShowScrollBar(void)
{
    HWND mainwnd;
    BOOL    ret;

    mainwnd = create_main_test_wnd();

    ret = ShowScrollBar( hScroll, SB_CTL, FALSE );
    ok( ret, "The ShowScrollBar() should not failed.\n" );
    ok( !IsWindowVisible( hScroll ), "The scrollbar window should not be visible\n" );

    ret = ShowScrollBar( hScroll, SB_CTL, TRUE );
    ok( ret, "The ShowScrollBar() should not failed.\n" );
    ok( !IsWindowVisible( hScroll ), "The scrollbar window should be visible\n" );

    ret = ShowScrollBar( NULL, SB_CTL, TRUE );
    ok( !ret, "The ShowScrollBar() should failed.\n" );

    DestroyWindow(hScroll);
    DestroyWindow(mainwnd);
}