|
I have gone through the example program given in the below mentioned site..
http://www.codeproject.com/KB/dialog/scrollablechilddialog.aspx[^] [^]
I am able to get Vertical Scroll bar successfully.. I have add OnPaint() massage handler for the CSrollbar dialog class, because i want to create check box dynamically in the OnPaint(). I am able to get the check box in the child window itself..
but whenever i have clicked on scroll down button on scroll bar, the check bax control is getting overlapped and the the control is getting collapsed..
How do i handle this situation..?
Thanks in advance..
Than ks
Venkatesh
|
|
|
|
|
That's only 700 pixels vertical height...I could fit almost twice as many on my screen.
One other thing to think about - are you using the most appropriate UI design - seems bad to be starting with a vertical scrollbar.
|
|
|
|
|
I need to draw line on picture control.
1st click is the 1st line start point.
2nd click is the 1st line end point.
3rd click is the 2nd line start point.
4th click is the 1st line end point.
.
.
.
and so on.
now i can't detect any message from picture control at all.
please give some tips or hints to me
thanks so much....
|
|
|
|
|
First you need to set Notify to true for your control and then you can use of LineTo/MoveTo.
Of one Essence is the human race
thus has Creation put the base
One Limb impacted is sufficient
For all Others to feel the Mace
(Saadi )
|
|
|
|
|
thank you
but i've got another problem.
how to get mouse position from picture control not my program position??
|
|
|
|
|
|
I assume that you are having a dialog based app with MFC support.
In the dialog, you are having a static rectangle (picture control) with SS_NOTIFY style (Notify can be selected in the Properties > Styles of picture control) named IDC_PIC.
You need to derive a class of CStatic. In that you can code for mouse events. Create a control variable of your IDC_PIC with this new class.
Hope now you can continue...
- ns ami -
|
|
|
|
|
1.Can i get a visible rectangle in a simple(typical win32)application?I wrote the code in WM_PAINT message as given below?I tried it but am not getting the
rectangle.Can any one help me in this?my code in WM_PAINT is
RECT rt,rtclient;
GetClientRect(hWnd, &rt);
SetRect(&rtClient,10,10,50,40);
wsprintf(buffer,"%d %d %d %d",rtClient.left,rtClient.top,rtClient.right,rtClient.bottom);
SetTextAlign(ps.hdc,TA_CENTER | TA_TOP);
ExtTextOut(ps.hdc,15,20,0,&rtClient,"RAM",3,NULL);
2.FORWARD_WM_CTLCOLOR()is not recognized in visual studio6.0.Is there any alternative function which does the same job?
|
|
|
|
|
1. What do you mean by visible rectangle? If you mean the client rect of your window, you already queried that here:
Abhinay Kumar wrote: GetClientRect(hWnd, &rt);
But note that in your code sniplet you get the client rect of the window into your rt variable and then you never use it, you explicitly define another rectangle called rtClient here:
Abhinay Kumar wrote: SetRect(&rtClient,10,10,50,40);
and then use that to draw the text. Shouldn't you either be uring rt instead of rtClient to draw OR use rtClient in GetClientRect?
2. What should FORWARD_WM_CTLCOLOR do in the first place?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Here i am giving it manual values but what if i want to draw a rectangle within the parent window.Therefore in GetClientRect(hWnd,&rt), i m geeting the coordrintes of parent window and then want to set the coordinates of the rectangle that i want within this window using SetRect(&rtClient,rt.left,rt.top,rt.right,rt.bottom); and display it using ExtTextOut().By Visible i mean
i am not able to see the rectangle within the window.Please reply.
|
|
|
|
|
I'm not quite sure what you mean, do you mean you want to know where a control is positioned in its parent's client area? If so, do something like this:
RECT controlRt;
::GetWindowRect(controlHWnd, &controlRt);
::ScreenToClient(parentHWnd, &controlRt);
Also note that to draw into the parent's client you need the parent's client DC, is that what you are using? If you did something like putting your drawing code inside the WM_PAINT of some control on that parent, did BeginPaint() and then you want to draw to the parent using the DC you got back, that won't work since the DC you get from BeginPaint will be "referring" to (and be clipped to) the client area of the window that got the WM_PAINT, not its parent.
If this is not what you meant, try to explain a bit more clearer what you need, please.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Please get it in simple terms that i want to draw a rectangle within the hello world window that should uses GetRect(),SetRect() and ExtTextOut().Is it possible?
|
|
|
|
|
Well, telling from this much information, it seems to be possible. Is this some school project?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Yes.Plz,plz tell me or if possible give me the code to do it in visual studio6.0
|
|
|
|
|
Well, first of all, the forum here isn't for doing other people's homeworks, if you can't do it yourself you are most likely have chosen the wrong thing to study. We will help if we can, but don't expect other people here to do your homework for you.
Anyways, do you have to do it using MFC or only API calls?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Do you have the window already showing and all, you only need the drawing code? If so, write a handler for the WM_PAINT message and in this message do the following:
PAINTSTRUCT PStruct;
HDC dc = BeginPaint(handle_to_wour_window, &PStruct);
RECT Rt;
GetClientRect(handle_to_wour_window, &Rt);
TextOut(dc, Rt.left, Rt.top, "Hello", -1);
EndPaint(handle_to_wour_window, &PStruct);
Try to get this to work.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
|
Abhinay Kumar wrote: Can i get a visible rectangle...I tried it but am not getting the rectangle.
Maybe because you do not have any code to draw the rectangle. Why are you not calling Rectangle() ?
Why not try something like:
TextOut(ps.hdc, rt.left, rt.top, "RAM", 3);
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
bcoz i dont want to.I want to use GetRect()to get the parents rect structure and using SetRect()set the childs rectangle coordinates.and ExtTextOut()to view it.can it be done?how?
|
|
|
|
|
hi experts I have one problem in my project.initially it is giving output properly.but if i debug the application it is giving some error messages.after that it does not executing properly.if i restart the application it is working properly.please let me know the reason?
kir_MFC
|
|
|
|
|
kir_MFC wrote: but if i debug the application
You mean running in debug mode or just stepping through every line? Are you sure you are running the same version (debug/release) on both the occasions?
|
|
|
|
|
With out knowing what error is happening, how one can help you?
Please tell more details about the error message.
- ns ami -
|
|
|
|
|
kir_MFC wrote: ...it is giving some error messages.
Is this supposed to be helpful?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Hello Everyone there,
I am working on vc++6. An win32 console based application. I have this problem in my project...
Whenever I run my application the control comes to the function strcpy and stops and one dialog box appear by title "find source " and asking..."please enter the path for STRCAT.ASM." and a list of directories...
The strange behavior is that when I run the same code in a different win32 project, it runs perfectly....May be some setting...could u please help me out
code is....
char currentTime[20];
struct tm * pLocalTime;
strcpy(currentTime, ""); //error comes here
long int nLocalTime = 0;
time(&nLocalTime);
pLocalTime = localtime(&nLocalTime);
sprintf(currentTime,
"%04d-%02d-%02d-%02d.%02d.%02d",
(pLocalTime->tm_year) + 1900,
pLocalTime->tm_mon + 1,
pLocalTime->tm_mday,
pLocalTime->tm_hour,
pLocalTime->tm_min,
pLocalTime->tm_sec);
Thanks in advance,
Himangshu
I am a learner Always
|
|
|
|