A Line Picker


Application Security Testing: An Integral Part of DevOps

The following application uses source code from Icon Picker Combo Box by Joel Wahlberg and A Color Picker by Luis Ortega.

The LinePickerDlg class implements a dialog designed to allow the selection of Style, Width, and Color attributes for a CPen object:

Environment: VC6

To use this Line Picker dialog, follow these steps:

How to Include Line Picker in Your Project

  • Include the following files in your project:
    • LinePickerDlg.cpp
    • LinePickerDlg.h
    • Colorbtn.cpp
    • Colorbtn.h
    • Linecbbox.cpp
    • Linecbbox.h
  • Copy "Other.rc" into your "res" directory.
  • Add this line to your rc2 file: #include "Other.rc". Make sure to place a Carriage Return after this line, to avoid the "fatal error RC1004: unexpected end of file found" message.
  • Include the line #include "LinePickerDlg.h" in your C++ file.
  • Include the line #define IDD_LINEPICKERDLG (5110) in your class header file or in your "Resource.h" file.

How to Use Line Picker

Use the following code to modify the line attributes:

// Create Dialog
CLinePickerDlg *pdlg;
pdlg = new CLinePickerDlg();

// Initialize
// (make sure member variables themselves have been previously
//  initialized)

// Run modal loop
if(IDOK == pdlg->RunModalLoop(MLF_SHOWONIDLE)){
  // Retrieve new line attributes...
  m_crColor = pdlg->GetColor();
  m_nStyle  = pdlg->GetStyle();
  m_nWidth  = pdlg->GetWidth();
  // ...and redraw Dialog

// Clean up!
delete pdlg;

To draw thick dotted lines—for instance, from within your OnPaint() method—you will need to use the second version of the CPen constructor:

lb.lbStyle = BS_SOLID;
lb.lbColor = m_crColor;
CPen CurPen(PS_GEOMETRIC | m_nStyle, m_nWidth, &lb);
CPen *pOldPen = dc.SelectObject(&CurPen);


Download demo project - 46 Kb
Download source - 12 Kb


  • What for do you set focus on "OK" button after changing of selection in combo?

    Posted by Legacy on 10/24/2003 12:00am

    Originally posted by: Serguei

    What for do you set focus on "OK" button after changing of selection in combo? It's very hard to select anything in combo using a keyboard.

  • You must have javascript enabled in order to post comments.

Leave a Comment
  • Your email address will not be published. All fields are required.

Top White Papers and Webcasts

  • As all sorts of data becomes available for storage, analysis and retrieval - so called 'Big Data' - there are potentially huge benefits, but equally huge challenges...
  • The agile organization needs knowledge to act on, quickly and effectively. Though many organizations are clamouring for "Big Data", not nearly as many know what to do with it...
  • Cloud-based integration solutions can be confusing. Adding to the confusion are the multiple ways IT departments can deliver such integration...

Most Popular Programming Stories

More for Developers

RSS Feeds

Thanks for your registration, follow us on our social networks to keep up-to-date
We have made updates to our Privacy Policy to reflect the implementation of the General Data Protection Regulation.