Private Sub grdMain_CellEndEdit(ByVal sender As Object, ByVal e As Telerik.WinControls.UI.GridViewCellEventArgs) Handles grdMain.CellEndEdit |
If e.Row.Cells(2).Value.ToString <> "" Then |
If e.Row.Cells(2).Value.ToString.ToUpper <> "TRUE" And e.Row.Cells(2).Value.ToString.ToUpper <> "FALSE" Then |
e.Row.Cells(2).Selected = True |
e.Row.Cells(2).CellElement.IsCurrent = True |
e.Row.Cells(2).BeginEdit() |
End If |
End If |
End Sub |
using System; |
using System.Collections.Generic; |
using System.ComponentModel; |
using System.Data; |
using System.Drawing; |
using System.Linq; |
using System.Text; |
using System.Windows.Forms; |
using Telerik.Charting; |
using Telerik.WinControls.UI; |
using Telerik.WinControls; |
using Telerik.WinControls.Primitives; |
using FrmErdStatusChart.CallSignWebService; |
using System.Collections; |
namespace FrmErdStatusChart |
{ |
public partial class Form1 : RadForm |
{ |
public Form1() |
{ |
InitializeComponent(); |
radChart1.ChartTitle.TextBlock.Text = "Status Chart"; |
radChart1.Appearance.Border.Visible = false; |
radChart1.Appearance.FillStyle.MainColor = Color.Lavender; |
radChart1.PlotArea.Appearance.FillStyle.MainColor = System.Drawing.Color.Black; |
this.radChart1.Series[0].Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.Nothing; |
this.radChart1.Series[1].Appearance.LegendDisplayMode = Telerik.Charting.ChartSeriesLegendDisplayMode.Nothing; |
} |
CallSignWebService.CallSignWebService callsignWS = new CallSignWebService.CallSignWebService(); |
ArrayList statusArray = new ArrayList(); |
ChartSeries cs = new ChartSeries(); |
ChartSeries cs1 = new ChartSeries(); |
int online ; |
int offline ; |
string[] status = {"online" , "offline" }; |
//Add the status ==> online |
public void AddAvailable() |
{ |
cs.Clear(); |
cs.Items.Add(new ChartSeriesItem(online)); |
radChart1.Series.Add(cs); |
cs.Name = "Online " + online; |
radChart1.DataBind(); |
} |
//Add status ==> offline |
public void AddOffline() |
{ |
cs1.Clear(); |
cs1.Items.Add(new ChartSeriesItem(offline)); |
radChart1.Series.Add(cs1); |
cs1.Name = "offline "+offline; |
radChart1.DataBind(); |
} |
//Get the status from the callsign |
public void addStatus() |
{ |
callSign[] callSignList = callsignWS.findAll(); |
foreach (callSign callSign in callSignList) |
{ |
statusArray.Add(callSign.status); |
///// Console.WriteLine(callSign.unit); |
} |
} |
//filter out the status according to online,offline |
public void addChart() |
{ |
online = 0; |
offline = 0; |
/* for (int i = 0; i < statusArray.Count; i++) |
{ |
//counts status ==> online |
foreach (string online in statusArray) |
{ |
o++; |
} |
//counts status ==> offline |
foreach (string offline in statusArray) |
{ |
f++; |
} |
break; |
}*/ |
for (int i = 0; i < statusArray.Count;i++ ) |
{ |
if (statusArray[i].ToString() == "Online") |
{ |
online++; |
} |
else offline++; |
} |
Console.WriteLine("Online ==> "+online); |
Console.WriteLine("Offline ==> "+offline); |
} |
private void radComboBox1_SelectedValueChanged(object sender, EventArgs e) |
{ |
} |
private void radComboBox1_SelectedIndexChanged(object sender, EventArgs e) |
{ |
// Check whether an item in combo box is selected |
if (radComboBox1.SelectedItem != null) |
{ |
//value is equal to pie |
if (radComboBox1.SelectedIndex == 0) |
{ |
/* radChart1.Series.Clear(); |
ChartSeries cs2 = new ChartSeries(); |
cs2.Type = ChartSeriesType.Pie; |
radChart1.Series.Add(cs2); |
radChart1.DataSource = new int[] {o,f }; |
radChart1.DataBind();*/ |
AddOffline(); |
AddAvailable(); |
cs.Type = ChartSeriesType.Pie; |
cs1.Type = ChartSeriesType.Pie; |
} |
//value is equal to bar |
else if (radComboBox1.SelectedIndex == 1) |
{ |
AddOffline(); |
AddAvailable(); |
cs.Type = ChartSeriesType.Bar; |
cs1.Type = ChartSeriesType.Bar; |
} |
//Value is equal to point |
else if (radComboBox1.SelectedIndex == 2) |
{ |
AddOffline(); |
AddAvailable(); |
cs.Type = ChartSeriesType.Point; |
cs1.Type = ChartSeriesType.Point; |
} |
} |
} |
private void Form1_Load(object sender, EventArgs e) |
{ |
addStatus(); |
addChart(); |
} |
} |
} |
We've had a request to add a close button to each tab in our MDI docking manager rather than use the TdiCloseButton on the far right of the tabstrip. This is similar to Internet Explorer and Firefox's tabbed interface. This is on Q2 2008 SP1.
I've been able to get 99% of the way there but have one nagging little issue I hope you can help with. Whenever I am creating a new MDI child, I am creating a new RadButtonElement via:
private
static Telerik.WinControls.UI.RadButtonElement NewButton()
{
Telerik.WinControls.UI.
RadButtonElement ret = new Telerik.WinControls.UI.RadButtonElement();
(ret.Children[
0] as Telerik.WinControls.Primitives.FillPrimitive).BackColor = System.Drawing.Color.Transparent;
(ret.Children[
0] as Telerik.WinControls.Primitives.FillPrimitive).BackColor2 = System.Drawing.Color.Transparent;
(ret.Children[
0] as Telerik.WinControls.Primitives.FillPrimitive).BackColor3 = System.Drawing.Color.Transparent;
(ret.Children[
2] as Telerik.WinControls.Primitives.BorderPrimitive).Visibility = Telerik.WinControls.ElementVisibility.Collapsed;
ret.MaxSize =
new System.Drawing.Size(16,16);
ret.Text =
"X";
ret.ForeColor = System.Drawing.
Color.Red;
ret.DisplayStyle = Telerik.WinControls.
DisplayStyle.Text;
ret.Alignment = System.Drawing.
ContentAlignment.MiddleRight;
return ret;
}
Then, I add a click handler and increase the ImageTextLayoutPanel's margin to make room for my button and finally add the buttonElement to the children:
Telerik.WinControls.UI.
TabItem tab = pane.DockableTab as Telerik.WinControls.UI.TabItem;
Telerik.WinControls.Layouts.
ImageAndTextLayoutPanel layout = tab.Children[2] as Telerik.WinControls.Layouts.ImageAndTextLayoutPanel;
layout.Margin =
new Padding(0, 0, 20, 0);
Telerik.WinControls.UI.
RadButtonElement button = NewButton();
button.Tag = pane;
button.Click +=
new EventHandler(tab_Close);
button.MouseEnter +=
new EventHandler(closeButton_MouseEnter);
button.MouseLeave +=
new EventHandler(closeButton_MouseLeave);
tab.Children.Add(button);
What I am seeing whenever I add the button element to the tab is the border on the left of the tab is not painted. I've played around with a lot of margin/padding and layout settings but can't seem to get the border to show up correctly. Any suggestions?
Thanks in advance!