Click here to Skip to main content
15,908,931 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: Issue with localtime() Pin
Member 38480949-Mar-09 11:39
Member 38480949-Mar-09 11:39 
GeneralRe: Issue with localtime() Pin
Yusuf9-Mar-09 13:42
Yusuf9-Mar-09 13:42 
AnswerRe: Issue with localtime() Pin
Don Rummelhart10-Mar-09 11:25
Don Rummelhart10-Mar-09 11:25 
QuestionPath of Root and Virtual directory in ISAPI ? Pin
mmayur9-Mar-09 8:35
mmayur9-Mar-09 8:35 
QuestionDoubt on how the document object is retrieved to the application class in MFC Document View Architecture Pin
sarathbabununna9-Mar-09 7:55
sarathbabununna9-Mar-09 7:55 
AnswerRe: Doubt on how the document object is retrieved to the application class in MFC Document View Architecture Pin
David Crow9-Mar-09 8:26
David Crow9-Mar-09 8:26 
AnswerRe: Doubt on how the document object is retrieved to the application class in MFC Document View Architecture Pin
Iain Clarke, Warrior Programmer10-Mar-09 1:36
Iain Clarke, Warrior Programmer10-Mar-09 1:36 
QuestionScroll Bars and Input Fields Pin
BobInNJ9-Mar-09 7:44
BobInNJ9-Mar-09 7:44 
I have written a simple application that has a horizontal scroll bar and an input field of type
CEdit. Here is the class definition for the main window.

class CMainWindow : public CFrameWnd {<br />
<br />
<br />
public:<br />
	CMainWindow();<br />
	<br />
protected:<br />
	afx_msg int OnCreate( LPCREATESTRUCT );<br />
	afx_msg void OnSize( UINT nType, int cx, int cy );<br />
<br />
	afx_msg void OnPaint();<br />
	afx_msg void OnHScroll( UINT nCode, UINT nPos, CScrollBar *pScrollBar );<br />
<br />
	DECLARE_MESSAGE_MAP()<br />
<br />
private:<br />
<br />
	int charWidth;<br />
<br />
	int m_nPageWidth;<br />
	int m_HorzScrollPos;<br />
<br />
	CEdit input1;<br />
<br />
};


Here is the code that I use to create the window:
<br />
int<br />
CMainWindow::OnCreate( LPCREATESTRUCT lpcs )<br />
{<br />
	if ( CFrameWnd::OnCreate( lpcs ) == -1 )<br />
		return -1;<br />
<br />
	<br />
	TEXTMETRIC tm;<br />
	CClientDC dc(this);<br />
	dc.GetTextMetrics( &tm );<br />
<br />
	charWidth = tm.tmAveCharWidth;<br />
<br />
	input1.CreateEx( WS_EX_CLIENTEDGE, TEXT("edit"), NULL,<br />
                WS_CHILD | WS_VISIBLE | WS_BORDER | WS_TABSTOP | ES_AUTOHSCROLL,<br />
                    150, 125, 60, 20,<br />
                    m_hWnd, (HMENU)500, NULL );<br />
	return 0;<br />
}


Here is the code I use to paint the window:
void<br />
CMainWindow::OnPaint()<br />
{<br />
    CPaintDC dc(this);<br />
    dc.SetWindowOrg( m_HorzScrollPos, 0 );<br />
    dc.TextOut( 150, 100,<br />
      TEXT( "This is a very long string which I hope will take up most of the line" ), 69 );<br />
}


The code, mostly, works. However, I do have one issue. If I run the program and using the mouse I make the window small (in the horizontal direction) a horizontal scroll bar shows up. This is to be expected. I then use the mouse to move the scroll bar to the middle of the window. Now, I minimize the window and then maximize the window. After doing this, I would expect the text and the input field (of type CEdit) to be drawn aligned on the screen. However, this is not the case. The text is shifted to the right (at least relative to the input field). I do not understand why and I am hoping somebody here can tell me what I am missing.

Thanks

Bob
QuestionCHtmlView not displaying anything [modified] Pin
Brahmandcoder9-Mar-09 7:08
Brahmandcoder9-Mar-09 7:08 
QuestionAccessing Private member of a base Class from a Derived Class Pin
ForNow9-Mar-09 6:36
ForNow9-Mar-09 6:36 
AnswerRe: Accessing Private member of a base Class from a Derived Class Pin
BobInNJ9-Mar-09 7:32
BobInNJ9-Mar-09 7:32 
QuestionRe: Accessing Private member of a base Class from a Derived Class Pin
David Crow9-Mar-09 8:28
David Crow9-Mar-09 8:28 
AnswerRe: Accessing Private member of a base Class from a Derived Class Pin
ForNow9-Mar-09 12:23
ForNow9-Mar-09 12:23 
GeneralRe: Accessing Private member of a base Class from a Derived Class Pin
ForNow9-Mar-09 12:33
ForNow9-Mar-09 12:33 
QuestionI use these two functions that I have copied from codeproject to use static text in application. But everytime I put a command button in my applicatio Pin
Astitva239-Mar-09 5:10
Astitva239-Mar-09 5:10 
AnswerRe: I use these two functions that I have copied from codeproject to use static text in application. But everytime I put a command button in my applicatio Pin
Eytukan9-Mar-09 5:31
Eytukan9-Mar-09 5:31 
Generaloverlayered text Pin
Astitva239-Mar-09 5:57
Astitva239-Mar-09 5:57 
GeneralRe: overlayered text Pin
Eytukan9-Mar-09 6:03
Eytukan9-Mar-09 6:03 
GeneralRe: overlayered text Pin
Astitva239-Mar-09 8:05
Astitva239-Mar-09 8:05 
Questionunicode application Pin
tom groezer9-Mar-09 4:47
tom groezer9-Mar-09 4:47 
QuestionRe: unicode application Pin
David Crow9-Mar-09 4:49
David Crow9-Mar-09 4:49 
AnswerRe: unicode application Pin
Eytukan9-Mar-09 5:04
Eytukan9-Mar-09 5:04 
GeneralRe: unicode application Pin
tom groezer9-Mar-09 7:03
tom groezer9-Mar-09 7:03 
GeneralRe: unicode application Pin
Eytukan9-Mar-09 7:35
Eytukan9-Mar-09 7:35 
GeneralRe: unicode application Pin
tom groezer9-Mar-09 7:45
tom groezer9-Mar-09 7:45 

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.