PDA

View Full Version : usercontrol هیچ تغییراتی در property هایش را قبول نمی کند!



reza_rad
دوشنبه 16 بهمن 1385, 13:46 عصر
سلام.

من یک یوزر کنترل برای win app ساختم و داخلش یکسری کنترل هستند و یکسری تنظیمات روی Property های این کنترل ها ست شده( در متد Initialize Component )

حالا وقتی این یوزر کنترل رو روی یکی از فرمهام می ندازم و مشخصات مربوط به هر کدوم از کنترلهاش رو از طیق property window تغییر میدم توی اون لحظه تغییرات توش اعمال میشه ولی به محض اجرا همه چیز برمی گرده به حالت اول!

خودم حدس میزنم به این دلیل باشه که تنظیمات توی متد InitializeComponent انجام میشه و احتمالا باید جای دیگه ای انجام بشه. راستش توی وب کنترل متدی بود به نام CreateChildControls که توی اون این کدها رو می نوشتم ولی اینجا نداره.

راهکار این مشکل چیه؟

پیشاپیش از راهنمایی همه عزیزان سپاسگذارم

omid_Ahmadi
دوشنبه 16 بهمن 1385, 13:55 عصر
تغییرات رو روی یوزر کنترل اعمال می کنی یا روی کنترلهایی که درون یوزر کنترل قرار دادی؟

البته در هر دو حالت نباید مشکلی پیش بیاد و باید تغییرات درست نمایش داده بشه. احتمالا جای دیگه ای مشکل داره.
یک بار هم تغییراتی که می خواهی روی خاصیتها بدی رو به صورت دستی بعد از فراخوانی تابع InitializeComponent توی constructor وارد کن و ببین باز هم اعمال نمی شن؟

reza_rad
دوشنبه 16 بهمن 1385, 14:03 عصر
تغییرات رو روی یوزر کنترل اعمال می کنی یا روی کنترلهایی که درون یوزر کنترل قرار دادی؟


این کنترلها بصورت Property ست و گت میشن و من هم مثلا Backcolor یکی از این کنترلها رو از توی فرمم عوض می کنم.



البته در هر دو حالت نباید مشکلی پیش بیاد و باید تغییرات درست نمایش داده بشه. احتمالا جای دیگه ای مشکل داره.


دقیقا.
من هم حدس میزنم یه اشکال الکی جایی وجود داشته باشه. ولی چی و کجا نمی دونم!



یک بار هم تغییراتی که می خواهی روی خاصیتها بدی رو به صورت دستی بعد از فراخوانی تابع InitializeComponent توی constructor وارد کن و ببین باز هم اعمال نمی شن؟


چرا اعمال میشن. ولی ممکنه کسی که قراره از این یوزر کنترل استفاده کنه بخواد تعداد زیادی از پراپرتی ها رو تغیر بده که اینجوری غیرمنطقی هست یه کم.

مرسی امید جان که کمک می کنی:)

omid_Ahmadi
دوشنبه 16 بهمن 1385, 14:18 عصر
چرا اعمال میشن. ولی ممکنه کسی که قراره از این یوزر کنترل استفاده کنه بخواد تعداد زیادی از پراپرتی ها رو تغیر بده که اینجوری غیرمنطقی هست یه کم.


با توجه به اینکه خاصیتها رو اگر بعد از InitializeComponent تنظیم کنی، درست می مونن احتمالا توی متد InitializeComponent یه چیزی باعث می شه که این خاصیتها مقدار نگیرن. باید اون متد رو دقیق تریس کنی ببینی مشکل از کجاست.

پ.ن.:
من هم از یه کنترلی در یکی از برنامه هام استفاده کرده بودم که یکی از خاصیتهاش همین مشکل رو داشت، یعنی با وجود اینکه در متد InitializeComponent مقدار اون برابر یه ارزشی قرار گرفته بود و در زمان طراحی هم درست نشون می داد که تغییرات اعمال شدن، اما در زمان اجرا تغییری مشاهده نمی شد. البته فقط همون یه خاصیت به اون حالت بود و چون کنترل رو خودم ننوشته بودم (و کد خیلی طولانی هم داشت) مجبور بودم که خاصیت رو بعد از InitializeComponent تنظیم کنم.

