- 1、本文档共31页,可阅读全部内容。
- 2、原创力文档(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。
- 3、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 4、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
查看更多
c学习的心得
C#实现控件随窗体大小自动改变
c# 2009-12-16 17:56:45 阅读1207 评论0 ??字号:大中小?订阅
using System;using System.Collections.Generic;using System.ComponentModel;using System.Data;using System.Drawing;using System.Text;using System.Windows.Forms;using System.Collections;
namespace WindowsApplication3{??? public partial class Form1 : Form??? {??????? /*******************设定程序中可能要用到的用以存储初始数据的动态数组及相关私有变量******************************/
??????? private ArrayList InitialCrl = new ArrayList();//用以存储窗体中所有的控件名称??????? private ArrayList CrlLocationX = new ArrayList();//用以存储窗体中所有的控件原始位置??????? private ArrayList CrlLocationY = new ArrayList();//用以存储窗体中所有的控件原始位置??????? private ArrayList CrlSizeWidth = new ArrayList();//用以存储窗体中所有的控件原始的水平尺寸??????? private ArrayList CrlSizeHeight = new ArrayList();//用以存储窗体中所有的控件原始的垂直尺寸??????? private int FormSizeWidth;//用以存储窗体原始的水平尺寸??????? private int FormSizeHeight;//用以存储窗体原始的垂直尺寸???????????? ??????? private double FormSizeChangedX;//用以存储相关父窗体/容器的水平变化量??????? private double FormSizeChangedY;//用以存储相关父窗体/容器的垂直变化量
??????? private int Wcounter = 0;//为防止递归遍历控件时产生混乱,故专门设定一个全局计数器?? ??????? /****************************************************************************************************************/
??????? public Form1()??????? {??????????? InitializeComponent();??????? }
??????? private void Form1_Load(object sender, EventArgs e)??????? {??????????? ??????????? GetInitialFormSize();??????????? //this.AutoScroll = true;??????????? //this.SetAutoSizeMode(FormSizeWidth,FormSizeHeight);??????????? //this.AutoScrollMinSize.Width = FormSizeWidth;??????????? //this.AutoScrollMinSize.Height = FormSizeHeight;??????????? GetAllCrlLocation(this);??????????? GetAllCrlSize(this);??????? }??????? public void GetAllCrlLocation(Control CrlContainer)//获得并存储窗体中各控件的初始位置??????? {??????????? foreach (Control iCrl in CrlContainer.Controls)??????????? {
??????????????? if (iCrl.Controls.Count 0)??????????????????? GetAllCrlLocation(iCrl);???????????
您可能关注的文档
- chaos head PC中文攻略.doc
- Chaotic Dynamics of a Nonlinear Ring Cavity Driven by an External Multifrequency Signal.pdf
- CHAOS直升机空战(新年版)安卓版 破解版 攻略.doc
- Chapter Four Designing Pricing Strategies定价策略.doc
- Characterising, Explaining, and Exploiting the Approximate Nature of StaticAnalysis through.pdf
- Characteristics of Aldoped ZnO thin films obtained by ultrasonic spray pyrolysis effects of Al dopi.pdf
- Characteristics of Microencapsulated Nutritional Oil for Infant Formula Food.pdf
- Characteristics of high efficiency dyesensitized solar cells.pdf
- Characteristics of solitary waves on a running film down an inclined plane under an electrostatic.pdf
- Characterization and Uncertainty Analysis of a Reference Pressure Measurement System for Wi.pdf
文档评论(0)