如何自动从 xtrascheduler 获取日期到其他形式

发布于 2024-09-26 06:17:34 字数 144 浏览 0 评论 0原文

我正在使用 devexpress xtrascheduler,因为我需要在单击 xtrascheduler 上的特定日期时获取下一个表单的日期,

例如,如果我单击日期为 02-06-2010 的单元格,然后当其他表单打开它时应该接受那个日期...有可能吗..

I am using devexpress xtrascheduler in that i need to get the date n the next form while clickin on a particular date on the xtrascheduler

for example if i am clicking on a cell having date 02-06-2010 then when an other form is opening it shud take that date...Is it possible..

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

百善笑为先 2024-10-03 06:17:35

是的,当然有可能。只需在打开新页面之前获取 xtrascheduler 值,然后设置
日期时间日期;

转到其他表单的代码。您也有一行像

public MyForm()
{
InitializeComponents();
}

添加此行一样,并在全局声明一个变量,并将其设置为传入日期,

DateTime incomingDate = new DateTime(); // This is in the global

public MyForm(DateTime date)
{
incomingDate = date;
InitializeComponents();
}

所以现在,当您尝试打开新表单时,将询问日期时间参数,例如,

MyForm frm = new MyForm(date);
frm.Show();

----- ----- 第二种方式

Form FirstForm = 您的主表单

Form SecondForm = 您的第二个表单,其日期将传输到此表单

在 form SecondForm:

public SecondForm(FirstForm x) // Request first form to opening
{
InitializeComponents();
}

将您的日期时间值设置为 FirstForm 中的变量。让我们说

// located global of your FirstForm
public DateTime abc = yourDateTime;


declare new FirstForm at SecondForm global like:

    public FirstForm myFirstForm; // this is in the second form global

在这部分使用这个:

public SecondForm(FirstForm x)
{
InitializeComponents();
myFirstForm = x; // So now you can reach myFirstForm.abc which is your dateTime
}

之前在第一个表单中发送此参数

SecondForm frm = new SecondForm(this);
frm.Show();

只需在打开Scheduler Control

using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.Scheduler.Win;
using DevExpress.Persistent.Base.General;
using DevExpress.XtraScheduler;

namespace HowToAccessSchedulerControl.Module.Win {
   public partial class SchedulerController : ViewController {
      public SchedulerController() {
         InitializeComponent();
         RegisterActions(components);
      }

      private void SchedulerController_Activated(object sender, EventArgs e) {
          if(View.ObjectTypeInfo.Implements<IEvent>())
            View.ControlsCreated += new EventHandler(View_ControlsCreated);
      }
      void View_ControlsCreated(object sender, EventArgs e) {
         // Access the current List View
         ListView view = (ListView)View;
         // Access the View's List Editor as a SchedulerListEditor
         SchedulerListEditor listEditor = (SchedulerListEditor)view.Editor;
         //  Access the List Editor's SchedulerControl  
         SchedulerControl scheduler = listEditor.SchedulerControl;
         // Set the desired time to be visible
         if (scheduler != null)
            scheduler.Views.DayView.VisibleTime =
               new TimeOfDayInterval(new TimeSpan(6, 0, 0), new TimeSpan(11, 0, 0));
      }
   }
}

,并参见 this信息可能对您有帮助,并且有您需要的属性

Yes of course it is possible. Just take xtrascheduler value before opening new page, and set
DateTime date;

Go to other form's code. you have a line like

public MyForm()
{
InitializeComponents();
}

add this lines too, and declare a variable at global, and set it to incoming date like,

DateTime incomingDate = new DateTime(); // This is in the global

public MyForm(DateTime date)
{
incomingDate = date;
InitializeComponents();
}

so now, when you tried to open your new form, the datetime parameter will be asked like,

MyForm frm = new MyForm(date);
frm.Show();

---------- second way

Form FirstForm = Your main form

Form SecondForm = Your second form which date will be transferred to this form

At form SecondForm:

public SecondForm(FirstForm x) // Request first form to opening
{
InitializeComponents();
}

set your datetime value to a variable in FirstForm. Lets say

// located global of your FirstForm
public DateTime abc = yourDateTime;


declare new FirstForm at SecondForm global like:

    public FirstForm myFirstForm; // this is in the second form global

at this part use this:

public SecondForm(FirstForm x)
{
InitializeComponents();
myFirstForm = x; // So now you can reach myFirstForm.abc which is your dateTime
}

just send this parameter in the first form before opening

SecondForm frm = new SecondForm(this);
frm.Show();

Scheduler Control

using System;
using System.ComponentModel;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;

using DevExpress.ExpressApp;
using DevExpress.ExpressApp.Actions;
using DevExpress.Persistent.Base;
using DevExpress.ExpressApp.Scheduler.Win;
using DevExpress.Persistent.Base.General;
using DevExpress.XtraScheduler;

namespace HowToAccessSchedulerControl.Module.Win {
   public partial class SchedulerController : ViewController {
      public SchedulerController() {
         InitializeComponent();
         RegisterActions(components);
      }

      private void SchedulerController_Activated(object sender, EventArgs e) {
          if(View.ObjectTypeInfo.Implements<IEvent>())
            View.ControlsCreated += new EventHandler(View_ControlsCreated);
      }
      void View_ControlsCreated(object sender, EventArgs e) {
         // Access the current List View
         ListView view = (ListView)View;
         // Access the View's List Editor as a SchedulerListEditor
         SchedulerListEditor listEditor = (SchedulerListEditor)view.Editor;
         //  Access the List Editor's SchedulerControl  
         SchedulerControl scheduler = listEditor.SchedulerControl;
         // Set the desired time to be visible
         if (scheduler != null)
            scheduler.Views.DayView.VisibleTime =
               new TimeOfDayInterval(new TimeSpan(6, 0, 0), new TimeSpan(11, 0, 0));
      }
   }
}

and also see this information might help you and there are properties you need

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文