reza_rad
دوشنبه 16 بهمن 1385, 14:34 عصر
باید اون متد رو دقیق تریس کنی ببینی مشکل از کجاست.


اصلا به این متد نمی رسه
همین که run میکنم قبل از شروع به trace برمیگرده به حالت قبل!

ضمنا در حال تریس هم توی اونجایی که پراپرتی رو می خونه وارد نمیشه و فقط از روی متغیر private ای که اول new میشه میخونه!


private System.Windows.Forms.Panel panel3=new System.Windows.Forms.Panel();
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Label label1;



[Category("controls")]
public System.Windows.Forms.Panel pnlSide
{
get
{
return panel3;
}
set
{
panel3=value;
}
}

منظورم اینه که توی این قسمتی که مشخص کردم وارد نمیشه.
ضمن اینکه مشکل فکر کنم قبل از این باشه یعنی به تریس متد InitializeComponent نرسیده برمی گرده به حالت قبل!!!

omid_Ahmadi
دوشنبه 16 بهمن 1385, 14:43 عصر
رضا جان فکر کنم درست متوجه نشدم که مشکلت از کجاست. این طور که شما گفتی وقتی کنترل رو به فرم برنامه برای استفاده کردن اضافه می کنی و بعد خاصیت های اون رو تنظیم می کنی، با وجود اینکه خاصیت ها در زمان طراحی درست تنظیم می شن اما در زمان اجرا تاثیری ندارن. درسته؟
پس چه طور می گی به اجرای متد مربوط به InitializeComponent نمی رسه؟ خوب این متد که هون اول اجرا میشه (چه InitializeComponent مربوط به فرم اصلی که یوزر کنترل در اون قرار داده شده و چه InitializeComponent مربوط به خود کنترل)

reza_rad
دوشنبه 16 بهمن 1385, 14:50 عصر
آره دقیقا همینطوره.

و باید قبل از هر کاری InitializeComponent اجرا بشه ولی من همون اول InitializeComponent برک پوینت گذاشتم و اجرا که می کنم اول مثلا همون رنگ و .. برمیگرده به حالت اول و تازه اجرا میاد روی InitializeComponent !!!
خودم هم خیلی متعجبم!

ولی فرض کنیم شاید این نمایش ظاهری یه باگ یا هرچیز دیگه باشه ولی اینکه داخل متد SET پراپرتی نمیره هم جای سوال داره!

