Click here to Skip to main content
15,887,307 members
Home / Discussions / C#
   

C#

 
GeneralRe: Fit text to label without changing label font and size Pin
Sascha Lefèvre29-Apr-15 5:14
professionalSascha Lefèvre29-Apr-15 5:14 
GeneralRe: Fit text to label without changing label font and size Pin
Pete O'Hanlon29-Apr-15 5:15
mvePete O'Hanlon29-Apr-15 5:15 
GeneralRe: Fit text to label without changing label font and size Pin
OriginalGriff29-Apr-15 5:22
mveOriginalGriff29-Apr-15 5:22 
Questionc# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Pranita Gupta29-Apr-15 0:14
professionalPranita Gupta29-Apr-15 0:14 
AnswerRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Pete O'Hanlon29-Apr-15 0:18
mvePete O'Hanlon29-Apr-15 0:18 
AnswerRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
Eddy Vluggen29-Apr-15 1:12
professionalEddy Vluggen29-Apr-15 1:12 
GeneralRe: c# window Application"How to resize the control proportionally at runtime using c# window application " Pin
OriginalGriff29-Apr-15 4:59
mveOriginalGriff29-Apr-15 4:59 
QuestionWhy designer save Bad COORDINATES of UserControl's Child (EnableDesign) ? Pin
Emanuele Bonin28-Apr-15 23:39
Emanuele Bonin28-Apr-15 23:39 
Hi All
My goal is create a usercontrol with some childs controls enabling the editing, in design mode, of this childs, so i'll rearrange the positions of childs.
I found the (partial) solution to my problem generating another problem.
I'll try to explain my problem:
1 Create a UserControl
2 Drop on it a Label (name Label1) at the coordinates 1,1 (EXAMPLE)
3 the code of Control must be appear like this:
//--------------------------------------------------
[Designer(typeof(cntLabelDesigner))] // <-- Use of a custom designer to enable edit of the childs
public partial class cntBaseTextBox : UserControl {
// Expose the label1 creating a public property and serializing it
[DesignerSerializationVisibility(DesignerSerializationVisibility.Content)]
public Label lbl { get { return this.Label1; } }

public cntBaseTextBox() {
InitializeComponent();
}

}
// Custom class designer
class cntLabelDesigner : ControlDesigner {
public override void Initialize(IComponent comp) {
base.Initialize(comp);
if (this.Control is cntBaseTextBox) {
var uc = this.Control as cntBaseTextBox;
this.EnableDesignMode(uc.lbl, "xLabel");
}
}
}
//--------------------------------------------------

4 create a form and drop the usercontrol on it, the coordinates writed on form ..designer.cs for the label are 1,1 ....
NOW THE PROBLEM
If i move my label in another position seem to be all OK but if you see the new coordinates wrote on form ..designer.cs are relative to the forms and not relative to the parent control ... infact if i save and recall my form the label will be in another position or is disappeared because it's coordinates ar outside the usercontrol.
Can anyone help me ?
This is a normal behavior or is an IDE's Bug ?
I'm using VS community 2013 Upgrade 4 ...

Thanx in Advance and SFMBE.
Emanuele
-----------------------------------------------------------
After hour and hour of purisms ... i found a Quick & Dirty solution (bleahhh!). On UserContrl Load Events i test if label coordinates are changed (so the coordinates are referred on client area) .. if so i correct the substracting to it the coordinate of user control ... i know that this is a stink solution.
Anyoone had a better solution or can say me if this behaviour is a bug ?

private void cntBaseTextBox_Load(object sender, EventArgs e) {
if (!this.Label.Location.Equals(new Point(4, 4))){
this.Label.Location = new Point(this.Label.Location.X - this.Location.X, this.Label.Location.Y - this.Location.Y);
}
}

modified 29-Apr-15 10:31am.

AnswerRe: Why designer save Bad COORDINATES of UserControl's Child (EnableDesign) ? Pin
BillWoodruff30-Apr-15 3:37
professionalBillWoodruff30-Apr-15 3:37 
GeneralRe: Why designer save Bad COORDINATES of UserControl's Child (EnableDesign) ? Pin
Emanuele Bonin30-Apr-15 6:08
Emanuele Bonin30-Apr-15 6:08 
QuestionMake a faster search of folders Pin
Member 1140151628-Apr-15 11:34
Member 1140151628-Apr-15 11:34 
AnswerRe: Make a faster search of folders Pin
Mycroft Holmes28-Apr-15 14:05
professionalMycroft Holmes28-Apr-15 14:05 
AnswerRe: Make a faster search of folders Pin
Dave Kreskowiak28-Apr-15 14:16
mveDave Kreskowiak28-Apr-15 14:16 
AnswerRe: Make a faster search of folders Pin
Abhinav S28-Apr-15 17:38
Abhinav S28-Apr-15 17:38 
GeneralRe: Make a faster search of folders Pin
Eddy Vluggen28-Apr-15 23:13
professionalEddy Vluggen28-Apr-15 23:13 
GeneralRe: Make a faster search of folders Pin
Abhinav S28-Apr-15 23:24
Abhinav S28-Apr-15 23:24 
AnswerRe: Make a faster search of folders Pin
Pete O'Hanlon29-Apr-15 1:00
mvePete O'Hanlon29-Apr-15 1:00 
SuggestionRe: Make a faster search of folders Pin
Richard Deeming29-Apr-15 1:40
mveRichard Deeming29-Apr-15 1:40 
AnswerRe: Make a faster search of folders Pin
Richard Deeming29-Apr-15 1:35
mveRichard Deeming29-Apr-15 1:35 
AnswerRe: Make a faster search of folders Pin
V.29-Apr-15 2:50
professionalV.29-Apr-15 2:50 
Questionappend array of byte to other which contains '0' Pin
MrKBA28-Apr-15 6:20
MrKBA28-Apr-15 6:20 
AnswerRe: append array of byte to other which contains '0' Pin
OriginalGriff28-Apr-15 6:27
mveOriginalGriff28-Apr-15 6:27 
Questiongf Pin
Member 1148462428-Apr-15 3:44
Member 1148462428-Apr-15 3:44 
AnswerRe: clear my liste of seaid that i got via this method on the uninstall of the application Pin
Abhinav S28-Apr-15 3:49
Abhinav S28-Apr-15 3:49 
General[REPOST] Pin
Sascha Lefèvre28-Apr-15 4:27
professionalSascha Lefèvre28-Apr-15 4:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.