c# - Centering a label inside a SplitContainer does not work -


i trying center label inside splitcontainer using code:

label1.location = new point((label1.parent.clientsize.width / 2) - (label1.width / 2),                           (label1.parent.clientsize.height / 2) - (label1.height / 2)); 

this looks working @ first. using label hold title of document. after loading same document again, putting same text inside label again , calling same method again, center label, label put down 5 pixels. has idea why happen?

€: seeing splitcontainers(which parent) height changes after form1_load 20 25

edit2:

private void splitcontainer1_panel1_sizechanged(object sender, eventargs e)     {         label1.location = new point((label1.parent.clientsize.width / 2) - (label1.width / 2),                           (label1.parent.clientsize.height / 2) - (label1.height / 2));      } 


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

c# - Exception when attempting to modify Dictionary -