vb.net综合程序 vbnet doevent

帮忙用vb.net写程序?急着用的 。帮帮忙这个程序很简单 , 我以前做过算素数的,算随机十以内的用来教我一个小叔子的儿子,你看看VB基础就可以写的出了,如果碰到代码问题可以找人帮忙 , 但是如果你单独让人来代写那么不是很现实,好像知道貌似没有帮代做单独软件的吧
vb.net开发简单的时钟程序??高手救救我!就





Hand类的代码:
Public MustInherit Class Hand
Protected gp As GraphicsPath = New GraphicsPath()
Protected gpBase As GraphicsPath = Nothing
Protected midX As Integer = 150 ‘默认的窗体
Protected midY As Integer = 150 ‘中心位置
‘构造器,得到窗体中心位置
Public Sub New(ByVal theForm As Form1)
midX = (theForm.ClientRectangle.LefttheForm.ClientRectangle.Right) / 2
midY = (theForm.ClientRectangle.ToptheForm.ClientRectangle.Bottom) / 2
End Sub
MustOverride Sub Transform(ByVal d As DateTime)
‘绘制指针路径
Overridable Sub Draw(ByVal g As Graphics)
Dim aPen As Pen = New Pen(Brushes.Black, 4F)
g.DrawPath(aPen, gp)
g.FillPath(Brushes.Black, gp)
aPen.Dispose()
End Sub
‘使用矩阵实现路径(gp)的旋转
Public Sub Rotate(ByVal angle As Double)
gp = CType(gpBase.Clone(), GraphicsPath)
Dim mTransform As Matrix = New Matrix()
mTransform.RotateAt(CType(angle,Single),NewPointF(midX,midY))
gp.Transform(mTransform)
End Sub
End Class
为了节省篇幅,上面的代码省略了引入命名空间的语句 。
下面是分针(MinuteHand)类的定义:
Public Class MinuteHand
Inherits Hand
‘构造器 , 生成绘制分针的路径(gp)
Public Sub New(ByVal myForm As Form1)
MyBase.New(myForm)
gp.AddLine(midX, midY, midX, 45)
gp.AddLine(midX, 45, midX - 3, 50)
gp.AddLine(midX - 3, 50, midX3, 50)
gp.AddLine(midX3, 50, midX, 45)
gpBase = CType(gp.Clone(), GraphicsPath)
End Sub
‘Transform方法取得系统当前时间,并旋转时钟指针 。
Public Overrides Sub Transform(ByVal d As DateTime)
Dim minuteTime As Double = (CDbl(d.Minute)CDbl(d.Second / 60))
Dim angle As Double = (CDbl(minuteTime) / 60) * 360
Rotate(angle)
End Sub
End Class
对所有的指针旋转的方法都是相同的,因此在基类中实现 。由于时针和秒针的实现与分针相似,所不同者,只在于构造器中绘制的指针路径不同和Transform方法中转动的角度不同,在这里就不在赘述了 。
另外还需要提一下的是画时钟表面的代码 , 时钟表面用ClockFace类来实现 。这个类首先画一个圆代表时钟,然后画上米老鼠的图案 , 最后在相应的位置画上数字1~12代表12个小时 。
Public Sub Draw(ByVal g As Graphics)
DrawClockFace(g)
DrawImage(g)
DrawNumbers(g)
DrawPin(g)
End Sub
下面是ClockFace类的属性:
Private ClockRectangle As Rectangle
Private ClockFont As Font = New Font("Arial", 12)
Private midPoint As Point
Private ClockImage As Bitmap
Private Const IMAGEX As Integer = 50
Private Const IMAGEY As Integer = 50
DrawClockFace方法用来画时钟表面:
Private Sub DrawClockFace(ByVal g As Graphics)
g.FillEllipse(Brushes.White, ClockRectangle.Left10, ClockRectangle.Top10, ClockRectangle.Width - 20, ClockRectangle.Height - 20)
g.DrawEllipse(Pens.Black, ClockRectangle.Left10, ClockRectangle.Top10, ClockRectangle.Width - 20, ClockRectangle.Height - 20)
End Sub
然后用Graphics对象的DrawImage方法画出米老鼠的图片:
Private Sub DrawImage(ByVal g As Graphics)
Dim nWidth As Integer = ClockImage.Width
Dim nHeight As Integer = ClockImage.Height
Dim destRect As Rectangle = New Rectangle(midPoint.X - IMAGEX / 2, midPoint.Y - IMAGEY / 2, IMAGEX, IMAGEY)
g.DrawImage(ClockImage, destRect)
End Sub
数字在时钟上的位置是用sin和cos函数计算的:
Private Sub DrawNumbers(ByVal g As Graphics)
Dim count As Integer = 1
Dim a As Double
For a = 0 To 2 * Math.PI Step 2 * Math.PI / 12
Dim x As Double = (ClockRectangle.Width - 70) / 2 * Math.Cos(a - Math.PI / 3)(ClockRectangle.Width - 70) / 225
Dim y As Double = (ClockRectangle.Width - 70) / 2 * Math.Sin(a - Math.PI / 3)(ClockRectangle.Width - 70) / 220
g.DrawString(Convert.ToString(count), ClockFont, Brushes.Black, CType(x, Single), CType(y, Single), New StringFormat())
count= 1
Next
End Sub
最后是窗体文件(Form1.vb):
Public Class Form1
Inherits System.Windows.Forms.Form
Private MyMinuteHand As MinuteHand
Private MyHourHand As HourHand
Private MySecondHand As SecondHand
Private TheClockFace As ClockFace
Private FirstTick As Boolean = False
‘在窗体的OnPaint事件中取得Graphics对象
Protected Overrides Sub OnPaint(ByVal e As System.Windows.Forms.PaintEventArgs)
If (FirstTick = False) Then Exit Sub
Dim g As Graphics = e.Graphics
TheClockFace.Draw(g)
MyHourHand.Draw(g)
MyMinuteHand.Draw(g)
MySecondHand.Draw(g)
TheClockFace.DrawPin(g)
End Sub
‘计时器事件
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
【vb.net综合程序 vbnet doevent】MySecondHand.Transform(DateTime.Now)
MyHourHand.Transform(DateTime.Now)
MyMinuteHand.Transform(DateTime.Now)
FirstTick = True
Invalidate()
用vb.net编写程序系统托盘里显示图标的话用NotifyIcon组件,建立一个ContextMenuStrip控件与之关联 。关联的位置在NotifyIcon.ContextMenuStrip 。关机直接shell 命令列:rundll32.exe user.exe,exitwindows就可以,声音提示用My.Compurer.Audio.Play ("路径") , 提示消息用Msgbox函数……通过判断返回值在确定是否关机……手头没有VB.Net……大概思路就是这样,不知道能不能对你有帮助……如果要代码的话,不忙的时候可以给你写
用VB.NET程序编写代码Delphi代码如下vb.net综合程序:
procedure TForm1.Button1Click(Sender: TObject);
var
购物总价:Integer;
折扣:Extended;
begin
购物总价:=StrToInt(Edit1.Text);
if 购物总价250 then
begin
折扣:=0;
end
else if 购物总价500 then
begin
折扣:=0.05;
end
else if 购物总价1000 then
begin
折扣:=0.075;
end
else if 购物总价2000 then
begin
折扣:=0.1;
end
{
此段vb.net综合程序的折扣是多少vb.net综合程序?
else if 购物总价3000 then
begin
折扣:=0.05;
end
}
else if 购物总价=3000 then
begin
折扣:=0.15;
end;
ShowMessage('您享受vb.net综合程序的折扣是vb.net综合程序:' FloatToStr(折扣)
' 原价:' IntToStr(购物总价)
' 折后总价:' FloatToStr(购物总价*(1-折扣)));
end;
求用VB.net编写实现以下求和程序的源代码(Visual Studio)f(k)的输入太坑爹vb.net综合程序了 。f(k)给定vb.net综合程序,或者f(k)只有加减乘除还好点 。
vb.net综合程序的介绍就聊到这里吧,感谢你花时间阅读本站内容,更多关于vbnet doevent、vb.net综合程序的信息别忘了在本站进行查找喔 。

    推荐阅读