// 134123Dlg.cpp : implementation file
//
#include "stdafx.h"
#include "134123.h"
#include "134123Dlg.h"
#include "afxdialogex.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#endif
// CAboutDlg dialog used for App About
class CAboutDlg : public CDialogEx
{
public:
CAboutDlg();
// Dialog Data
enum { IDD = IDD_ABOUTBOX };
protected:
virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support
// Implementation
protected:
DECLARE_MESSAGE_MAP()
};
CAboutDlg::CAboutDlg() : CDialogEx(CAboutDlg::IDD)
{
}
void CAboutDlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
}
BEGIN_MESSAGE_MAP(CAboutDlg, CDialogEx)
END_MESSAGE_MAP()
// CMy134123Dlg dialog
CMy134123Dlg::CMy134123Dlg(CWnd* pParent /*=NULL*/)
: CDialogEx(CMy134123Dlg::IDD, pParent)
{
m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME);
}
void CMy134123Dlg::DoDataExchange(CDataExchange* pDX)
{
CDialogEx::DoDataExchange(pDX);
DDX_Control(pDX, IDC_LIST1, m_list);
DDX_Control(pDX, IDC_EDIT1, m_MyEdit);
}
BEGIN_MESSAGE_MAP(CMy134123Dlg, CDialogEx)
ON_WM_SYSCOMMAND()
ON_WM_PAINT()
ON_WM_QUERYDRAGICON()
ON_WM_VSCROLL()
ON_NOTIFY(LVN_BEGINSCROLL, IDC_LIST1, &CMy134123Dlg::OnBeginscrollList1)
ON_WM_CHAR()
ON_WM_KEYDOWN()
ON_COMMAND(IDOK, &CMy134123Dlg::OnIdok)
ON_EN_CHANGE(IDC_EDIT1, &CMy134123Dlg::OnChangeEdit1)
END_MESSAGE_MAP()
// CMy134123Dlg message handlers
BOOL CMy134123Dlg::OnInitDialog()
{
CDialogEx::OnInitDialog();
m_MyEdit.SetList(&m_list);
// Add "About..." menu item to system menu.
// IDM_ABOUTBOX must be in the system command range.
ASSERT((IDM_ABOUTBOX & 0xFFF0) == IDM_ABOUTBOX);
ASSERT(IDM_ABOUTBOX < 0xF000);
CMenu* pSysMenu = GetSystemMenu(FALSE);
if (pSysMenu != NULL)
{
BOOL bNameValid;
CString strAboutMenu;
bNameValid = strAboutMenu.LoadString(IDS_ABOUTBOX);
ASSERT(bNameValid);
if (!strAboutMenu.IsEmpty())
{
pSysMenu->AppendMenu(MF_SEPARATOR);
pSysMenu->AppendMenu(MF_STRING, IDM_ABOUTBOX, strAboutMenu);
}
}
// Set the icon for this dialog. The framework does this automatically
// when the application's main window is not a dialog
SetIcon(m_hIcon, TRUE); // Set big icon
SetIcon(m_hIcon, FALSE); // Set small icon
// TODO: Add extra initialization here
DWORD dwStyle=GetWindowLong(m_list.m_hWnd,GWL_STYLE);
SetWindowLong(m_list.m_hWnd,GWL_STYLE,dwStyle|LVS_REPORT);
DWORD styles=m_list.GetExtendedStyle();
m_list.SetExtendedStyle(styles|LVS_EX_FULLROWSELECT|LVS_EX_GRIDLINES);
TCHAR *rgtsz[2]={_T( "名称"),_T( "地址")};
LV_COLUMN lvcolumn;
CRect m_rect;
m_list.GetWindowRect(&m_rect);
for (int i=0;i<2;i++)
{
lvcolumn.mask=LVCF_FMT|LVCF_SUBITEM|LVCF_TEXT|LVCF_WIDTH|LVCF_ORDER;
lvcolumn.fmt=LVCFMT_LEFT;
lvcolumn.pszText=rgtsz[i];
lvcolumn.iSubItem=i;
lvcolumn.iOrder=i;
if (i==0)
{
for (int j=0;j<2;j++)
{
lvcolumn.cx=m_rect.Width()/2+21;
}
}
else
{
for (int j=0;j<2;j++)
{
lvcolumn.cx=360;
}
}
m_list.InsertColumn(i,&lvcolumn);
}
for (int k=0;k<20;k++)
{
m_list.InsertItem(k,_T("1"));
}
m_list.InsertItem(21,_T("15"));
m_list.InsertItem(22,_T("6"));
m_list.InsertItem(23,_T("17"));
return TRUE; // return TRUE unless you set the focus to a control
}
void CMy134123Dlg::OnSysCommand(UINT nID, LPARAM lParam)
{
if ((nID & 0xFFF0) == IDM_ABOUTBOX)
{
CAboutDlg dlgAbout;
dlgAbout.DoModal();
}
else
{
CDialogEx::OnSysCommand(nID, lParam);
}
}
// If you add a minimize button to your dialog, you will need the code below
// to draw the icon. For MFC applications using the document/view model,
// this is automatically done for you by the framework.
void CMy134123Dlg::OnPaint()
{
if (IsIconic())
{
CPaintDC dc(this); // device context for painting
SendMessage(WM_ICONERASEBKGND, reinterpret_cast<WPARAM>(dc.GetSafeHdc()), 0);
// Center icon in client rectangle
int cxIcon = GetSystemMetrics(SM_CXICON);
int cyIcon = GetSystemMetrics(SM_CYICON);
CRect rect;
GetClientRect(&rect);
int x = (rect.Width() - cxIcon + 1) / 2;
int y = (rect.Height() - cyIcon + 1) / 2;
// Draw the icon
dc.DrawIcon(x, y, m_hIcon);
}
else
{
CDialogEx::OnPaint();
}
}
// The system calls this function to obtain the cursor to display while the user drags
// the minimized window.
HCURSOR CMy134123Dlg::OnQueryDragIcon()
{
return static_cast<HCURSOR>(m_hIcon);
}
void CMy134123Dlg::OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar)
{
// TODO: Add your message handler code here and/or call default
CDialogEx::OnVScroll(nSBCode, nPos, pScrollBar);
}
void CMy134123Dlg::OnBeginscrollList1(NMHDR *pNMHDR, LRESULT *pResult)
{
// This feature requires Internet Explorer 5.5 or greater.
// The symbol _WIN32_IE must be >= 0x0560.
LPNMLVSCROLL pStateChanged = reinterpret_cast<LPNMLVSCROLL>(pNMHDR);
// TODO: Add your control notification handler code here
*pResult = 0;
}
void CMy134123Dlg::OnIdok()
{
// TODO: Add your command handler code here
}
void CMy134123Dlg::OnChangeEdit1()
{
// TODO: If this is a RICHEDIT control, the control will not
// send this notification unless you override the CDialogEx::OnInitDialog()
// function and call CRichEditCtrl().SetEventMask()
// with the ENM_CHANGE flag ORed into the mask.
// TODO: Add your control notification handler code here
}

xlm289348
- 粉丝: 96
- 资源: 10
会员权益专享
最新资源
- .archivetemp足球分析安装4.3.msi
- 单文件获取摄像头动作侦测信息,资源占用少,随地部署,有外联钩子,发生动作可访问指定网址
- Apress.Advanced.Social.Media.Marketing.Dec.2012
- 2022年中华人民共和国县以上行政区划代码
- GPT聊天工具.apk
- 真由光伏、蓄电池及负载组成的独立直流微电网,提出电压和电流分段式协同控制策略 该控制策略将能量管理划分为 4 种工作模式,采用最
- 光伏储能交直流微电网Matlab/simulink仿真模型
- 光伏MPPT控制算法仿真模型
- lmsq_v2.3.38.5_release_2338_jiagu_sign(4).apk
- 鞋go 1.1.0.apk
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈


