SlideShare a Scribd company logo
1 of 26
List
Add the folowing variables:
Ctrl ID Var name Category Var type
IDC_COMBO1 m_ctrlCombo Control CComboBox
m_strCombo Value CString
IDC_LIST1 m_ctrlList Control CListCtrl
In ListDlg.h add:
…………
// Implementation
protected:
HICON m_hIcon;
CImageList m_imageLarge;
CImageList m_imageSmall;
………………………………….
Initialize the var in CListDlg::OnInitDialog()
……………….
// TODO: Add extra initialization here
m_ctrlCombo.AddString("Icon");
m_ctrlCombo.AddString("Small");
m_ctrlCombo.AddString("List");
m_ctrlCombo.AddString("Report");
m_imageLarge.Create(
IDB_BITMAP1, 32, 1, RGB(255, 255, 255));
m_imageSmall.Create(
IDB_BITMAP2, 16, 1, RGB(255, 255, 255));
m_ctrlList.SetImageList(&m_imageLarge,LVSIL_NORMAL);
m_ctrlList.SetImageList(&m_imageSmall,LVSIL_SMALL);
// Create list view columns
LV_COLUMN listColumn;
char* arColumns[3] = { "Orase", "Universitati", "Simboluri" };
listColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT |
LVCF_SUBITEM;
listColumn.fmt = LVCFMT_LEFT;
listColumn.cx = 60;
for (int nColumn = 0; nColumn < 3; nColumn++)
{
listColumn.iSubItem = nColumn;
listColumn.pszText = arColumns[nColumn];
m_ctrlList.InsertColumn(nColumn, &listColumn);
}
// Add list items
LV_ITEM listItem;
listItem.mask = LVIF_TEXT | LVIF_IMAGE;
listItem.iSubItem = 0;
char* arOrase[3] = { "Iasi", "Bucuresti", "Cluj" };
char* arUniversitati[3] = { "Al.I.Cuza", "Bucuresti", "Babes Bolay" };
char* arSimboluri[3] = { "Palatul Culturii", "Casa Poporului", "Universitatea" };
for (int nItem = 0; nItem < 3; nItem++)
{
listItem.iItem = nItem;
listItem.pszText = arOrase[nItem];
listItem.iImage = nItem % 2;
m_ctrlList.InsertItem(&listItem);
m_ctrlList.SetItemText(nItem, 1, arUniversitati[nItem]);
m_ctrlList.SetItemText(nItem, 2, arSimboluri[nItem]);
}
SetListView(LVS_REPORT);
m_ctrlCombo.SetCurSel(2);
return TRUE; // return TRUE unless you set the focus to a control
}
void CListDlg::SetListView(DWORD dwNewStyle)
{
// TODO: Add your implementation code here.
DWORD dwOldStyle;
HWND hWndList;
hWndList = m_ctrlList.GetSafeHwnd();
dwOldStyle = GetWindowLong(hWndList,GWL_STYLE);
if ((dwOldStyle & LVS_TYPEMASK) !=dwNewStyle)
{
dwOldStyle &= ~LVS_TYPEMASK;
dwNewStyle |= dwOldStyle;
SetWindowLong(hWndList, GWL_STYLE,dwNewStyle);
}
}
void CListDlg::OnSelchangeCombo1()
{
// TODO: Add your control notification handler code here
m_ctrlCombo.GetLBText(
m_ctrlCombo.GetCurSel(), m_strCombo);
CString str = m_strCombo;
str.MakeUpper();
if (str == "ICON") SetListView(LVS_ICON);
else if (str == "REPORT")
SetListView(LVS_REPORT);
else if (str == "LIST") SetListView(LVS_LIST);
else if (str == "SMALL")
SetListView(LVS_SMALLICON);
}
MFC List

More Related Content

Similar to MFC List

PROGRAM KONVERSI CITRA BERWARNA MENJADI CITRA GRAYSCALE
PROGRAM KONVERSI CITRA BERWARNA MENJADI  CITRA GRAYSCALEPROGRAM KONVERSI CITRA BERWARNA MENJADI  CITRA GRAYSCALE
PROGRAM KONVERSI CITRA BERWARNA MENJADI CITRA GRAYSCALE
Lesmardin Hasugian
 
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
changehee lee
 
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装からcocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
Yuichi Higuchi
 
GameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdfGameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdf
aravlitraders2012
 
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMINGFINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
Amira Dolce Farhana
 

Similar to MFC List (20)

PROGRAM KONVERSI CITRA BERWARNA MENJADI CITRA GRAYSCALE
PROGRAM KONVERSI CITRA BERWARNA MENJADI  CITRA GRAYSCALEPROGRAM KONVERSI CITRA BERWARNA MENJADI  CITRA GRAYSCALE
PROGRAM KONVERSI CITRA BERWARNA MENJADI CITRA GRAYSCALE
 
