请问怎样让一个form有垂直滚动条和水平滚动条?

howtofind 2003-10-21 01:13:14
是关于main form的,谢谢.
...全文
818 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
howtofind 2003-10-21
  • 打赏
  • 举报
回复
up
howtofind 2003-10-21
  • 打赏
  • 举报
回复
谢谢各位,我试过了,还是不行,我的整个代码是这样的:

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

namespace WindowsApplication15
{

public class Form1 : System.Windows.Forms.Form
{
private System.Windows.Forms.Button button1;

private System.ComponentModel.Container components = null;
Control control;

public Form1()
{

InitializeComponent();

}

protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}

#region Windows 窗体设计器生成的代码

private void InitializeComponent()
{
this.button1 = new System.Windows.Forms.Button();
this.SuspendLayout();

this.button1.Location = new System.Drawing.Point(208, 80);
this.button1.Name = "button1";
this.button1.TabIndex = 0;
this.button1.Text = "button1";
this.button1.Click += new System.EventHandler(this.button1_Click);

this.AutoScaleBaseSize = new System.Drawing.Size(6, 14);
this.AutoScroll = true;
this.ClientSize = new System.Drawing.Size(292, 270);
this.Controls.Add(this.button1);
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);

}
#endregion

[STAThread]
static void Main()
{
Application.Run(new Form1());
}

private void button1_Click(object sender, System.EventArgs e)
{
Graphics graphics2 =CreateGraphics();
Image newImage1 = Image.FromFile("c:\\Capturess.bmp");
Point ulCorner = new Point( 0, 0);
graphics2.DrawImage(newImage1, ulCorner);
}
}
}
三杯倒 2003-10-21
  • 打赏
  • 举报
回复
[C#]
private void DisplayMyScrollableForm()
{
// Create a new form.
Form form2 = new Form();
// Create a button to add to the new form.
Button button1 = new Button();
// Set text for the button.
button1.Text = "Scrolled Button";
// Set the size of the button.
button1.Size = new Size(100,30);
// Set the location of the button to be outside the form's client area.
button1.Location = new Point(form2.Size.Width + 200, form2.Size.Height + 200);

// Add the button control to the new form.
form2.Controls.Add(button1);
// Set the AutoScroll property to true to provide scrollbars.
form2.AutoScroll = true;

// Display the new form as a dialog box.
form2.ShowDialog();
}
Alton1981 2003-10-21
  • 打赏
  • 举报
回复
若控件的size比窗体的size大,窗体会自动添加垂直滚动条和水平滚动条
shajie 2003-10-21
  • 打赏
  • 举报
回复
设置form的AutoScroll属性为True
当控件被放置在窗体的工作区域之外时,滚动条会自动出现
1. HTML对象获取问题 3 2. const问题 3 3. event.x与event.y问题 3 4. window.location.href问题 3 5. frame问题 3 6. 模态和非模态窗口问题 3 7. firefox与IE的父元素(parentElement)的区别 3 8. document.formName.item(”itemName”) 问题 3 9. 集合类对象问题 3 10. 自定义属性问题 3 11. input.type属性问题 3 12. event.srcElement问题 3 13. body载入问题 3 14. 事件委托方法 3 15. Table操作问题 3 16. 对象宽高赋值问题 3 Ø CSS 3 1. cursor:hand VS cursor:pointer 3 2. innerText在IE中能正常工作,但在FireFox中却不行. 3 3. CSS透明 3 4. css中的width和padding 3 5. FF和IE BOX模型解释不一致导致相差2px 3 6. IE5 和IE6的BOX解释不一致 3 7. ul和ol列表缩进问题 3 8. 元素水平居中问题 3 9. Div的垂直居中问题 3 10. margin加倍的问题 3 11. IE与宽度和高度的问题 3 12. 页面的最小宽度 3 13. DIV浮动IE文本产生3象素的bug 3 14. IE捉迷藏的问题 3 15. float的div闭合;清除浮动;自适应高度 3 16. 高度不适应 3 17. IE6下图片下有空隙产生 3 18. 对齐文本与文本输入框 3 19. LI中内容超过长度后以省略号显示 3 20. 为什么web标准中IE无法设置滚动条颜色了 3 21. 为什么无法定义1px左右高度的容器 3 22. 链接(a标签)的边框与背景 3 23. 超链接访问过后hover样式就不出现的问题 3 24. FORM标签 3 25. 属性选择器(这个不能算是兼容,是隐藏css的一个bug) 3 26. 为什么FF下文本无法撑开容器的高度 3

110,499

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