من کد مربوط به کنترل و فرم رو کامل میذارم اینجا شاید من خوب نمی تونم توضیح بدم:(


using System;
using System.Collections;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Windows.Forms;

namespace UIComponent
{
/// <summary>
/// Summary description for Panel2.
/// </summary>
public class Panel2 : /*System.Windows.Forms.Panel */System.Windows.Forms.UserControl
{
private System.Windows.Forms.Splitter splitter1;
private System.Windows.Forms.Button button1;
private System.Windows.Forms.Panel panel1;
private Janus.Windows.ExplorerBar.ExplorerBar explorerBar1=new Janus.Windows.ExplorerBar.ExplorerBar();
private Janus.Windows.ExplorerBar.ExplorerBarContainerCont rol explorerBarContainerControl1;
private Janus.Windows.ExplorerBar.ExplorerBarContainerCont rol explorerBarContainerControl2;
private System.Windows.Forms.Panel panel3=new System.Windows.Forms.Panel();
private System.Windows.Forms.Panel panel4;
private System.Windows.Forms.Label label1;



[Category("controls")]
public System.Windows.Forms.Panel pnlSide
{
get
{
return panel3;
}
set
{
panel3=value;
}
}


/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

[Category("controls")]
public Janus.Windows.ExplorerBar.ExplorerBar ExBar
{
get
{
return explorerBar1;
}
set
{
explorerBar1=value;
}
}

public Panel2()
{
// This call is required by the Windows.Forms Form Designer.
InitializeComponent();

// TODO: Add any initialization after the InitializeComponent call

}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Component Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
// protected override System.Windows.Forms.Control.ControlCollection CreateControlsInstance()
// {
// //return base.CreateControlsInstance ();
// }

private void InitializeComponent()
{
Janus.Windows.ExplorerBar.ExplorerBarGroup explorerBarGroup1 = new Janus.Windows.ExplorerBar.ExplorerBarGroup();
Janus.Windows.ExplorerBar.ExplorerBarGroup explorerBarGroup2 = new Janus.Windows.ExplorerBar.ExplorerBarGroup();
this.explorerBarContainerControl1 = new Janus.Windows.ExplorerBar.ExplorerBarContainerCont rol();
this.explorerBarContainerControl2 = new Janus.Windows.ExplorerBar.ExplorerBarContainerCont rol();
this.splitter1 = new System.Windows.Forms.Splitter();
this.button1 = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
this.panel4 = new System.Windows.Forms.Panel();
this.label1 = new System.Windows.Forms.Label();
//this.panel3 = new System.Windows.Forms.Panel();
//this.explorerBar1 = new Janus.Windows.ExplorerBar.ExplorerBar();

this.panel1.SuspendLayout();
this.panel4.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.e xplorerBar1)).BeginInit();
this.explorerBar1.SuspendLayout();
this.SuspendLayout();
//
// explorerBarContainerControl1
//
this.explorerBarContainerControl1.Location = new System.Drawing.Point(9, 33);
this.explorerBarContainerControl1.Name = "explorerBarContainerControl1";
this.explorerBarContainerControl1.Size = new System.Drawing.Size(166, 56);
this.explorerBarContainerControl1.TabIndex = 1;
//
// explorerBarContainerControl2
//
this.explorerBarContainerControl2.Location = new System.Drawing.Point(9, 125);
this.explorerBarContainerControl2.Name = "explorerBarContainerControl2";
this.explorerBarContainerControl2.Size = new System.Drawing.Size(166, 45);
this.explorerBarContainerControl2.TabIndex = 2;
//
// splitter1
//
this.splitter1.BackColor = System.Drawing.SystemColors.ActiveBorder;
this.splitter1.Location = new System.Drawing.Point(0, 0);
this.splitter1.Name = "splitter1";
this.splitter1.Size = new System.Drawing.Size(5, 512);
this.splitter1.TabIndex = 0;
this.splitter1.TabStop = false;
//
// button1
//
this.button1.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.button1.Dock = System.Windows.Forms.DockStyle.Right;
this.button1.Font = new System.Drawing.Font("Tahoma", 8.25F);
this.button1.Location = new System.Drawing.Point(181, 0);
this.button1.Name = "button1";
this.button1.Size = new System.Drawing.Size(30, 24);
this.button1.TabIndex = 1;
this.button1.Text = ">";
this.button1.Click += new System.EventHandler(this.button1_Click);
//
// panel1
//
this.panel1.Controls.Add(this.panel4);
this.panel1.Controls.Add(this.panel3);
this.panel1.Controls.Add(this.explorerBar1);
this.panel1.Dock = System.Windows.Forms.DockStyle.Fill;
this.panel1.Location = new System.Drawing.Point(5, 0);
this.panel1.Name = "panel1";
this.panel1.Size = new System.Drawing.Size(211, 512);
this.panel1.TabIndex = 2;
//
// panel4
//
this.panel4.Controls.Add(this.label1);
this.panel4.Controls.Add(this.button1);
this.panel4.Dock = System.Windows.Forms.DockStyle.Top;
this.panel4.Location = new System.Drawing.Point(0, 0);
this.panel4.Name = "panel4";
this.panel4.Size = new System.Drawing.Size(211, 24);
this.panel4.TabIndex = 6;
//
// label1
//
this.label1.BackColor = System.Drawing.SystemColors.ControlDark;
this.label1.Dock = System.Windows.Forms.DockStyle.Fill;
this.label1.Font = new System.Drawing.Font("Tahoma", 8.25F);
this.label1.Location = new System.Drawing.Point(0, 0);
this.label1.Name = "label1";
this.label1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.label1.Size = new System.Drawing.Size(181, 24);
this.label1.TabIndex = 2;
this.label1.Text = "جستجو";
this.label1.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// panel3
//
this.panel3.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Wind ows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Right)));
this.panel3.Location = new System.Drawing.Point(187, 23);
this.panel3.Name = "panel3";
this.panel3.Size = new System.Drawing.Size(30, 489);
this.panel3.TabIndex = 5;
//
// explorerBar1
//
this.explorerBar1.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Win dows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.explorerBar1.BackgroundFormatStyle.BackColor = System.Drawing.SystemColors.ControlLight;
this.explorerBar1.BackgroundFormatStyle.BackColorG radient = System.Drawing.SystemColors.ControlLight;
this.explorerBar1.BackgroundFormatStyle.Background ThemeStyle = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
this.explorerBar1.BackgroundThemeStyle = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
this.explorerBar1.Controls.Add(this.explorerBarCon tainerControl1);
this.explorerBar1.Controls.Add(this.explorerBarCon tainerControl2);
this.explorerBar1.Font = new System.Drawing.Font("Tahoma", 8.25F);
explorerBarGroup1.Container = true;
explorerBarGroup1.ContainerControl = this.explorerBarContainerControl1;
explorerBarGroup1.ContainerHeight = 57;
explorerBarGroup1.FormatStyle.BackColor = System.Drawing.SystemColors.AppWorkspace;
explorerBarGroup1.FormatStyle.BackgroundThemeStyle = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
explorerBarGroup1.FormatStyle.ForegroundThemeStyle = Janus.Windows.ExplorerBar.ForegroundThemeStyle.Non e;
explorerBarGroup1.ItemsFormatStyle.BackColor = System.Drawing.SystemColors.ControlLight;
explorerBarGroup1.ItemsFormatStyle.BackgroundTheme Style = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
explorerBarGroup1.Key = "Group1";
explorerBarGroup1.ShowGroupBorder = Janus.Windows.ExplorerBar.TriState.True;
explorerBarGroup1.Text = "در چه فاصله زمانی جستجو شود؟";
explorerBarGroup2.Container = true;
explorerBarGroup2.ContainerControl = this.explorerBarContainerControl2;
explorerBarGroup2.ContainerHeight = 46;
explorerBarGroup2.FormatStyle.BackColor = System.Drawing.SystemColors.AppWorkspace;
explorerBarGroup2.FormatStyle.BackgroundThemeStyle = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
explorerBarGroup2.FormatStyle.ForegroundThemeStyle = Janus.Windows.ExplorerBar.ForegroundThemeStyle.Non e;
explorerBarGroup2.ItemsFormatStyle.BackColor = System.Drawing.SystemColors.ControlLight;
explorerBarGroup2.ItemsFormatStyle.BackgroundTheme Style = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
explorerBarGroup2.Key = "Group2";
explorerBarGroup2.Text = "در چه واحد تجاری؟";
this.explorerBar1.Groups.AddRange(new Janus.Windows.ExplorerBar.ExplorerBarGroup[] {
explorerBarGroup1,
explorerBarGroup2});
this.explorerBar1.GroupsFormatStyle.BackColor = System.Drawing.SystemColors.AppWorkspace;
this.explorerBar1.GroupsFormatStyle.BackColorGradi ent = System.Drawing.Color.Transparent;
this.explorerBar1.GroupsFormatStyle.BackgroundThem eStyle = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
this.explorerBar1.GroupsFormatStyle.ForegroundThem eStyle = Janus.Windows.ExplorerBar.ForegroundThemeStyle.Non e;
this.explorerBar1.HeaderRoundedCorners = Janus.Windows.ExplorerBar.HeaderRoundCorners.Both;
this.explorerBar1.HoverItemFormatStyle.FontUnderli ne = Janus.Windows.ExplorerBar.TriState.True;
this.explorerBar1.ItemsFormatStyle.BackColor = System.Drawing.SystemColors.ControlLight;
this.explorerBar1.ItemsFormatStyle.BackgroundTheme Style = Janus.Windows.ExplorerBar.BackgroundThemeStyle.Non e;
this.explorerBar1.Location = new System.Drawing.Point(0, 23);
this.explorerBar1.Name = "explorerBar1";
this.explorerBar1.RightToLeft = System.Windows.Forms.RightToLeft.Yes;
this.explorerBar1.Selectable = true;
this.explorerBar1.Size = new System.Drawing.Size(184, 489);
this.explorerBar1.TabIndex = 4;
this.explorerBar1.Text = "explorerBar1";
//
// Panel2
//
this.BackColor = System.Drawing.SystemColors.ControlLight;
this.Controls.Add(this.panel1);
this.Controls.Add(this.splitter1);
this.Cursor = System.Windows.Forms.Cursors.Default;
this.Name = "Panel2";
this.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.Size = new System.Drawing.Size(216, 512);
this.panel1.ResumeLayout(false);
this.panel4.ResumeLayout(false);
((System.ComponentModel.ISupportInitialize)(this.e xplorerBar1)).EndInit();
this.explorerBar1.ResumeLayout(false);
this.ResumeLayout(false);

}
#endregion

