| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 351 人关注过本帖
标题:请高手帮下忙pen自定义变色
只看楼主 加入收藏
xp幻影
Rank: 1
等 级:新手上路
帖 子:6
专家分:0
注 册:2011-8-11
结帖率:50%
收藏
 问题点数:0 回复次数:1 
请高手帮下忙pen自定义变色
using System;
using System.Collections.Generic;
using
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace 绘图pen
{
    public partial class F : Form
    {
        public F()
        {
            InitializeComponent();
        }
        string sun = "";

        //F
        private void F_Load(object sender, EventArgs e)
        {

        }

        private Point mypen;
        bool l = false;
        private void Form1_MouseMove(object sender, MouseEventArgs e)
        {
            if (sun == "")
            {

            }
            if (l)
            {
                Graphics g = p1.CreateGraphics();
                g.DrawLine(new Pen(new SolidBrush(Color.Red)), mypen, new Point(e.X, e.Y));
                mypen = new Point(e.X, e.Y);
            }
        }

        private void Form1_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == MouseButtons.Left)
            {
                l = true;
                mypen = new Point(e.X, e.Y);
            }
        }

        private void Form1_MouseUp(object sender, MouseEventArgs e)
        {
            l = false;
        }



        //pi1
        private void pi1_Click(object sender, EventArgs e)
        {
            sun = "go1";
        }

        private void pictureBox1_Click(object sender, EventArgs e)
        {
            DialogResult result = colorDialog1.ShowDialog();
            if (result == DialogResult.OK)//确定事件响应
            {

            }

            if (result == DialogResult.Cancel)//取消事件响应
            {

            }
        }
    }
}
搜索更多相关主题的帖子: class private public 
2011-08-16 16:25
夜殤
Rank: 2
等 级:论坛游民
帖 子:20
专家分:42
注 册:2011-8-17
收藏
得分:0 
Graphics g = label1.CreateGraphics();             // 创建画板   
colorDialog1.ShowDialog();                        //打开颜色对话框
Pen p = new Pen(colorDialog1.Color,10);           //实例化画笔
g.DrawEllipse(p, 10, 15, 150, 90);                //画一个椭圆
color.zip (38.15 KB)
2011-09-21 15:09
快速回复:请高手帮下忙pen自定义变色
数据加载中...
 
   



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

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