426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer Tools426 lecture 4: AR Developer Tools
426 lecture 4: AR Developer Tools
 
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
개발 과정 최적화 하기 내부툴로 더욱 강력한 개발하기 Stephen kennedy _(11시40분_103호)
 
cocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装からcocos2d 事例編 HungryMasterの実装から
cocos2d 事例編 HungryMasterの実装から
 
Billing in a supermarket c++
Billing in a supermarket c++Billing in a supermarket c++
Billing in a supermarket c++
 
Awt components
Awt componentsAwt components
Awt components
 
COSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer ToolsCOSC 426 Lect. 3 -AR Developer Tools
COSC 426 Lect. 3 -AR Developer Tools
 
MFC Calculator 2
MFC Calculator 2MFC Calculator 2
MFC Calculator 2
 
5 Rmi Print
5  Rmi Print5  Rmi Print
5 Rmi Print
 
C++ Language
C++ LanguageC++ Language
C++ Language
 
Part II: LLVM Intermediate Representation
Part II: LLVM Intermediate RepresentationPart II: LLVM Intermediate Representation
Part II: LLVM Intermediate Representation
 
MFC Map2
MFC Map2MFC Map2
MFC Map2
 
Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3Microsoft dynamics ax 2012 development introduction part 2/3
Microsoft dynamics ax 2012 development introduction part 2/3
 
GameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdfGameOfLife.cs using System; using System.Collections.Generic;.pdf
GameOfLife.cs using System; using System.Collections.Generic;.pdf
 
Templates exception handling
Templates exception handlingTemplates exception handling
Templates exception handling
 
C programs Set 2
C programs Set 2C programs Set 2
C programs Set 2
 
DesignPatterns-IntroPresentation.pptx
DesignPatterns-IntroPresentation.pptxDesignPatterns-IntroPresentation.pptx
DesignPatterns-IntroPresentation.pptx
 
C++20 the small things - Timur Doumler
C++20 the small things - Timur DoumlerC++20 the small things - Timur Doumler
C++20 the small things - Timur Doumler
 
C++ amp on linux
C++ amp on linuxC++ amp on linux
C++ amp on linux
 
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMINGFINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
FINAL PAPER FP301 OBJECT ORIENTED PROGRAMMING
 

More from Razvan Raducanu, PhD

More from Razvan Raducanu, PhD (20)

12. edit record
12. edit record12. edit record
12. edit record
 
11. delete record
11. delete record11. delete record
11. delete record
 
10. view one record
10. view one record10. view one record
10. view one record
 
9. add new record
9. add new record9. add new record
9. add new record
 
8. vederea inregistrarilor
8. vederea inregistrarilor8. vederea inregistrarilor
8. vederea inregistrarilor
 
7. copy1
7. copy17. copy1
7. copy1
 
6. hello popescu 2
6. hello popescu 26. hello popescu 2
6. hello popescu 2
 
5. hello popescu
5. hello popescu5. hello popescu
5. hello popescu
 
4. forme in zend framework 3
4. forme in zend framework 34. forme in zend framework 3
4. forme in zend framework 3
 
3. trimiterea datelor la vederi
3. trimiterea datelor la vederi3. trimiterea datelor la vederi
3. trimiterea datelor la vederi
 
2.routing in zend framework 3
2.routing in zend framework 32.routing in zend framework 3
2.routing in zend framework 3
 
1. zend framework intro
1. zend framework intro1. zend framework intro
1. zend framework intro
 
18. images in symfony 4
18. images in symfony 418. images in symfony 4
18. images in symfony 4
 
17. delete data
17. delete data17. delete data
17. delete data
 
16. edit data
16. edit data16. edit data
16. edit data
 
15. view single data
15. view single data15. view single data
15. view single data
 
14. add data in symfony4
14. add data in symfony4 14. add data in symfony4
14. add data in symfony4
 
13. view data
13. view data13. view data
13. view data
 
12.doctrine view data
12.doctrine view data12.doctrine view data
12.doctrine view data
 
11. move in Symfony 4
11. move in Symfony 411. move in Symfony 4
11. move in Symfony 4
 

Recently uploaded

Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
EADTU
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
EADTU
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
中 央社
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
中 央社
 

Recently uploaded (20)

When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...When Quality Assurance Meets Innovation in Higher Education - Report launch w...
When Quality Assurance Meets Innovation in Higher Education - Report launch w...
 
8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management8 Tips for Effective Working Capital Management
8 Tips for Effective Working Capital Management
 
How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17How To Create Editable Tree View in Odoo 17
How To Create Editable Tree View in Odoo 17
 
MOOD STABLIZERS DRUGS.pptx
MOOD     STABLIZERS           DRUGS.pptxMOOD     STABLIZERS           DRUGS.pptx
MOOD STABLIZERS DRUGS.pptx
 
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
Transparency, Recognition and the role of eSealing - Ildiko Mazar and Koen No...
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17How to Send Pro Forma Invoice to Your Customers in Odoo 17
How to Send Pro Forma Invoice to Your Customers in Odoo 17
 
