|
|
That 's what i done:
Bitmap *m_image; /*for draw line, which will combined with the back ground*/
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if ( IsWindow() == false )
return 0;
PAINTSTRUCT ps;
// Start a paint session and create a graphics object.
BeginPaint(&ps);
Graphics *g1 = Graphics::FromImage(m_image);
g1->Clear(Color(Color::White));
Pen p(Color(255, 0, 0, 0), 5);
g1->DrawLine(&p, 0,0, LOWORD(lParam), HIWORD(lParam));
EndPaint(&ps);
//combine the line with the background
BeginPaint(&ps);
Graphics g2(GetDC());
ImageAttributes imageAttr;
Status stat = imageAttr.SetColorKey(Color::White,
Color::White,
ColorAdjustTypeDefault);
CRect rect;
GetWindowRect(&rect);
if ( !m_image )
m_image = new Bitmap(rect.Width(), rect.Height());
Rect rc;
RedrawWindow();
g2.DrawImage(m_image,
Rect(0, 0, m_image->GetWidth(),
m_image->GetHeight()),
0, 0, m_image->GetWidth(), m_image->GetHeight(),
UnitPixel, &imageAttr, NULL, NULL);
EndPaint(&ps);
return 0;
}
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
//here i draw a picture as the background
}
it seems that i must redraw all the window when the mouse moving, thus comes with the flicker. can it be avoided?
i ma realfly
|
|
|
|
|
realfly wrote:
it seems that i must redraw all the window when the mouse moving, thus comes with the flicker
One time I wanted do the same things and I couldn't get rid of that flikering.I didn't work enough on this subject to help you,I think it is better to ask Christian Graus about it.
realfly wrote:
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
//here i draw a picture as the background
}
If you want the picture as background of your window,paint it in OnEraseBkgnd() (WM_ERASEBKGND) ,that is better place for it.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
If you're talking about a selection box, I would draw it direct to the graphics object in the paint method, and therefore it is never a permanent part of the image, just drawn on top of it each time.
Of course, I'd double buffer it and draw it onto the buffer image, but you get the idea.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
|
That 's what i done:
Bitmap *m_image; /*for draw line, which will combined with the background*/
LRESULT OnMouseMove(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
if ( IsWindow() == false )
return 0;
PAINTSTRUCT ps;
// Start a paint session and create a graphics object.
BeginPaint(&ps);
Graphics *g1 = Graphics::FromImage(m_image);
g1->Clear(Color(Color::White));
Pen p(Color(255, 0, 0, 0), 5);
g1->DrawLine(&p, 0,0, LOWORD(lParam), HIWORD(lParam));
EndPaint(&ps);
//combine the line with the background
BeginPaint(&ps);
Graphics g2(GetDC());
ImageAttributes imageAttr;
Status stat = imageAttr.SetColorKey(Color::White,
Color::White,
ColorAdjustTypeDefault);
CRect rect;
GetWindowRect(&rect);
if ( !m_image )
m_image = new Bitmap(rect.Width(), rect.Height());
Rect rc;
RedrawWindow(); //call OnPaint to draw the background
g2.DrawImage(m_image,
Rect(0, 0, m_image->GetWidth(),
m_image->GetHeight()),
0, 0, m_image->GetWidth(), m_image->GetHeight(),
UnitPixel, &imageAttr, NULL, NULL);
EndPaint(&ps);
return 0;
}
LRESULT OnPaint(UINT uMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{
//here i draw a picture as the background
}
it seems that i must redraw all the window when the mouse moving, thus comes with the flicker. can it be avoided?
i ma realfly
|
|
|
|
|
// Start a paint session and create a graphics object.
BeginPaint(&ps);
Graphics *g1 = Graphics::FromImage(m_image);
g1->Clear(Color(Color::White));
Pen p(Color(255, 0, 0, 0), 5);
g1->DrawLine(&p, 0,0, LOWORD(lParam), HIWORD(lParam));
EndPaint(&ps);
Why are you starting a paint session here ? It's causing a WM_ERASEBKGND and you don't need it.
You should set up as much as possible before your BeginPaint, so all you do there is copy the preprepared bitmap into the window.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
You mean that I should copy the Background to a buffer image(1) when i begin draw a line. and then copy the (1) and a drawing line to another image(2),and then copy (2) to the screen?
But it also result redraw all the client when mouse moveing, then it will flicker. i make a test about this.
I load an image when application intialized, and draw it direct to the screen when mouse moveing, but it's also flicker.8(
Is there any mistake of me? Is I must use the SetROP2? but unfortunly is that it can't works with gdi+ in the same time.(is that right?) What should i do?
i ma realfly
|
|
|
|
|
You should draw your screen to an image, without starting a paint call. Then start a paint call and immediately copy that image onto the screen graphics object. The point of the double buffer is that everything is drawn off screen and put to the screen in one action.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm thinking of getting married for companionship and so I have someone to cook and clean." - Martin Marvinski, 6/3/2002
|
|
|
|
|
Can I get the posting data of IE browser before the browser send the data to server?
using VC!
|
|
|
|
|
Can I control the IE browser by using a COM?
is there a example?
thanks!
|
|
|
|
|
Yes, you can. Internet Explorer has a rich set of COM-interfaces, so you can do almost anything you want. You can get the documentation (samples included) by downloading the Internet Development SDK from Microsoft, or by browing it online using the MSDN Library (URL for both the SDK and the Library: http://msdn.microsoft.com).
|
|
|
|
|
Hi,
I'm trying to create a setup wizard and im wondering how to copy files across to other directories, creat new directories and create icons for the desk top. Can anybody help
Cheers
Dor
|
|
|
|
|
hi,
If u r using VC++ for ur application, i think its better to use the "Install Shield for VC++". That will save ur lot of work as we can do it easily with the wizrds taht it provides.
Hope this Hepls u...
Regards
hkprs
|
|
|
|
|
You can use Inno setup which is free :-
http://www.jrsoftware.org/isdl.php
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
May be i must for each toolbar button create item menu?
|
|
|
|
|
In VC++ 6.0 you could use the class wizard.
I guess in VC++ 7.0 it must be through similar means...
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
early i think also as you.
How I can do this?
|
|
|
|
|
hi:
where to get the windows xp icons (the icons for App ,Toolbar...)
Thanks
benben
|
|
|
|
|
benben wrote:
where to get the windows xp icons
Huh? You mean you want XP style true color icons in non-XP OSs
Nish
My miniputt high is now 29
I do not think I can improve on that
My temperament won't hold
www.busterboy.org
|
|
|
|
|
If your OS is windows xp,use this tool search
your hard disk for icons : Icon Searcher v1.3
Download url: http://softplus.126.com
Enjoy!
|
|
|
|
|
This is driving me crazy , wonder if anyone can help.
I'm am having some serious problems with GetMenuItemInfo and
SetItemInfo using WTL, but only with the dwItemData memeber, everything else seems to work
fine...
Let's say in OnCreate I try to add some data to the ID_FILE_NEW Menu
Item like so: lets make it a simple DWORD instead of a pointer just to keep things
clear...
CMenuItemInfo mii;
CMenuHandle menu = m_CmdBar.GetMenu();
CMenuHandle submenu = menu.GetSubMenu(0);
mii.fMask = MIIM_DATA | MIIM_ID;
mii.dwItemData = 1001;
mii.wID = ID_FILE_NEW;
if( submenu.SetMenuItemInfo(ID_FILE_NEW,FALSE,&mii) == 0 )
{
// Little helper function
ShowLastError();
}
Then when I the user selects the menu item in OnFileNew, I do this:
CMenuItemInfo mii;
CMenuHandle menu = m_CmdBar.GetMenu();
CMenuHandle submenu = menu.GetSubMenu(0);
mii.fMask = MIIM_DATA;
// I could actually use wID here passed in but I want to test
// the the specific menu item at the moment
if( submenu.GetMenuItemInfo(ID_FILE_NEW,FALSE,&mii) == 0 )
{
// Little helper function
ShowLastError();
}
DWORD dwTestData = mii.dwItemData;
dwTestData is always '0' no matter what I try to set it to.. I can
retrieve the Menu item text and print it out so I know I'm dealing
with the right menu item... I don't know if I am going wrong with
setting the data or retrieving it... It is really driving me nuts,
I feel like I am missing something very obvious here.
Thanks,
Scott
PS.. Here is an example project:
http://www.binaryrevelations.com/menutest.zip
=======================================
: W. Scott Dillman
: Principle Software Engineer
: binaryRevelations Interactive, LLC.
: http://www.binaryrevelations.com
=======================================
|
|
|
|
|
SetMenuItemInfo
The SetMenuItemInfo function changes information about a menu item.
Remarks
The application must call the DrawMenuBar function whenever a menu changes, whether or not the menu is in a displayed window.
Not sure if that will make a diff or not.
Todd Smith
CPUA 0x007 ... shaken not stirred
|
|
|
|
|
I got a really good reponse on this from the WTL group on Yahoo... It seems that the command bar class is causing the problem... It uses the data item to store drawing information, so I can either use a plain menu or extend the command bar class and use something like a STL map to store my data.. thanks for the reponse..
=======================================
: W. Scott Dillman
: Principle Software Engineer
: binaryRevelations Interactive, LLC.
: http://www.binaryrevelations.com
=======================================
|
|
|
|
|
Does anyone know how I can program in Microsoft Visual C++ 6.0 in 16-bit for DOS? Thanks
Steve
|
|
|
|
|