The Visual Studio.NET about C#
来源:互联网 发布:java遍历字符串数组 编辑:程序博客网 时间:2024/04/29 16:00
C#关于WinForm可以拉伸的菜单的操作
private void Form1_Load(object sender, EventArgs e)
{
this.自定义下拉菜单名称ToolStripMenuItem.Visible = false;
}
private void toolStripMenuItem3_MouseHover(object sender, EventArgs e)
{
switch
{
case 1:
this. 自定义下拉菜单名称ToolStripMenuItem.Visible = false;
i = 2;
this. 自定义菜单名称ToolStripMenuItem.ShowDropDown();
break;
case 2:
this. 自定义下拉菜单名称ToolStripMenuItem.Visible = true;
i = 1;
this.自定义菜单名称ToolStripMenuItem.ShowDropDown();
break;
}
}
C#关于WinForm带导航菜单的主界面的操作
需要把控件button2和button3的Dock值设置为bottom
private void Form2_Load(object sender, EventArgs e)
{
listView1.Clear();
listView1.Items.Add("自定义项目", "自定义项目", 0);
listView1.Items.Add("自定义项目", "自定义项目", 1);
listView1.Items.Add("自定义项目", "自定义项目", 2);
}
private void button1_Click(object sender, EventArgs e)
{
listView1.Dock = DockStyle.None;
button1.Dock = DockStyle.Top;
button2.Dock = DockStyle.Bottom;
button3.SendToBack();
button3.Dock = DockStyle.Bottom;
listView1.BringToFront();
listView1.Dock = DockStyle.Bottom;
listView1.Clear();
listView1.Items.Add("自定义项目", "自定义项目", 0);
listView1.Items.Add("自定义项目", "自定义项目", 1);
listView1.Items.Add("自定义项目", "自定义项目", 2);
}
private void button2_Click(object sender, EventArgs e)
{
listView1.Dock = DockStyle.None;
button2.Dock = DockStyle.Top;
button1.SendToBack();
button1.Dock = DockStyle.Top;
button3.Dock = DockStyle.Bottom;
listView1.Dock = DockStyle.Bottom;
listView1.Clear();
listView1.Items.Add("abcd","efg",3);
listView1.Items.Add("abcd","efg",4);
}
C#关于WinForm计算器式输入的操作
private void Form3_Load(object sender, EventArgs e)
{
lbl_0.Click += new EventHandler(lbl_Click);
lbl_1.Click += new EventHandler(lbl_Click);
lbl_2.Click += new EventHandler(lbl_Click);
lbl_3.Click += new EventHandler(lbl_Click);
lbl_4.Click += new EventHandler(lbl_Click);
lbl_5.Click += new EventHandler(lbl_Click);
lbl_6.Click += new EventHandler(lbl_Click);
lbl_7.Click += new EventHandler(lbl_Click);
lbl_8.Click += new EventHandler(lbl_Click);
lbl_9.Click += new EventHandler(lbl_Click);
}
void lbl_Click(object sender, EventArgs e)
{
Label l = (Label)sender;
textBox1.Text += l.Name.Substring(4, 1);
textBox1.SelectionStart = textBox1.Text.Length;
}
C#关于WinForm如何让字体在屏幕中滚动的操作
private void timer1_Tick(object sender, EventArgs e)
{
label1.Left -= 2;
if (label1.Right < 0)
{
label1.Left = this.Width;
}
}
C#关于WinForm如何让无标题栏的窗体随意移动操作
这里以WinForm窗体为例
private void Form1_MouseDown(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
startX = e.X;
StartY = e.Y;
}
}
private void Form1_MouseMove(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Left)
{
this.Left += e.X - startX;
this.Top += e.Y - StartY;
}
}
C#关于WinForm如何动态移动窗体的操作
需要引用的命名空间为:using System.Runtime.InteropServices;
public partial class Form4 : Form
{
public const Int32 AW_HOR_POSITIVE = 0 * 00000001;
public const Int32 AW_HOR_NEGATIVE = 0 * 000000002;
public const Int32 AW_VER_POSITIVE = 0x00000004;
public const Int32 AW_VER_NEGATIVE = 0x00000008;
public const Int32 AW_CENTER = 0x00000010;
public const Int32 AW_HIDE = 0x00010000;
public const Int32 AW_ACTIVATE = 0x00020000;
public const Int32 AW_SLIDE = 0x00040000;
public const Int32 AW_BLEND = 0x00080000;
public Form4()
{
InitializeComponent();
AnimateWindow(this.Handle, 400, AW_CENTER + AW_SLIDE);
}
[DllImportAttribute("user32.dll")]
private static extern bool AnimateWindow(IntPtr hwnd, int dwTime, int dwFlags);
C#关于WinForm如何在窗体上播放动画的操作
需要注意的是此例需要应用一个COM组件Microsoft
axAnimation1.Open("文件名称.avi");
C#关于WinForm如何编写移动窗体的操作
需要注意的是此例需要添加一个时钟的控件
private void Form1_Load(object sender, System.EventArgs e)
{
Point p = new Point(0,600);
this.DesktopLocation = p ;
}
private void timer1_Tick(object sender, System.EventArgs e)
{
Point a=new Point(0,600);
Point p = new Point(this.DesktopLocation.X + 1, this.DesktopLocation.Y);
this.DesktopLocation = p;
if (p.X == 550)
{
this.DesktopLocation=a;
}
}
- The Visual Studio.NET about C#
- The Visual Studio.NET about C#
- The Visual Studio.NET about C#
- The Visual Studio about C#
- The Visual Studio about C#
- The Book of Visual Studio .NET
- The Complete Reference to Professional SOA with Visual Studio 2005 (C# & VB 2005) .NET 3.0
- Visual Studio .NET: The .NET Framework Black Book
- Visual Studio .NET: The .NET Framework Black Book
- How to Use the Visual Studio .NET Application Center Test
- Tips and Tricks for the Visual Studio .NET IDE
- DDKBUILD - Integrating the Windows DDK with Visual Studio .Net
- Tips and Tricks for the Visual Studio .NET IDE
- Visual Studio.Net IDE 和c#编程概述
- C# .NET Visual Studio VS2008如何显示行号
- Visual Studio C#问题
- Visual Studio .NET 简介
- Visual Studio.NET快捷键
- org.apache.commons.beanutils.DynaBean
- 立秋以后调理有四忌
- How to Add Perl CGI Script Support to Your Apache Web Server on Windows
- switch-case再次分析
- 面朝大海, 春暖花开
- The Visual Studio.NET about C#
- ACM 1006
- 一键搞定Java桌面应用安装部署 —— exe4j + Inno Setup 带着JRE, 8M起飞
- C#关于启动运行时出错问题的维护方法
- AS3 中 class 的属性
- The Visual Studio.NET about C#
- 关于思维训练的对话
- 个人密码解决方案(草稿)
- The Visual Studio.NET about C#