|
Same post for get new answers!
|
|
|
|
|
Repost one more time.;P
GV
|
|
|
|
|
I have a window inherited from CView, used for showing pictures.
When moving dialog over it, there are sometimes black lines left on the window. It seems like calling InvalidateRect with a little small rectangle area as parameter. I don't know how it comes out. Please help me solve it!
I set this window's map mode to MM_ISOTROPIC and the logical extent is smaller than device extent.
Does it have something to do with the problem?
Thanks in advance!
|
|
|
|
|
Are the lines just on the pictures or in the entire view window?
Regardless, you are responsible for repainting any invalid areas of the window.
The MM_ISOTROPIC mode only comes into play when you are doing this painting...
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Call the function again in OnDraw() function to draw whatever you are drawing in the view window.
Anurag Gandhi.
|
|
|
|
|
i want to convert a Cstring let's say
CString s="1E";
unsigned char k;
i want to convert it to be this way
printf("k=%x",k);
i want the result to be :
k=1E
how is this possible please i'm running out of time
emma
|
|
|
|
|
|
no i want to enter it as i send before it is given in the code and not to be get as input
emma
|
|
|
|
|
look, i use sscanf() (with 2 s), not scanf()
|
|
|
|
|
imanos wrote: it is given in the code and not to be get as input
and indeed sscanf does what you are requiring. see here [^].
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.
|
|
|
|
|
Thanks a lot it worked waaaaaaaaaaaaaw
thanks in advance
emma
|
|
|
|
|
Have a look at ::strtol(...)[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Thanks for ur valuable time ur all great actually the sscanf worked for me and i'm sure this one works too so thanks
emma
|
|
|
|
|
Will CString::Format be helpful ?
Regards,
Paresh.
|
|
|
|
|
actually i didn't try it but sscanf was just fine
Thanks for ur valuable time ur all great
thanks
emma
|
|
|
|
|
you can do:
k = strtol(s, &pStop, 16);
where pStop is a char pointer (see strtol documentation).
of course you'll get k=0x1E .
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.
|
|
|
|
|
u know sscanf worked for me but sure i'll try all the solutions to have them all
Thanks for ur valuable time ur all great
thanks
emma
|
|
|
|
|
First of all, I'm still using MFC4.2 with VC6. But the problems I ran into are probably the same since Win3.x .
I have a CDialog, made with the dialog editor. Beside other controls I have a tab control in this dialog, which is attached to a CTabCtrl Object.
Now I want to mask out a part of this tab control. Easy, isn't it?
So I created dynamically a CStatic object, "Static1", with the background color corresponding to the dialog background color and sized and positioned the window to cover the area that I want to mask out. This static is a child of the TabControl.
So far so good.
But as soon as the tab control is repaintd my static control disappeared behind the tab control.
I made a second static control, "Static2", this time with the resource editor. This static is not a child of the TabControl.
Same behaviour.
I tried to adjust the z-order of "Static1". No effect.
I even called SetWindowPos with the wndTopMost pointer after each button down-, selection change- and WM_PAINT notifictaion, just for the case that the z-order is changed somehow somewhere. No success.
The behaviour is:
Upon startup or completely repaint of the dialog I see "Static1" and "Static2" ("Static2" is above "Static1").
After changing the Tabs (or hovering) I see the tab control. (Static 1 & 2 are behind the tab control).
If the statics are just covered by a window and drawn again afterwards, the result is indetermined, mostly all three controls are only drawn partitially in the overlapping area.
What can I do to nail my static on top of the tab control and that it gets repainted AFTER every repaint of the tab control?
Regards
Leo
|
|
|
|
|
Here an alternative solution, how about in the OnPaint() handler of your CTabCtrl derived class you draw the background part that you are interested in? This would theoretically make the extra CStatic obsolete by drawing all within one object.
void CTabCtrlSpecial::OnPaint()
{
CTabCtrl::OnPaint();
dc.FillSolidRect(rect, ::GetSysColor(COLOR_3DFACE));
}
Just a an idea, would that work?
|
|
|
|
|
Thx.
I will try it out. Even if don't think that it will work since the class only encapsulates the api and propably does not implement any drawing itself. But it's worth a try and I have no better idea myself.
I want to undestand why it behaves the way it does.
Unfortunately I do not even know what I should look for.
And it must somehow be possible. I'm for sure not the first one who has the problem .
So maybe some guru has additional ideas.
Regards
Leo
|
|
|
|
|
Functionality-wise (not implementation-wise) what are you trying to do? I am unsure that I understand the reason for your task, perhaps there are other ways to achieve the functionality you need.
|
|
|
|
|
I want to hide a part of a tab control: The left and right arrows that are displayed when more tabs exist than can be displayed at once.
I'm trying to do this by painting backgrond color over the area I want to hide.
Actually I was not really painting, but I set a static control (without text) over the position I wanted not to be seen.
|
|
|
|
|
I see, I would go for an ownerdraw tab control without those spin buttons... examples see [1] and [2] (you must disable the drawing/handling of the buttons yourself).
Hope it helps
|
|
|
|
|
I was off with the family this weekend, so my reply is a little bit later than usual.
-> I just made a quick try of your suggestion and it did not work.
Interestingly as soon as I make a command handler for WM_PAINT, the control is not painted at all.
No mather if the OnPaint function body is empty or I call the base classes OnPaint (class wizard makes comment: don't call bas class), the control is not painted.
By the way, it seems, that CTabControl has no OnPaint function so that CWnd::OnPaint is called which more or less forwards the last command (WM_PAINT) to the window (control). That's what I ment with encapsulating API: sending a message to a control instead of doing any painting inside the class.
I have not thought about owner drawn tabs yet, because my documentation said that owner drawn tabs have fixed size. But I plan to change to VC2003 next week (to avoid to bother with problems or bugs that are solved allready in newer MFC versions. And for flat button support ). Also I might have time to go through the articles about owner drawn tab controls.
I did not try emediately to derive from CTabControl because I want to avoid to make da deviation of each class I use. Otherwise things get very hard to overview quiet quickly.
But ofcourse it's easier to spend 1min every time I open the project to get an overview than wasting hours for programming .
But I still want to understand what's happening and found out, that I have some fundamental wholes in my windows knowledge. It was no joke when I mentioned that the cause of the problem exists since Win 3.xx.
Regards
Leo
|
|
|
|
|
Chilli71 wrote: Interestingly as soon as I make a command handler for WM_PAINT, the control is not painted at all.
Have you tried:
class CTabCtrlLeo : public CTabCtrl { };
void CTabCtrlLeo::OnPaint()
{
Default();
CPaintDC dc(this);
CRect rect;
GetClientRect(&rect);
}
|
|
|
|