protected void button1_Click(object sender, System.EventArgs e)
 {
    ColorDialog MyDialog = new ColorDialog();
    // Keeps the user from selecting a custom color.
    MyDialog.AllowFullOpen = false ;
    // Allows the user to get help. (The default is false.)
    MyDialog.ShowHelp = true ;
    // Sets the initial color select to the current text color,
    // so that if the user cancels out, the original color is restored.
    MyDialog.Color = textBox1.ForeColor ;
    MyDialog.ShowDialog();
    textBox1.ForeColor =  MyDialog.Color;
 }

解决方案 »

  1.   

    这个是MSDN里的,我问的是怎么样在自己设立(应该是模态对话框)的对话框中从ColorDialog中设置颜色。上面代码中的f少了一段代码:
    f.ShowDialog();能看明白吗?
      

  2.   

    up up up up up up up up up up up up up up up up up up up up up up up up up
      

  3.   

    问题解决了:    查找当前活动窗口(这里是活动的模式对话框),获取当前活动控件(这里是TextBox),将调色板的颜色值设置成当前活动控件的北背色即可。
      

  4.   

    ?<= 这个北背色怎要从ColorDialog中设置?这是你自己提的问题,班班那么答没错吧。。你的问题偶现在还没弄明白,呵呵