|
when you will scroll the window it will be repainted always.
if you want the the image to be displayed all time you have to handle in OrDraw/OnPaint only.
|
|
|
|
|
I dont understand,can you more explain?
|
|
|
|
|
i m opening a image in OnFileOpen function it opens finebut when i start scrolling it disappears.
When the it is done in OnDraw function it is displaying image while scrolling. Please Help.
|
|
|
|
|
First you need handler methods for scrolling, which update the scrolled coordinates (usually the upper-left corner's coordinates). In these methods add: Invalidate ();
The Invalidate () method will cause OnDraw () to be invoked. Your OnDraw () method should draw the image, starting at the current scrolled coordinates.
An alternative is to use the CScrollView class, which handles scrolling for you. If you do this, the OnDraw () method should just draw the whole image.
|
|
|
|
|
How to change the name of MFC single document application
from Untitled to desired one?
|
|
|
|
|
If you wish to change the window title you can simply use SetWindowText.
if you just want get rid of "untitled" then you have to change in initinstance to say cmdNothing explictly.
|
|
|
|
|
Thanks SetWindowText working fine...
|
|
|
|
|
In CMainFrame::PreCreateWindow add this.
cs.style &= ~FWS_ADDTOTITLE ;
This would remove the "untitled" string form the title and then you can use SetWindowText to show what you want.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
How to maximize a window in MFC application? Window should be automatically maximized as application gets executed.
|
|
|
|
|
Do you need to SW_MAXIMIZE(ShowWindow)?
|
|
|
|
|
Thanks ShowWindow working fine...
|
|
|
|
|
You're welcome.
|
|
|
|
|
if you want window to be maximized by default when applicaiton start just modify the window style for WS_MAXIMIZE..
|
|
|
|
|
Hi,
I have an application very similar to the MTMDI sample from MSDN but instead
of deriving CBounceWnd from CWnd and drawing a flying ball I derived it
from CDialog and placed there some controls (CButton and CEdit).
So I have a window running in a separate thread with a parent window in the
main thread.
But on moving/resizing the CBounceWnd is not painted correctly. It has areas
which are not repainted.
We have a workaround for solving a problem with painting in 2 UI threads and
I would be VERY glad if you have any ideas about risks of implementing it.
Say, CSeparateThreadWnd is a CWnd that runs in a separate thread and has a
parent in the main thread. And we do the following:
BOOL CSeparateThreadWnd::PreTranslateMessage(MSG* pMsg)
{
return m_pParentWnd->SendMessage(ID_SOMETHING, reinterpret_cast<wparam>(pMsg), 0);
}
LRESULT CParentWnd::OnID_SOMETHING(WPARAM i_wParam, LPARAM)
{
return AfxPreTranslateMessage(reinterpret_cast<msg*>(i_wParam));
}
</msg*></wparam>
I suppose it's related to the fact that MFC has two different
Permanent HWND<->CWnd maps for 2 threads and when PreTranslateMessage()
is executed in the second thread it reverses by a tree child-parent and
when finds a parent from the first thread assumes that CWnd is NULL and
aborts further traversing.
So we manually throw a message to the main thread to handle all parent
windows operations that were not done.
Is it acceptable?
Is there another solution for the task of placing a child window in a
separate thread?
Thanks a lot!
|
|
|
|
|
Can any one suggestion me how i can download any thing(file) from any website(given) in C++/ VC++ .
help me out.
|
|
|
|
|
|
I want to give add of home page only. Then my program should fine out download is available in that page if yes then it will download. All the thing shold be automatically.
|
|
|
|
|
sumit.durg wrote: I want to give add of home page only. Then my program should fine out download is available in that page if yes then it will download. All the thing shold be automatically.
There is an open source tool called wget -> http://gnuwin32.sourceforge.net/packages/wget.htm[^]
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
Hi all,
i m working on VC++2005,
HorizontalScrollbar of Workspace Area is not shown in my project,i dont know how can it disabled.
please anyone can tell me how can i again enable it.
Thanks in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Hi all,
I have a reference variable in my class.
I need to initialize it in the constructor. But, the compiler is giving an error.
Can any one help me out from this problem?
|
|
|
|
|
Reference member variables must be initialized in the constructor's initialization list, for instance
class A
{
int & iRefNum;
public:
A(int & i): iRefNum(i)
{
}
};
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
You've to initialize it in constructor initializer list. For e.g.
MyClass::MyClass( CString& myString )
: m_StringReference( myString )
{
}
regards,
Jijo.
_____________________________________________________
http://weseetips.com[ ^] Visual C++ tips and tricks. Updated daily.
|
|
|
|
|
kuttiam wrote: I need to initialize it in the constructor. But, the compiler is giving an error.
You should initialize a reference variable in the constructor initialization list
e.g.
class MyClass
{
public:
MyClass( int& RefVal ) : m_RefVal( RefVal )
{
m_RefVal = RefVal;
}
private:
int& m_RefVal;
};
Since a reference variable is much like a constant var it must be initialized like a const var. i.e. initialize where it's declared and in classes we cannot initialize where it's declared hence initialization list is provided.
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
modified on Wednesday, May 28, 2008 5:10 AM
|
|
|
|
|
I want to add some icon to my tree control, so I do like this:
CImageList m_imageList;
m_imageList.Create (IDB_TABLE, 32, 0, RGB(255, 255, 255));
CImageList *p_imageList = m_treeTable.SetImageList (&m_imageList, TVSIL_NORMAL);
HTREEITEM rootItem = m_treeTable.InsertItem(_T("RootItem"), 0, 0);
m_treeTable.InsertItem(_T("item 1"), 0, 0, rootItem);
HTREEITEM aItem = m_treeTable.InsertItem(_T("item2"));
m_treeTable.SetItemImage(aItem, 0, 0);
When I execute program, the dialog create small spaces for images but without any image.
Does anyone know why? Thanks in advance,
modified on Wednesday, May 28, 2008 3:39 AM
|
|
|
|
|
You are creating the image list on stack.
Make the imagelist variable a calss member.
|
|
|
|