跪求vb.net代码
新建窗口,添加picture控件
创新互联专业为企业提供梁子湖网站建设、梁子湖做网站、梁子湖网站设计、梁子湖网站制作等企业网站建设、网页设计与制作、梁子湖企业网站模板建站服务,十载梁子湖做网站经验,不只是建网站,更提供有价值的思路和整体网络服务。
利用line()方法画线
line(开始x坐标,开始y坐标)-(结束x坐标,结束y坐标),线的颜色,画线的方式(默认为线,B为矩形无填充,BF为填充的矩形)
For i = 1 To 16
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(255, 0, 0)
Picture1.Line (0, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(255, 0, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), 0), RGB(0, 255, 0)
Picture1.Line (Picture1.Width, Picture1.Height / 2)-(i * (Picture1.Width / 16), Picture1.Height), RGB(0, 255, 0)
Next i
如果要在窗口上画也可以调用窗口的line方法即form.line()
求高手给一个VB.NET的程序开机启动和关闭开机启动的示例代码
Private Sub 开机自动启动_Click(sender As Object, e As EventArgs) Handles 开机自动启动.Click
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.SetValue("查看.exe", Application.StartupPath "\查看.exe")
End Sub
Private Sub 关闭开机自启_Click(sender As Object, e As EventArgs) Handles 关闭开机自启.Click
Dim a As Microsoft.Win32.RegistryKey = My.Computer.Registry.CurrentUser.CreateSubKey("Software\Microsoft\Windows\CurrentVersion\Run")
a.DeleteValue("查看.exe")
End Sub
用VB.NET编写以下程序。
using System;
using System.Windows.Forms;
namespace WindowsFormsApplication1
{
public partial class Form1 : Form
{
Timer tm = new Timer();//实例化 timeer
static int timeS = 0; //设置静态变量记录秒数
TimeSpan ts = new TimeSpan(); //实例化 TimeSpan
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
tm.Interval = 1000; //设置 timeer 1000毫秒执行一次
tm.Tick += new EventHandler(timeer_Tick); //设置 timeer 运行事件
tm.Start(); // 启用 timeer
}
private void timeer_Tick(object sender, EventArgs e)
{
timeS += 1; //秒数 +1
ts = new TimeSpan(0, 0, timeS);
label1.Text = ts.Hours + ":" + ts.Minutes + ":" + ts.Seconds;
}
private void button2_Click(object sender, EventArgs e)
{
tm.Stop();
timeS = 0;
}
}
}
分享文章:vb.net范例程序,VBNET教程
链接分享:http://scyingshan.cn/article/hoeodi.html