Answered by:
How to drag a LABEL control from the Toolbox into a PICTUREBOX control.

Question
-
Hi,
I have a PICTUREBOX control with AllowDrop = true.
I am trying to drag LABEL control from toolbox, into PICTUREBOX control.
LABEL control are not draw on PICTUREBOX control.- Moved by CoolDadTx Thursday, July 23, 2015 3:44 PM Winforms related
Wednesday, July 22, 2015 5:57 PM
Answers
-
Hi,
I have a PICTUREBOX control with AllowDrop = true.
I am trying to drag LABEL control from toolbox, into PICTUREBOX control.
LABEL control are not draw on PICTUREBOX control.A picturebox is intended to show pictures - jpg/png etc.
Not labels.
The label has no particular meaning to a picturebox.
So you can't give a picturebox a label to show.
You can drag a label above a picturebox and set it so it's on top.
In winforms, I don't think you can actually set z-order as a property but you can use the technique in the code sample I supplied in your previous post:
yourcontrol.BringToFront();
Also.
Setting allowdrop = true in the picturebox properties will have no effect whilst in the designer.
- Edited by Andy ONeill Thursday, July 23, 2015 8:38 AM
- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Thursday, July 23, 2015 8:36 AM -
If your purpose is to just draw text you may check another option:
Fouad Roumieh
- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Thursday, July 23, 2015 1:15 PM -
Hi Kumar,
>> I have a PICTUREBOX control with AllowDrop = true.
AllowDrop is not used for drag and drop control from ToolBox, it is used at runtime and you could drag and drop other files to picturebox. As the reply from Andy, you could not drop a label above a picturebox, did the suggestion from Andy work for you? Or, you could draw test as the reply from Fouad.
If you have any issues about this, please feel free to let us know.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Wednesday, July 29, 2015 2:23 AM
All replies
-
Hi Kumar,
This forum is discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools. I suspect that you are working on winform project.
The following case is you asked before.
Does it answer your question? If not, you can unmark it, and repost this issue in Winform forum for better support.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Thursday, July 23, 2015 7:42 AM -
Hi,
I have a PICTUREBOX control with AllowDrop = true.
I am trying to drag LABEL control from toolbox, into PICTUREBOX control.
LABEL control are not draw on PICTUREBOX control.A picturebox is intended to show pictures - jpg/png etc.
Not labels.
The label has no particular meaning to a picturebox.
So you can't give a picturebox a label to show.
You can drag a label above a picturebox and set it so it's on top.
In winforms, I don't think you can actually set z-order as a property but you can use the technique in the code sample I supplied in your previous post:
yourcontrol.BringToFront();
Also.
Setting allowdrop = true in the picturebox properties will have no effect whilst in the designer.
- Edited by Andy ONeill Thursday, July 23, 2015 8:38 AM
- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Thursday, July 23, 2015 8:36 AM -
If your purpose is to just draw text you may check another option:
Fouad Roumieh
- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Thursday, July 23, 2015 1:15 PM -
Hi,
I have a windows application which have all functionality of Microsoft Visual Studio. In this application we have it's own LABEL, PICTUREBOX, TEXTBOX,..,My question is that when i drag LABEL from ToolBox and put some where else on the application surface, After that select LABEL on application surface and drag and drop on PICTUREBOX it work fine.
But when i drag LABEL from ToolBox and drop it on PICTUREBOX, it is not work.
I have this.pictureBox1.AllowDrop = true; property,
- Merged by Fred Bao Wednesday, July 29, 2015 1:45 AM Duplicated
Monday, July 27, 2015 6:15 PM -
Since you mentioned PICTUREBOX, TEXTBOX control, you case more related to Winform, I moved your case to winform forum for better support.
Best regards,
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.Tuesday, July 28, 2015 10:11 AM -
Hi Kumar,
>> I have a PICTUREBOX control with AllowDrop = true.
AllowDrop is not used for drag and drop control from ToolBox, it is used at runtime and you could drag and drop other files to picturebox. As the reply from Andy, you could not drop a label above a picturebox, did the suggestion from Andy work for you? Or, you could draw test as the reply from Fouad.
If you have any issues about this, please feel free to let us know.
Best Regards,
Edward
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click HERE to participate the survey.- Proposed as answer by Edward8520Microsoft contingent staff Thursday, July 30, 2015 9:49 AM
- Marked as answer by Youjun Tang Tuesday, August 4, 2015 2:25 AM
Wednesday, July 29, 2015 2:23 AM