private void button1_Click(object sender, System.EventArgs e)
{
if (button1.Text==">")
{
this.Dock=System.Windows.Forms.DockStyle.None;
this.Width=30;
this.Dock=System.Windows.Forms.DockStyle.Right;

button1.Text="<";
}
else
{
button1.Text=">";
}
//base.Width=100;


}


}
}





using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;

namespace TestUI
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
private UIComponent.Panel2 panel21;//= new UIComponent.Panel2();
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;

public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();

//
// TODO: Add any constructor code after InitializeComponent call
//
//this.panel22.ExBar.BackgroundFormatStyle.BackColor =System.Drawing.Color.Red ;
}

/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if(components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.panel21 = new UIComponent.Panel2();
this.SuspendLayout();
//
// panel21
//
this.panel21.BackColor = System.Drawing.SystemColors.ControlLight;
this.panel21.Cursor = System.Windows.Forms.Cursors.Default;
this.panel21.Location = new System.Drawing.Point(304, 80);
this.panel21.Name = "panel21";
this.panel21.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.panel21.Size = new System.Drawing.Size(216, 512);
this.panel21.TabIndex = 0;
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(760, 542);
this.Controls.Add(this.panel21);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion
}
}



بازم ممنون از پیگیری هات امیدجان:)

omid_Ahmadi
دوشنبه 16 بهمن 1385, 15:19 عصر
شرمنده من نتونستم کد رو اجرا کنم چون هم جانوس نداشتم و هم فرک کنم کد مربوط به ویژوال استودیو 2003 بود که روی سیستم من نصب نیست.



