Print Page | Close Window

[Solved] Event : BackgroundColor and Locked

Printed From: Codejock Forums
Category: Codejock Products
Forum Name: Calendar
Forum Description: Topics Related to Codejock Calendar
URL: http://forum.codejock.com/forum_posts.asp?TID=19651
Printed Date: 15 May 2024 at 9:08am
Software Version: Web Wiz Forums 12.04 - http://www.webwizforums.com


Topic: [Solved] Event : BackgroundColor and Locked
Posted By: Potus
Subject: [Solved] Event : BackgroundColor and Locked
Date Posted: 12 April 2012 at 10:48am
Hi all,
 
We have downloaded 15.2.1 Of Calendar Control and we have 2 questions before to buy it :
 
* Can you confirm me that we have only Event.Label 0 to 10 for background color of an Event ? We want more colors in our society (like it seem possible for Cells of CalendarControl).
 
* Is it possible to lock an event (only those we select in our developpement) ?
 
Regards,
Potus


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008



Replies:
Posted By: Oleg
Date Posted: 16 April 2012 at 9:06am
By default Event ID's 1-6 are already created yellow, blue, etc.... So if you add them be sure to start with ID 7 or greter or delete the default ones.
If m_bAddEvent Then
m_pEditingEvent.Categories.Add 7
m_pEditingEvent.Categories.Add 8
frmInbox.wndCalendarControl.DataProvider.AddEvent m_pEditingEvent
Else
frmInbox.wndCalendarControl.DataProvider.ChangeEvent m_pEditingEvent
End If
Public Sub AddCategories()
'IDs 1-6 are used for the default colors, 1 = Yellow....6 - Blue

Dim EvCat As XtremeCalendarControl.CalendarEventCategory
Set EvCat = New CalendarEventCategory
EvCat.Background = vbRed
EvCat.BorderColor = vbGreen
EvCat.Id = 1
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbBlue
EvCat.BorderColor = vbGreen
EvCat.Id = 2
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbYellow
EvCat.BorderColor = vbGreen
EvCat.Id = 3
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat

Set EvCat = New CalendarEventCategory
EvCat.Background = vbGreen
EvCat.BorderColor = vbBlue
EvCat.Id = 4
frmInbox.wndCalendarControl.DataProvider.EventCategories.Add EvCat
End Sub



Posted By: Potus
Date Posted: 23 April 2012 at 10:31am
Thanx for your response Oleg. If you look my signature, you will see I am under CSharp.
 
So, I adapted you code as below (taking from your sample code of C#.NET\CalendarControl for Normal Event) :
CalendarDataProvider pCalendarData = CalendarView1.DataProvider;
DateTime dtNow = new DateTime(DateTime.Now.Ticks);
 
// Normal Event
dtNow = DateTime.Now;
ptrEvent = pCalendarData.CreateEvent();
dtNow = dtNow.AddDays(1);
dtNow = dtNow.AddHours(1);
ptrEvent.StartTime = dtNow;
ptrEvent.EndTime = dtNow.AddHours(2);
ptrEvent.Subject = "Subject - Tomorrow Event";
ptrEvent.Location = "Location - [Color Test]";
ptrEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusTentative;
 
// -- New color
XtremeCalendarControl.CalendarEventCategory CalEvCat = new XtremeCalendarControl.CalendarEventCategory();
CalEvCat.Background.ColorLight = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(198, 198, 198));
CalEvCat.Background.ColorDark = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(255, 192, 192));
CalEvCat.Background.GradientFactor = 1;
CalEvCat.Name = "NewColor";
CalEvCat.Id = 11;
CalEvCat.BorderColor = (uint)System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.FromArgb(255, 20, 75));
pCalendarData.EventCategories.Add(CalEvCat);
// -- New color
 
ptrEvent.Label = (int)Label.NewColor;
pCalendarData.AddEvent(ptrEvent);

CalendarView1.Populate();

NB: In CSharp, I can't directly modify BackGroundColor as you do In Vb. 
 
I have assing in enum Label (frmEventProperties) this NewColor (with 11), but there is somewhere an mistake I don't see. Could you help me ?
 
I am sure I am near the solution, sorry If it's an big stupid thing I have missed (I am not expert and so alone on this project in my society).
 
And what about the second question (lock event) you can tell me if the property exists?
 
Best Regards,
Potus


-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008


Posted By: SuperMario
Date Posted: 23 April 2012 at 3:46pm
I think Oleg misunderstood, here is code you need for labels:

            CalendarEventLabels listLabels = wndCalendarControl.DataProvider.LabelList();
            // Use to remove all built in labels and add your own
            /*
            listLabels.RemoveAll();
            listLabels.AddLabel(0, 0, "None category");
            listLabels.AddLabel(1, 0xff0000, "Blue category");
            listLabels.AddLabel(2, 0x00ff00, "Green category");
            listLabels.AddLabel(3, 0x0000ff, "Red category");
            */
            // Use to add labels to existing default list (0-10)
            /*
            RGB(255,255,255) None 0 
            RGB(255,148,132)  Important 1 
            RGB(132,156,231)  Business 2 
            RGB(165,222, 99) Personal 3 
            RGB(231,231,214) Vacation 4 
            RGB(255,181,115)  Must Attend 5 
            RGB(132,239,247)  Travel Required 6 
            RGB(214,206,132)  Needs Preparation 7 
            RGB(198,165,247)  Birthday 8 
            RGB(165,206,198)  Anniversary 9 
            RGB(255,231,115)  Phone Call 10 
            */
            listLabels.AddLabel(11, 0x000001, "Black Category");
            listLabels.AddLabel(12, 0xff0000, "Blue category");
            listLabels.AddLabel(13, 0x00ff00, "Green category");
            listLabels.AddLabel(14, 0x0000ff, "Red category"); 


// Create 4 normal events

// Normal Event 1
CalendarEvent ptrEvent = pCalendarData.CreateEvent();
ptrEvent.StartTime = dtNow;
ptrEvent.EndTime = dtNow.AddHours(1);
ptrEvent.Subject = "Event &Now [Tentative Meeting]";
ptrEvent.Location = "MSB - Room 204";
//ptrEvent->SetReminderMinutesBeforeStart(10);
ptrEvent.BusyStatus = CalendarEventBusyStatus.xtpCalendarBusyStatusTentative;
ptrEvent.MeetingFlag = true;
                        ptrEvent.Label = 11;

pCalendarData.AddEvent(ptrEvent); 
wndCalendarControl.Populate();


Posted By: SuperMario
Date Posted: 23 April 2012 at 3:56pm
for locking you can modify this code to check which event, etc...now it locks all edit operations:

Private Sub CalendarControl_BeforeEditOperation(ByVal OpParams As XtremeCalendarControl.CalendarEditOperationParameters, CancelOperation As Boolean) 
CancelOperation = True 
Exit Sub 

... 

Private Sub CalendarControl_IsEditOperationDisabled(ByVal OpParams As XtremeCalendarControl.CalendarEditOperationParameters, DisableOperation As Boolean) 
DisableOperation = True 
Exit Sub 


Posted By: Potus
Date Posted: 24 April 2012 at 11:26am
Perfect Super Mario, I am continuing my investigations on this control

-------------
Product: Xtreme SuitePro (ActiveX) version 15.2.1 Eval 30 days.
Platform: Windows Seven (64 bits)
Language: C# under Visual Studio 2008



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.04 - http://www.webwizforums.com
Copyright ©2001-2021 Web Wiz Ltd. - https://www.webwiz.net