|
Try to redraw only parts on your window that really change instead of redrawing the whole thing.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
if the background is static, you really only need to draw the overlay at its new position and then draw the parts of the background that were uncovered when the overlay moved. there's no need to redraw the whole background.
1. the overlay's previous rect = R1.
2. the overlay's new rect = R2.
3. R3 = the bounding rect of R1 and R2.
4. alloc a bitmap of size R3
5. fill it with the appropriate chunk of background
6. draw the overlay into the temp bitmap
7. draw the temp bitmap to the screen
as long as the overlay is moving only a few pixels at a time, R3 should be just slightly bigger than the overlay size. if R1 and R2 don't instersect, you can split it into two operations: restore the background to one rect, then draw the overlay into the other - don't bother with the temp bitmap.
|
|
|
|
|
Thanks Chris, sounds like a good plan.
|
|
|
|
|
Load the image to memory and try to move it.
|
|
|
|
|
I am already using a memory buffer as I said at the start: "I am double buffering the paint."
|
|
|
|
|
Would you get better performance by using your current methods but using (say) DirextX or OpenGL to do the blitting? They might have better performing drivers that make better use of hardware?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart. I'd considered that but didn't want to add the overhead and complication of using these libraries. As of late yesterday I now have an implementation that works well enough on my slow old Vista Notebook and very well on my Desktop PC. Basically doing what Chris suggested.
|
|
|
|
|
Hi again,
Does anyone know a code so when the user presses the Escape key during the full screen mode in my Win32 project to exit the application just by pressing the button.
Thanks
Andrew McIntyre
|
|
|
|
|
Assing an accelerator key to VL_ESCAPE, and handle (eg) IDM_VIEW_CANCELFULLSCREEN.
Or hook up WM_KEYDOWN/VK_ESCAPE...
Basically, the same way as you'd handle someone pressing the 'A' key.
Enjoy,
Iain.
ps, I'm not touching the fullscreen bit, as I know you did all that yesterday. If you can switch into fullscreen, you can switch out.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
So how would that look like with in code.
Andrew McIntyre
|
|
|
|
|
MrMcIntyre wrote: So how would that look like with in code.
Well now that you know what the code looks like to maximize the window you should be able to figure out how to get it back to normal size.
|
|
|
|
|
Manage the use of electricity in a village (or ward)
1. Managing households in each village (data including: household owner, address, schools needed)
2. Manage the use of electricity in a month
3. Calculate the monthly electricity use of each household
4. Report payment of monthly electricity use
5. Handling violations (Interrupter, electric discharge back)

|
|
|
|
|
Uh, what a interesting project: good luck!
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
[My articles]
|
|
|
|
|
*click*
Bad Question.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
If you do get help doing this, I trust you'll make a nice donation to a programming related charity?
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
thank you! forward to help!
|
|
|
|
|
dinh_vu_vt2005 wrote: Manage the use of electricity in a village (or ward)
I'd like the code for a program that did that. Then I could sell it to the government of Vietnam and make my fortune. 
|
|
|
|
|
Do you want any fries with that?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
In my MFC program the int 10 (ten) is treated as binary 10 (one & zero) i.e. == 2.
So when I insert any item at 10th position then it is inserted at 2nd position.
Similarly for 100th item it is inserted at 4th position.
My program is a Dialog Based Application.
m_ctlDeviceList is control variable for ListCtrl and it is set in Report View.
void CIPMDlg::OnBnClickedBrefreshdevices()
{
int field0 = 0, field1 = 0, field2 = 0, field3 = 0;
int c=0, nIndex=0;
CString ips = _T("");
for (field0 = 192; field0 <= 192; field0++)
{
for (field1 = 168; field1 <= 168; field1++)
{
for (field2 = 0; field2 <= 255; field2++)
{
for (field3 = 0; field3 <= 255; field3++)
{
ips.Format(_T("192.168.%u.%u"), field2, field3);
nIndex = m_ctlDeviceList.InsertItem(c, ips);
m_ctlDeviceList.SetItemText(nIndex, 1, _T("Testing"));
c++;
}
}
}
}
}
Why is this happening?
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Manmohan29 wrote: In my MFC program the int 10 (ten) is treated as binary 10 (one & zero) i.e. == 2.
This is definitely not true.
I think the problem may be that your ListCtrl is automatically sorting the entries as you add them. So you add "192.168.0.0", "192.168.0.1" etc. Then when you insert "192.168.0.10" it will be inserted in position 2 between "192.168.0.1" and "192.168.0.2". It may be better to ensure that you format the numbers with 3 digits in every case, or turn off the auto sort feature of the ListCtrl.
|
|
|
|
|
Bull's Eye.
Thanks Richard.
can I get your email ID so that I can ask for programming help.
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Manmohan29 wrote: can I get your email ID so that I can ask for programming help.
This may seem a bit radical, but you could try posting your requests for help on a forum... That way more people will see them.
Unless you're offering him money? That'd be different!
Iain.
I have now moved to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), or need contract work done, give me a job! http://cv.imcsoft.co.uk/[ ^]
|
|
|
|
|
Future Lies in Present.
Manmohan Bishnoi
|
|
|
|
|
Manmohan29 wrote: can I get your email ID so that I can ask for programming help.
Sorry but
1. I like to decide which questions I answer
2. You will get better and faster help through the forums
3. You could not afford my fees
good luck!
|
|
|
|
|
Thanks Richard.
Can I get your bank ID so that I can ask for financial help?
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
[My articles]
|
|
|
|