من همون اول InitializeComponent برک پوینت گذاشتم و اجرا که می کنم اول مثلا همون رنگ و .. برمیگرده به حالت اول و تازه اجرا میاد روی InitializeComponent !!!


یعنی یک سری کدها قبل از تابع InitializeComponent اجرا می شن؟ یا اینکه ...؟

راستی، شرمنده یه مقدار دیر شد. :)

reza_rad
سه شنبه 17 بهمن 1385, 08:41 صبح
شرمنده من نتونستم کد رو اجرا کنم چون هم جانوس نداشتم و هم فرک کنم کد مربوط به ویژوال استودیو 2003 بود که روی سیستم من نصب نیست.


خواهش می کنم.
آره 2003 هست



یعنی یک سری کدها قبل از تابع InitializeComponent اجرا می شن؟ یا اینکه ...؟


آخه هیچ کدی قبل از اون نیست! اینجاش رو فرض کنیم مهم نیست.

فکر کنم مشکل اصلی اینه که پراپرتی توی قسمت SET مقدار نمیگیره و اصلا داخل اون قسمت هم نمیشه



راستی، شرمنده یه مقدار دیر شد. :)


خواهش می کنم. من شرمنده ام که اینقدر مشکلات عجیب مطرح می کنم! ممنون:)

