0

I am working on a windows app. There is a menubar on main interface and on the main interface there is a panel. On click event of "View Calender" there is another form on the panel. On that form there is a monthcalender. I want to show current date bolded on click event of "Jump to Today" menu item. Please help me.

This code is on click event of "View Calender" button, which load the form on panel of main interface.

Calender obj = new Calender();
obj.TopLevel = false;

  if (panel2.Controls.Count > 0)
      {
          panel2.Controls.Clear();
          panel2.Controls.Add(obj);
          obj.TopLevel = false;
          obj.Show();
      }
 else
      {
           obj.TopLevel = false;
           panel2.Controls.Add(obj);
           obj.Show();
      }
4

1 回答 1

0

这应该让你开始

  Calender obj = new Calender();
  obj.TopLevel = false;

  if (panel2.Controls.Count > 0)
  {
      panel2.Controls.Clear();
      panel2.Controls.Add(obj);
      obj.TopLevel = false;
      obj.Show();
  }
  else
  {
       obj.TopLevel = false;
       panel2.Controls.Add(obj);
       obj.Show();
  }
  panel2.Controls.add(new Label{
       Text = DateTime.Now
  });

您需要向标签添加一个点击事件,并根据您的喜好设置字体。

于 2012-05-28T13:33:09.867 回答