LMS行政E化暨班級社群教職員工數位歷程檔線上手冊Login
專題製作第四次作業--
by 王文良 2014-03-21 08:27:21, Reply(0), Views(379)

專題製作課程內容:

1)ASP.NET的設計

2)如何以ASP.NET開發FET的特性曲線的專題

3)特性曲線

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
    <asp:Label  runat="server" Text="Vgs="></asp:Label>
    <asp:TextBox ID="vgs" Width="40" runat="server"></asp:TextBox>
    <asp:Label  runat="server" Text="V"></asp:Label>
    <asp:Button ID="Button1" runat="server" Text="開始畫特性曲線" OnClick="Button1_Click" />
    <asp:Image ID="image1" Width="320" Height="320"  runat="server" Visible="false" />
</asp:Content>


Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Dim ox, oy, length, scale As Integer
        Dim x, y As Single
        ox = 300 : oy = 300
        length = 280
        scale = 7
        Dim image As New Bitmap(330, 320)
        Dim g As Graphics = Graphics.FromImage(image)
        Dim pn As New Pen(Color.Black, 3)
        Dim font As New Font("Alba Super", 10, FontStyle.Regular)

        g.FillRectangle(Brushes.LightYellow, 0, 0, 330, 320)
        g.DrawLine(pn, ox + 10, oy, ox - length, oy)
        g.DrawLine(pn, ox, oy + 10, ox, oy - length)
        For i = 0 To length Step 40
            g.DrawLine(pn, ox - i, oy - 5, ox - i, oy + 5)
            g.DrawLine(pn, ox - 5, oy - i, ox + 5, oy - i)
            g.DrawString((i / 40).ToString(), font, Brushes.Blue, ox - i - 5, oy + 7)
            g.DrawString((i / 20).ToString(), font, Brushes.Blue, ox + 5, oy - i - 8)
        Next
        For x = 0 To -4 Step -0.01
            y = 8.5 * ((1 + x / 4) ^ 2)
            g.DrawLine(pn, ox + x * 40, oy - y * 20, ox - 1 + x * 40, oy - 1 - y * 20)

        Next
        image.Save("c:\button.gif", System.Drawing.Imaging.ImageFormat.Gif)


        g.Dispose()
        image.Dispose()
    End Sub

Attachments:
Reply