Improved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio AppImproved Approval Flow in Odoo 17 Studio App
Improved Approval Flow in Odoo 17 Studio App
 
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes GuàrdiaPersonalisation of Education by AI and Big Data - Lourdes Guàrdia
Personalisation of Education by AI and Big Data - Lourdes Guàrdia
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
TỔNG HỢP HƠN 100 ĐỀ THI THỬ TỐT NGHIỆP THPT TOÁN 2024 - TỪ CÁC TRƯỜNG, TRƯỜNG...
 
e-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopale-Sealing at EADTU by Kamakshi Rajagopal
e-Sealing at EADTU by Kamakshi Rajagopal
 
An overview of the various scriptures in Hinduism
An overview of the various scriptures in HinduismAn overview of the various scriptures in Hinduism
An overview of the various scriptures in Hinduism
 
An Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge AppAn Overview of the Odoo 17 Knowledge App
An Overview of the Odoo 17 Knowledge App
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
Major project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategiesMajor project report on Tata Motors and its marketing strategies
Major project report on Tata Motors and its marketing strategies
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 

MFC List

  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12. Add the folowing variables: Ctrl ID Var name Category Var type IDC_COMBO1 m_ctrlCombo Control CComboBox m_strCombo Value CString IDC_LIST1 m_ctrlList Control CListCtrl
  • 13. In ListDlg.h add: ………… // Implementation protected: HICON m_hIcon; CImageList m_imageLarge; CImageList m_imageSmall; ………………………………….
  • 14. Initialize the var in CListDlg::OnInitDialog() ………………. // TODO: Add extra initialization here m_ctrlCombo.AddString("Icon"); m_ctrlCombo.AddString("Small"); m_ctrlCombo.AddString("List"); m_ctrlCombo.AddString("Report"); m_imageLarge.Create( IDB_BITMAP1, 32, 1, RGB(255, 255, 255)); m_imageSmall.Create( IDB_BITMAP2, 16, 1, RGB(255, 255, 255)); m_ctrlList.SetImageList(&m_imageLarge,LVSIL_NORMAL); m_ctrlList.SetImageList(&m_imageSmall,LVSIL_SMALL);
  • 15. // Create list view columns LV_COLUMN listColumn; char* arColumns[3] = { "Orase", "Universitati", "Simboluri" }; listColumn.mask = LVCF_FMT | LVCF_WIDTH | LVCF_TEXT | LVCF_SUBITEM; listColumn.fmt = LVCFMT_LEFT; listColumn.cx = 60; for (int nColumn = 0; nColumn < 3; nColumn++) { listColumn.iSubItem = nColumn; listColumn.pszText = arColumns[nColumn]; m_ctrlList.InsertColumn(nColumn, &listColumn); }
  • 16. // Add list items LV_ITEM listItem; listItem.mask = LVIF_TEXT | LVIF_IMAGE; listItem.iSubItem = 0; char* arOrase[3] = { "Iasi", "Bucuresti", "Cluj" }; char* arUniversitati[3] = { "Al.I.Cuza", "Bucuresti", "Babes Bolay" }; char* arSimboluri[3] = { "Palatul Culturii", "Casa Poporului", "Universitatea" }; for (int nItem = 0; nItem < 3; nItem++) { listItem.iItem = nItem; listItem.pszText = arOrase[nItem]; listItem.iImage = nItem % 2; m_ctrlList.InsertItem(&listItem); m_ctrlList.SetItemText(nItem, 1, arUniversitati[nItem]); m_ctrlList.SetItemText(nItem, 2, arSimboluri[nItem]); } SetListView(LVS_REPORT); m_ctrlCombo.SetCurSel(2); return TRUE; // return TRUE unless you set the focus to a control }
  • 17.
  • 18.
  • 19.
  • 20.
  • 21. void CListDlg::SetListView(DWORD dwNewStyle) { // TODO: Add your implementation code here. DWORD dwOldStyle; HWND hWndList; hWndList = m_ctrlList.GetSafeHwnd(); dwOldStyle = GetWindowLong(hWndList,GWL_STYLE); if ((dwOldStyle & LVS_TYPEMASK) !=dwNewStyle) { dwOldStyle &= ~LVS_TYPEMASK; dwNewStyle |= dwOldStyle; SetWindowLong(hWndList, GWL_STYLE,dwNewStyle); } }
  • 22.
  • 23.
  • 24.
  • 25. void CListDlg::OnSelchangeCombo1() { // TODO: Add your control notification handler code here m_ctrlCombo.GetLBText( m_ctrlCombo.GetCurSel(), m_strCombo); CString str = m_strCombo; str.MakeUpper(); if (str == "ICON") SetListView(LVS_ICON); else if (str == "REPORT") SetListView(LVS_REPORT); else if (str == "LIST") SetListView(LVS_LIST); else if (str == "SMALL") SetListView(LVS_SMALLICON); }