在VB.net中进行Querry计时控制? [英] Querry in VB.net while making a timer progress control?

查看:43
本文介绍了在VB.net中进行Querry计时控制?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,先生,

先生,实际上我是在vb.net中进行计时器进度控制的,但我不知道如何为它画一个圆圈并随着时间的增加用颜色填充它?
我的项目是:
1.创建一个圆
2.圆的总尺寸是总时间
3.打开页面后,启动计时器进度表".
4.时间继续进行,圆圈将是Green的特定部分.
5.增量持续时间为10分钟间隔.
6.因此,在一小时内,将有6个增量.
7.每个增量将由绿色层表示.
8.这意味着图表每隔10分钟将增加一个绿色层.
9.考试时间结束后,整个圆圈变成绿色.
10.该系统还将在考试完成时间前15分钟提醒用户/候选人.
11.此警报将是内联警报,并将继续到考试结束.
12.考试时间结束后,系统将自动保存用户数据并移至考试完成"页面.
如何做到这一点?
先生,请帮帮我.

谢谢.

Hello Sir,

Sir actually i m making a timer Progress control in vb.net in it i m not getting that how to make a circle for it and to fill it with color as time increase?
my project is:
1. Create a circle
2. Total dimension of circle is total time
3. When open the page start the Timer Progress Chart.
4. The time is continuing the circle will be Green particular part.
5. The duration of increment will be of 10 minutes interval.
6. So in one hour, there will be 6 increments.
7. Every Increment will be denoted by of green layer.
8. This means every 10 minutes a green layer will get incremented in the chart.
9. When Exam time is completed, the complete Circle becomes Green.
10. This system will also alert the user / Candidate 15 minutes before the Exam completion time.
11. This alert will be an inline alert and will continue end of the Exam.
12. After completion of the Exam time the system will automatically save the user data and move to the Exam completion page.
how to make this?
please help me sir.

Thank You.

推荐答案

这是我今天早上敲出的非常原始的代码,它将帮助您继续前进.现在,我一开始也不知道我在做什么,所以回答这个问题对我来说是更多的学习选择,而不是什么!对任何认为垃圾的人表示歉意!

首先使用以下控件创建一个新表单(您可以从代码中获取名称);
一个文本框(持续时间以秒为单位)
一个文本框(对于段数,请注意:这不能超过秒数)
一个按钮(用于启动计时器)
一个按钮(停止计时器)
进度条,以便您可以看到分段绘制之间发生了什么
标签,也可以保存刻度线的数量,这样您就可以看到正在发生的事情.

我从60秒和10段开始(因此每6秒绘制一个新的段),60和60也可以正常工作.


它非常粗糙,但是功能正常,但是您将需要做更多的边界检查等操作,因为我没有打扰(因此,段不大于秒数的原因!).

Here is a very crude code i have knocked up this morning, it will help you get going. Now, I hadn''t got a clue what i was doing either when i started, so answered this question as more of an learning for me more than anything! So apologies to anyone who thinks its rubbish!

first create a new form with the following controls (you can get the names from the code);
a textbox (for a duration in seconds)
a textbox (for the number of segments, note: this cannot exceed the number of seconds)
a button (to start the timer)
a button (to stop the timer)
a progress bar, just so you can see whats happening in between segment draws
a label, to hold the number of ticks also so you can see what is happening.

I started with 60 seconds and 10 segments, (so draws a new segment every 6 seconds), 60 and 60 works fine as well.


It is very crude, but functional, but you will need to do more bounds checking etc as i haven''t bothered (hence the reason for the segments not being greater than number of seconds!).

Imports System.Drawing
Imports System.Drawing.Drawing2D


Public Class Form1

    Private WithEvents theTimer As Timer = New Timer

    Private timerTickCount As Integer = 0
    Private timerTargetTicks As Integer = 0


    Private Sub ButtonStart_Click(sender As System.Object, e As System.EventArgs) Handles ButtonStart.Click
        theTimer.Interval = 1000

        timerTickCount = 0
        timerTargetTicks = CInt(TextBoxDuration.Text)

        ProgressTimer.Minimum = 0
        ProgressTimer.Value = 0
        ProgressTimer.Maximum = timerTargetTicks
        ProgressTimer.Step = 1

        DrawTimerSurface()

        theTimer.Start()

    End Sub

    Private Sub ButtonStop_Click(sender As System.Object, e As System.EventArgs) Handles ButtonStop.Click
        theTimer.Stop()

    End Sub

    Private Sub theTimer_Tick(sender As Object, e As System.EventArgs) Handles theTimer.Tick
        timerTickCount += 1

        updateProgress()

    End Sub

    Private Sub updateProgress()
        LabelTicks.Text = timerTickCount.ToString

        ProgressTimer.Increment(1)

        'Draw the timer Segments (we only need the int, not the remainder) hence \
        drawSegment(timerTickCount \ (timerTargetTicks / CInt(TextBoxSegments.Text)))


        'Check if finished
        If timerTickCount >= timerTargetTicks Then
            theTimer.Stop()
            MsgBox("Finished!")
        End If

    End Sub


    Private Sub DrawTimerSurface()

        'Clear the previous drawing if it exists
        Dim timer_brush_background As Brush = Brushes.White
        Me.CreateGraphics.FillPie(timer_brush_background, 15, 125, 250, 250, 0, 360)

        'Draw the outer circle
        Dim pen As New Drawing.Pen(System.Drawing.Color.Green, 1)
        Me.CreateGraphics.DrawEllipse(pen, 15, 125, 250, 250)

    End Sub

    Private Sub drawSegment(segmentNumber As Integer)

        'Can't draw No segments so just exit sub
        If segmentNumber = 0 Then Exit Sub

        'Set the brush color for the segment
        Dim pie_brush As Brush = Brushes.Green

        Dim segmentCount As Integer = CInt(TextBoxSegments.Text)
        Dim segmentAngle As Integer = 360 / segmentCount

        ' Note: 0 is on the horizontal so we also need to offset by -90Degrees
        Dim startAngle As Integer = ((segmentAngle * segmentNumber) - segmentAngle) - 90

        'Draw the segment
        Me.CreateGraphics.FillPie(pie_brush, 15, 125, 250, 250, startAngle, segmentAngle)

    End Sub


一些Codeproject文章给你看看.它们在C#中,但转换起来应该不难

SQL 2005循环进度栏 [圆形进度栏 [ C#到VB.net转换器 [ ^ ]
A Couple of Codeproject articles for you to have a look at. They are in C# but it shouldn''t be hard to convert

Sql 2005 Circular Progress bar[^]

Circular Progress Bar[^]

Just incase a link to a C# to VB.net Converter [^]


这篇关于在VB.net中进行Querry计时控制?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