Click here to Skip to main content
15,909,747 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: How can I EDIT/DELETE Excel-records Pin
Erik Funkenbusch10-Oct-00 11:20
Erik Funkenbusch10-Oct-00 11:20 
QuestionThread & Message pb? Pin
Ori10-Oct-00 2:15
Ori10-Oct-00 2:15 
AnswerRe: Thread & Message pb? Pin
Ori10-Oct-00 2:45
Ori10-Oct-00 2:45 
AnswerRe: Thread & Message pb? Pin
Erik Funkenbusch10-Oct-00 11:22
Erik Funkenbusch10-Oct-00 11:22 
GeneralRe: Thread & Message pb? Pin
Ori11-Oct-00 1:50
Ori11-Oct-00 1:50 
GeneralRe: Thread & Message pb? Pin
Erik Funkenbusch11-Oct-00 10:15
Erik Funkenbusch11-Oct-00 10:15 
AnswerRe: Thread & Message pb? Pin
Mark Jones18-Oct-00 11:25
Mark Jones18-Oct-00 11:25 
QuestionCan anyone help me draw to a picture control? Pin
Rick Gungadoo10-Oct-00 1:15
sussRick Gungadoo10-Oct-00 1:15 
Greetings,
I have been stuck with this problem for a while and I cannot see what I'm doing wrong. I'd be grateful is anyone could point me in the right direction.
I have a class whose constructor is :
CMyClass::CMyClass() : CPropertyPage(CMyClass::IDD)
{
some stuff
}

Then I have,
BOOL CMyClass::OnSetActive()
{
static doneInit = FALSE;
BOOL bResult = CPropertyPage::OnSetActive();
if (!doneInit)
{
doneInit = TRUE;
if(m_WindowOut)
delete m_WindowOut;
m_WindowOut= new CWnd;

CRect rect1;
GetDlgItem(IDC_PROCESSED_WAVE)->GetWindowRect(rect1);
ScreenToClient(rect1);
m_WindowOut->CreateEx(WS_EX_CLIENTEDGE|WS_EX_STATICEDGE, AfxRegisterWndClass(CS_HREDRAW|CS_VREDRAW),NULL,WS_CHILD|WS_VISIBLE,
rect1,this, 1234);

CDialog::OnInitDialog();
}
return bResult;
}

where IDC_PROCESSED_WAVE is a picture control that I have on my dialog and
is where I would like to do the drawing and m_WindowOut is defined in
MyClass.h as public and as CWnd* m_WindowOut;
Finally the offending code:

void CMyClass::OnPaint()
{
int amp;
//CDialog::OnPaint();

CPaintDC dc(m_WindowOut);

CPen* pOldPen;
CPen pen(PS_SOLID,0,RGB(0,255,0));
pOldPen = dc.SelectObject(&pen);

CRect rcClient;
m_WindowOut->GetClientRect(&rcClient);

for(int i = 0; i < rcClient.Width(); ++i){
amp = (rand()% 15)% (rcClient.Height() / 2);
dc.MoveTo (rcClient.left + i, rcClient.top + (rcClient.Height()/2) -
amp);
dc.LineTo (rcClient.left + i, rcClient.top + (rcClient.Height()/2) +
amp);

dc.SelectObject(pOldPen);
m_WindowOut->Invalidate(TRUE);
}

// TODO: Add your message handler code here

// Do not call CPropertyPage::OnPaint() for painting messages

CDialog::OnPaint();
}

Unfortunately, nothing is drawn on my picture control and I don't have a
clue why. Please help if you can.
Regards
Rick
Questionhow to change the font for a label Pin
Mac9-Oct-00 22:10
Mac9-Oct-00 22:10 
AnswerRe: how to change the font for a label Pin
frydaysoft.de10-Oct-00 7:25
sussfrydaysoft.de10-Oct-00 7:25 
QuestionStrings from a text file or database? Pin
Fredrik9-Oct-00 21:40
Fredrik9-Oct-00 21:40 
GeneralTitleBar Text Pin
Frank Deo9-Oct-00 11:14
Frank Deo9-Oct-00 11:14 
GeneralMS Access 2000 and VC6 Pin
Gozer9-Oct-00 9:48
Gozer9-Oct-00 9:48 
GeneralWin32API/GDI/Fonts Pin
Kirill Sherman9-Oct-00 9:29
sussKirill Sherman9-Oct-00 9:29 
GeneralCopy constructor in Exception Class Pin
Robin8-Oct-00 16:41
Robin8-Oct-00 16:41 
GeneralRe: Copy constructor in Exception Class Pin
Tim Deveaux9-Oct-00 5:08
Tim Deveaux9-Oct-00 5:08 
GeneralSingle Document naming Pin
kin8-Oct-00 13:28
kin8-Oct-00 13:28 
GeneralRe: Single Document naming Pin
Tim Deveaux8-Oct-00 14:48
Tim Deveaux8-Oct-00 14:48 
GeneralRe: Single Document naming Pin
Sam Hobbs9-Oct-00 20:27
Sam Hobbs9-Oct-00 20:27 
GeneralEnabling/graying normal menu items? (Win 2000) Pin
Martin Vrbovsky8-Oct-00 12:09
sussMartin Vrbovsky8-Oct-00 12:09 
GeneralRe: Enabling/graying normal menu items? (Win 2000) Pin
Michael Dunn9-Oct-00 9:58
sitebuilderMichael Dunn9-Oct-00 9:58 
General*** Displaying TABLES from Access in a MFC application *** Pin
Steve Lai8-Oct-00 8:53
Steve Lai8-Oct-00 8:53 
General*** Saving TABLES from Access with MFC application *** Pin
Steve Lai8-Oct-00 8:52
Steve Lai8-Oct-00 8:52 
Generaldocking Pin
mike99998-Oct-00 6:53
mike99998-Oct-00 6:53 
Generalhwnd of other windows Pin
valec8-Oct-00 5:47
valec8-Oct-00 5:47 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.