reza_rad
سه شنبه 17 بهمن 1385, 13:17 عصر
من همین الان یه چیز دیگه متوجه شدم:

پراپرتی هایی که من تغییر میدم قاعدتا باید در متد InitializeComponent فرم کدی مربوط به ست کردن اون پراپرتی اضافه بشه دیگه درسته؟

ولی اینجا این اتفاق نمی افته. یعنی وقتی مثلا من Backcolor مربوط به یک پنل روی یوزر کنترل رو از طریق پنجره پراپرتی عوض می کنم کد زیر اضافه نمیشه:


this.panel22.pnlSide.BackColor=System.Drawing.Colo r.Red;


و حالا اگه خودم دستی توی همون متد InitilizeComponent فرم اضافه اش کنم کار می کنه.

می دونید چرا این کد ها که باید خودکار اضافه بشن، اضافه نمیشن؟!

omid_Ahmadi
سه شنبه 17 بهمن 1385, 21:14 عصر
پراپرتی هایی که من تغییر میدم قاعدتا باید در متد InitializeComponent فرم کدی مربوط به ست کردن اون پراپرتی اضافه بشه دیگه درسته؟

ولی اینجا این اتفاق نمی افته. یعنی وقتی مثلا من Backcolor مربوط به یک پنل روی یوزر کنترل رو از طریق پنجره پراپرتی عوض می کنم کد زیر اضافه نمیشه


بعضی مواقع ویژوال استودیو رفتار عجیبی از خودش نشون می ده. چند وقت پیش که داشتم با C# یه برنامه ای رو می نوشتم، می خواستم محیط یه فرم رو درست کنم، وقتی کنترل های لازم رو از توی Toolbox اضافه کردم، هر کدم یه جایی قرار گرفتن، بعد که همه خاصیتهای اون رو درست تنظیم کردم و ظاهر فرم تکمیل شد، برنامه رو که اجرا می کردم میدیدم کنترلها به همون حالتی که موقع اضافه کردن از Toolbox بودن ( یعنی به صورت در هم در فرم) قرار می گرفتن. وقتی برنامه رو می بستم و میومدم توی محیط طراحی، می دیدم همه چیز همون طور که باید باشه طوی فرم قرار داره. رفتم کد توی InitializeComponent رو چک کردم دیدم اصلا تغییرات توی اون فایل نوشته نشدن، مثلا موقعیت کنترل X رو برابر با یه مقداری قرار داده بودم، توی محیط طراحی این موقعیت برابر با مقدار مورد نظر من نشون داده می شد، اما توی تابع InitializeComponent هیچ کدی برای تغییر موقعیت نوشته نشده بود و از هر روشی هم که استفاده کردم درست نشد. تنها کاری که تونستم بکنم این بود که یه فرم دیگه بگیرم و کار رو از نو شروع کنم (این مورد توی 2005 بود)، حالا دیگه نتیجه گیریش با خودت چون راه حلی به ذهن من نمی رسه!

reza_rad
چهارشنبه 18 بهمن 1385, 07:34 صبح
ممنون امید جان
ولی مشکل من با ایجاد فرم جدید و پروژه جدید و ... حل نمیشه :(

بهرحال خیلی ممنون

reza_rad
چهارشنبه 18 بهمن 1385, 10:23 صبح
یه چیز دیگه:

وقتی مقدار پراپرتی رو که از نوع کنترل هست ،مساوی یه کنترل از همون نوع میذارم مثلا مقدار پراپرتی panel رو میذارم مساوی panel1 که توی فرم گذاشتم ست میشه و کد مربوط بهش هم توی InitializeComponent اضافه میشه.
ولی در مورد پراپرتی هایی که زیرمجموعه ی اون کنترل هست این اتفاق نمی افته!
نمی دونم متوجه شدید یا نه!؟

آیا باید تنظیم خاصی انجام بشه؟