| ylxin1993 (94) | ||||||||||||
|
I followed a MFC program can draw lines, rectangles, curves in the canvys, and can select the pen and brush color and styles, but there's some problem. first, the menu item check, I don't know why, in the initizlize window, in the
next, I don't understande the moving item code(the
I don't understand this, if I comment this line, when I move one item, it will draw follow the cursor, with this line, it's all ok. Why redraw the element can make it invisible? I think draw it again will get the same color. ========================== plus, the program have a little problem, when first click in the client area, it can't draw, only second time click can draw, I don't know what's wrong with it, can you help me look at it? I uploaded at :
========================= why VS2010 MFC project so huge, almost 100MB each project? | ||||||||||||
|
|
||||||||||||
| guestgulkan (2915) | |
| Do you understand these two problems yet - or are you still waiting for some further explanation?? | |
|
|
|
| ylxin1993 (94) | |
| yeah, I don't know why, waiting for explanation. | |
|
|
|
| guestgulkan (2915) | |||||||||
Let's start with this one:
This is going to be a long winded explanation. When programming a user interface - we usually change the state of controls visually so that the user can see whether that particular control is eanbled or disabled. This applies particularly to menu options and toolbar buttons. We usually do this by a combination of graying out the text, or displaying/removing a checkmark next to the item (menu items) or showing a toolbar buttons in the DOWN position(selected) or in the UP position (NOT SELECTED). MFC generates a particular message called ON_UPDATE_COMMAND_UI messages for toolbars and menu items. The purpose of this messge is for you to update the toolbar button or menu item. So we have TWO message for each menuitem or toolbar button. one to tell us the button has been clicked, and the other telling us to update the menu item or button state. So going to the code above:
That is the basic explanation - there is more detail - but you can get that from the MSDN website. ============================================== Your other question was the program have a little problem, when first click in the client area, it can't draw, only second time click can draw, I don't know what's wrong with it, can you help me look at it? You will need to change the constructor for the CSketcherView in the SketcherView.cpp file.
| |||||||||
|
|
|||||||||
| ylxin1993 (94) | |
|
thanks a lot!!! can you tell me some suggestion about how two find bugs in a program, like some principle? | |
|
|
|