|
in your OnLButtonDown, you can check to see if the click happens inside the static control. get the window rect, then see if 'point' is inside the rect.
also, you might want to make a class that's derived from CStatic, and put the button/mouse code in there. so, the control will be responsible for moving itself, and not the dialog.
|
|
|
|
|
Hi Chris,
Thanx for the reply.
I did the same way, I have checked in the OnMouseMove. Getting window rect, then checking to if point is in rect.
But even if I use in OnLButtonDown, still I am not able to move the control by clicking the mouse on it. I have used the below code.
<br />
CRect rct;<br />
m_edtext.GetWindowRect(&rct);<br />
if(rct.PtInRect(point))<br />
MessageBox(_T("Yes"));<br />
Please give me a sample code what u have explained earlier: (you might want to make a class that's derived from CStatic, and put the button/mouse code in there. so, the control will be responsible for moving itself, and not the dialog.
).
Will be helpful for me.
Regards,
Mbatra
|
|
|
|
|
mbatra31 wrote: But even if I use in OnLButtonDown, still I am not able to move the control by clicking the mouse on it.
you can move the control if you click outside of it, but not directly on it?
|
|
|
|
|
Hi Chris,
I have one requirement. I want to draw text on an image. I have seen one software, in that on clicking a button, it will display a text field box, where user types the text, that text will be parallely drawn on the image. And also user can move that box in whcih text is being drawn.
I want to do the same in MFC dialog based app. I was able to move the static/edit box, but I want the user should be able to move the control by holding the mouse on it.
Any idea about this. I will be thankful for your reply.
Regards,
mbatra
|
|
|
|
|
and what are you able to do right now?
|
|
|
|
|
Hi Chris,
I was able to move the control, but when I click away from the control, not by clicking on the control and holding the mouse and then drag the control. Actually I want to drag the control by holding the mouse on it.
Regards,
Mbatra
|
|
|
|
|
I use the PictureBOX control to display *.png image, but there is blank when the form startup, I cannot see the picturebox control. I use the spy++ to move over the PictureBox control place, there indeedly is a Picturebox control. Does it need to write code in the OnPaint function of this Dialog?
Could someone can give me a example? Thank you very very much.
|
|
|
|
|
This looks like a Managed C++ issue, you may be better posting in the Managed C++ forum[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
No managed c++,
It's a MFC problem.
|
|
|
|
|
Strange, I cannot find a reference to the PictureBox class in MFC. Do you have a link to it?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
Hi Richard MacCutchan,
Sorry, I found that I print a wrong name. Its name should be Picture Cotnrol (IPictEditor).
I use a CStatic variable to binding this control.
|
|
|
|
|
The PictureBox will be invisible until you set its Image member to an Image/Bitmap. You could also write an OnPaint method for the PictureBox; either approach would work.
"Microsoft -- Adding unnecessary complexity to your work since 1987!"
|
|
|
|
|
I had set a image to the picture. At a simple project, this way is OK. I guess it need to draw the image in OnPaint function.
|
|
|
|
|
Hi,
on win7, if you open Notepad and write.exe and paste a long text, the notepad will scroll quickly with the mouse wheel.
The RichEdit control in the write.exe, however, uses some sort of "smooth scrolling", which is totally disturbing.
In my program, I want to make the CRichEditCtrl as snappy a CEditCtrl. Any ideas?
Many thanks,
-Gernot
|
|
|
|
|
Does this behaviour happen also in your code or is it specific to write.exe?
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
I'd say it happens in any CRichEditCtrl you make unless you find a way to disable it. Yes, my program suffers from this behaviour.
|
|
|
|
|
I would guess then, that it is a feature of the control so unless there is a method in the class to disable it then you are stuck with it. You could try subclassing[^] the control to see if there is a way to improve it.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
hi all,
i am getting all drives list connected in my system.
as list of logical drive and physical drive.
for logical drives i m using GetLogicalDrives()
and for physical drives using com with this query "Win32_DiskDrive".
but how can i indetify which drive is external drive in out of all drive for both logical and physical.
please help me for this.
thank in advance.
|
|
|
|
|
You could always check the documentation[^].
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
this is working only for physical disk drive
i have done this with MediaType parameter with "External hard disk media" value.
now what can i use for logical drives.
modified 5-Sep-12 4:35am.
|
|
|
|
|
Since a physical drive can contain many logical drives it probably does not make sense for logical. You probably need to find the logical drive's parent device and check that.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
ok so how can i get its parent disk
|
|
|
|
|
Sorry, I'm not sure, but maybe one of these functions[^] will help.
One of these days I'm going to think of a really clever signature.
|
|
|
|
|
thanks for you help its done...
|
|
|
|
|
Maybe you could give the details here, so it will be available for others facing similar issues.
One of these days I'm going to think of a really clever signature.
|
|
|
|