// cdxCSizingDialog.cpp : implementation file
// (c)1998 Hans B�hler, codex design
// Designed to be used with MS VC++ 5.0
#define OEMRESOURCE
#include <windows.h>
#include "stdafx.h"
#include "cdxCSizingDialog.h"
#ifndef OBM_SIZE
#define OBM_SIZE 32766
// taken from WinresRc.h
// if not used for any reason
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
/////////////////////////////////////////////////////////////////////////////
// Some static variables
/////////////////////////////////////////////////////////////////////////////
static LPCTSTR pfEntry_Left = _T("Left"),
pfEntry_Right = _T("Right"),
pfEntry_Top = _T("Top"),
pfEntry_Bottom = _T("Bottom"),
pfEntry_State = _T("State"),
pfEntry_IsDone = _T("(check)");
#define BAD_ID ((UINT)~0)
static struct cdxCSizingPropSheet::StandardControls psheetCtrls[] =
{
{ ID_WIZNEXT, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ ID_WIZFINISH, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ ID_WIZBACK, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ IDOK, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ IDCANCEL, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ ID_WIZNEXT, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ ID_APPLY_NOW, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ IDHELP, cdxCSizingDialog::mdRepos,cdxCSizingDialog::mdRepos },
{ AFX_IDC_TAB_CONTROL, cdxCSizingDialog::mdResize,cdxCSizingDialog::mdResize },
{ ID_WIZFINISH+1,cdxCSizingDialog::mdResize,cdxCSizingDialog::mdRepos}, /* the bevel line; hope that it will keep this id */
{ BAD_ID }
};
/////////////////////////////////////////////////////////////////////////////
// cdxCSizingDialog::ControlInfo::Header
/////////////////////////////////////////////////////////////////////////////
/////////////////////////////////////////////////////////////////////////////
// Functions for my windowos
/////////////////////////////////////////////////////////////////////////////
/*
* OnInitDialog()
* Gets initial sizes of the window and makes sizing icon
*/
BOOL cdxCSizingDialog::ControlInfo::Header::OnInitDialog(UINT addSzByPcnt)
{
ASSERT(IsValid() && (m_iClientWid == -1));
CRect r;
WINDOWPLACEMENT wpl;
m_pWnd->GetClientRect(&r);
m_iClientWid = r.right - r.left;
m_iClientHi = r.bottom - r.top;
m_pWnd->GetWindowPlacement(&wpl);
m_iMinWid = wpl.rcNormalPosition.right - wpl.rcNormalPosition.left;
m_iMinHi = wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top;
// set up sizing icon
if(m_bSizeIcon)
{
if(!m_bmSizeIcon.LoadOEMBitmap(OBM_SIZE))
{
TRACE0(_T("*** ERROR[cdxCSizingDialog::ControlInfo::Header::OnInitDialog()]: LoadOEMBitmap() failed.\n"));
m_bSizeIcon = false;
}
else
{
CRect szr(r.Width()-24,r.Height()-24,r.Width(),r.Height());
if(!m_wndSizeIcon.Create(NULL,WS_CHILD|SS_BITMAP,szr,m_pWnd) ||
!m_wndSizeIcon.ModifyStyleEx(0,WS_EX_TRANSPARENT) )
{
TRACE0(_T("*** ERROR[cdxCSizingDialog::ControlInfo::Header::OnInitDialog()]: Can't create static icon control\n"));
m_bSizeIcon = false;
}
else
{
m_wndSizeIcon.SetBitmap(m_bmSizeIcon);
// now the icon has been resized to the real size of the icon
if(!m_wndSizeIcon.GetWindowPlacement(&wpl))
{
TRACE0(_T("*** ERROR[cdxCSizingDialog::ControlInfo::Header::OnInitDialog()]: Can't get windowplacement for sizeicon.\n"));
m_bSizeIcon = false;
}
else
{
wpl.flags = 0;
wpl.rcNormalPosition.left = r.Width() - (wpl.rcNormalPosition.right - wpl.rcNormalPosition.left);
wpl.rcNormalPosition.right = r.Width();
wpl.rcNormalPosition.top = r.Height() - (wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top);
wpl.rcNormalPosition.bottom= r.Height();
if(!m_wndSizeIcon.SetWindowPlacement(&wpl))
{
TRACE0(_T("*** ERROR[cdxCSizingDialog::ControlInfo::Header::OnInitDialog()]: Can't set windowplacement for sizeicon.\n"));
m_bSizeIcon = false;
}
else
{
AddSzControl(m_wndSizeIcon,mdRepos,mdRepos);
m_wndSizeIcon.ShowWindow(SW_SHOW); // finally - show it
}
}
}
}
}
if(addSzByPcnt)
StretchWindow(addSzByPcnt);
return TRUE;
}
/////////////////////////////////////////////////////////////////////////////
/*
* OnSize() handler
* Call before base classes' handler
*/
void cdxCSizingDialog::ControlInfo::Header::OnSize(UINT nType, int cx, int cy)
{
if((nType != SIZE_MINIMIZED) && (m_iClientWid != -1))
{
ASSERT((m_pWnd != NULL) && ::IsWindow(m_pWnd->m_hWnd));
ChangeSize(cx,cy);
}
}
/*
* tell system what minimum size we have
* call past original function
*/
void cdxCSizingDialog::ControlInfo::Header::OnGetMinMaxInfo(MINMAXINFO FAR* lpMMI)
{
ASSERT(m_pWnd != NULL);
if(::IsWindow(m_pWnd->m_hWnd) && (m_iClientWid != -1))
{
lpMMI->ptMinTrackSize.x = m_iMinWid;
lpMMI->ptMinTrackSize.y = m_iMinHi;
if(!(m_Freedom & fdVert))
lpMMI->ptMaxTrackSize.y = m_iMinHi;
if(!(m_Freedom & fdHoriz))
lpMMI->ptMaxTrackSize.x = m_iMinWid;
}
}
/////////////////////////////////////////////////////////////////////////////
/*
* this _really_ sizes/positions the controls
* call RedrawWindow() afterwards !
*/
bool cdxCSizingDialog::ControlInfo::Header::ChangeSize(int newWid, int newHi)
{
if(!IsValid() || (m_iClientWid == -1))
return false;
register int deltaX = newWid - m_iClientWid,
deltaY = newHi - m_iClientHi;
bool ok = true;
if(deltaX < 0)
{
ok = false;
deltaX = 0;
}
if(deltaY < 0)
{
deltaY = 0;
ok = false;
}
for(register ControlInfo *ci = m_pFirst; ci; ci = ci->GetNext())
ci->AdaptControlSize(deltaX,deltaY);
m_pWnd->RedrawWindow();
return ok;
}
/*
* force recalculation
*/
bool cdxCSizingDialog::ControlInfo::Header::ReorganizeControls(void)
{
ASSERT(IsValid());
CRect r;
m_pWnd->GetClientRect(&r);
return ChangeSize(r.Width(), r.Height());
}
/*
* resize dialog in all available directions
*/
void cdxCSizingDialog::ControlInfo::Header::StretchWindow(UINT addSzByPcnt)
{
ASSERT(IsValid());
register int delta;
WINDOWPLACEMENT wpl;
if(!m_pWnd->GetWindowPlacement(&wpl))
{
#ifdef _DEBUG
CString s;m_pWnd->GetWindowText(s);
if(s.IsEmpty())
s.Format(_T("<Address_0x%lx"),(UINT)this);
TRACE1(_T("*** ERROR[cdxCSizingDialog::ControlInfo::Header::StretchWindow()]: GetWindowPlacement() failed for dialog with caption \"%s\" !\n"),(LPCSTR)s);
#endif
return;
}
if(addSzByPcnt && (m_Freedom & fdHoriz))
{
delta = ((wpl.rcNormalPosition.right - wpl.rcNormalPosition.left) * addSzByPcnt) / (100/2);
if((wpl.rcNormalPosition.left -= delta) < 0)
wpl.rcNormalPosition.left = 0;
wpl.rcNormalPosition.right += delta;
}
if(addSzByPcnt && (m_Freedom & fdVert))
{
delta = ((wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top) * addSzByPcnt) / (100/2);
if((wpl.rcNormalPosition.top -= delta) < 0)
wpl.rcNormalPosition.top = 0;
wpl.rcNormalPosition.bottom += delta;
}
wpl.flags = 0;
m_pWnd->SetWindowPos(&wndBottom, wpl.rcNormalPosition.left,
wpl.rcNormalPosition.top,
wpl.rcNormalPosition.right - wpl.rcNormalPosition.left,
wpl.rcNormalPosition.bottom - wpl.rcNormalPosition.top,
SWP_NOACTIVATE|SWP_NOOWNERZORDER|SWP_NOREDRAW|SWP_NOZORDER);
}
/////////////////////////////////////////////////////////////////////////////
// cdxCSizingDialog::ControlInfo::Header utility functions: Sizing
/////////////////////////////////////////////////////////////////////////////
/*
* add a control that might be resized or repositioned
* (simple)
*/
cdxCSizingDialog::ControlInfo *cdxCSizingDialog::ControlInfo:
没有合适的资源?快使用搜索试试~ 我知道了~
商业编程-源码-对话框源代码 resizing_dlg_doc.zip
共6个文件
gif:3个
cpp:1个
h:1个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 183 浏览量
2022-06-22
22:50:52
上传
评论
收藏 27KB ZIP 举报
温馨提示
商业编程-源码-对话框源代码 resizing_dlg_doc.zip
资源推荐
资源详情
资源评论
收起资源包目录
商业编程-源码-对话框源代码 resizing_dlg_doc.zip (6个子文件)
对话框源代码 resizing_dlg_doc
example_small.gif 3KB
cdxCSizingDialog.h 16KB
example_big.gif 3KB
black_logo_small.gif 3KB
cdxCSizingDialog.cpp 22KB
cdxCSizingDialog.html 29KB
共 6 条
- 1
资源评论
programxh
- 粉丝: 17
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- mosquitto-2.018-install-windows-x64
- FTPServer FTP 服务器,绿色免安装,单文件
- 梦畅语音点名软件,上课点名
- 利用ADNI数据集和标签,在tensorflow框架上使用tensorlayer接口,通过架构u-net实现海马体的分割
- Kutools for Word v9.0 office word 插件
- 修复Windows 10 LTSC 2021资源占用率高
- Hash工具,小巧绿色hash校验工具,免费hash工具
- 重启进行BIOS快捷方式,不需要开机按BIOS键
- 鸭子开车记(儿童绘本)
- 威纶通触摸屏编程软件Easy builder pro V6.09.01.556安装包(2024.04).txt
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功