| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 1459 人关注过本帖
标题:[求助]在picturebox控件上画函数图像
只看楼主 加入收藏
点奈特
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2009-4-11
结帖率:100%
收藏
 问题点数:0 回复次数:1 
[求助]在picturebox控件上画函数图像
如题,在picturebox1控件上画函数图像(比如y=x^2+3*x),单击button1时,开始画图像.
单击button2时,picturebox1上的图像清除。
十分感谢各位给与解答。
搜索更多相关主题的帖子: 图像 控件 函数 picturebox 
2009-12-01 15:01
不说也罢
Rank: 13Rank: 13Rank: 13Rank: 13
等 级:贵宾
威 望:39
帖 子:1481
专家分:4989
注 册:2007-10-7
收藏
得分:0 
程序代码:
Public Class Form1
    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim myPen As Graphics = PictureBox1.CreateGraphics
        Dim x1 As Single, y1 As Single, x As Single, y As Single, r As Single, width As Single, height As Single
        r = 1
        For x1 = 1 To 20
            y1 = 6 * x1 - 3
            width = r * 20
            height = r * 20
            x = x1 - width / 1
            y = y1 - height / 1000
            myPen.FillEllipse(Brushes.Red, x, y, width, height)
        Next
        '上面是一个例子,自己琢磨如何绘图吧
    End Sub

    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        PictureBox1.Image = Nothing '清除已绘制或加载的图像
    End Sub
End Class

===================================================
讨厌C#的行尾的小尾巴;和一对大括号{ }
===================================================
2009-12-02 19:54
快速回复:[求助]在picturebox控件上画函数图像
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.015128 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved