sqlserver2005 KPI Display control development detailed

Source: Internet
Author: User
Tags expression microsoft sql server split

Note: This article was actually written a few days ago, but that is my first piece, write quite rough, a lot of things are not written in detail, just hastily provided the source of the download, see my < Data mining control research > clicks a bit large, gave me a lot of comfort, So decide to rewrite the KPI to show the article. Friends who have not been deeply acquainted please continue to look down.

As for the KPI features in sqlserver2005, I believe friends who have contacted Sqlserver2005 's bi platform have heard of it. And like the Data Mining Viewer, Microsoft only provides the display interface in the sqlserver2005 client, and does not provide us with the programming interface. That's why we coder ourselves to do the work.

Sqlserver2005 KPI, the creation of the need to set the KPI name, value expression, target expression, status indicator, state expression, trend indicator, toward the expression and so on. Later, Google learned that the original sqlserver2005 with the KPI of the viewer, the principle of implementation is this. Microsoft did the first n pictures, the path of the picture (note: My sqlserver2005 is installed in D disk)

D:\Program Files\Microsoft SQL Server\90\tools\binn\vsshell\common7\ide\datawarehousedesigner\kpisbrowserpage\ Images

You can then decide which picture to display by returning a different value through the status expression and the move expression.

The principle is still very simple, fortunately it does not use GDI to draw these pictures out, hehe, otherwise the younger brother only to stop. Next, let's start coding.

Step1. Defines a Datagridviewstatuscell (inherited from DataGridViewImageCell) and Datagridviewstatuscolumn (inherited from Datagridviewimagecolumn), which is used to display the status indicator.

Code

using System;


Using System.Collections.Generic;


using System.Text;


using System.Windows.Forms;


using System.Drawing;


using System.ComponentModel;


using System.Reflection;


namespace Kpidisplayer


{


Internal class Datagridviewstatuscell:datagridviewimagecell


{


public Datagridviewstatuscell ()


{


}


protected Override Object GetFormattedValue (object value, int rowIndex, ref DataGridViewCellStyle CellStyle, TypeCon Verter Valuetypeconverter, TypeConverter formattedvaluetypeconverter, datagridviewdataerrorcontexts context)


{


string statusgraph = value. ToString (). Split (', ') [0];


Double status = Double.Parse (value. ToString (). Split (', ') [1]);


if (statusgraph = = statusgraph.shapes)


{


if (status = = 1)


{


return PROPERTIES.RESOURCES.STOPLIGHT_SINGLE0;


}


else if (status = 0)


{


return Properties.Resources.Stoplight_Single1;


}


else if (status = 1)


{


return Properties.Resources.Stoplight_Single2;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = statusgraph.trafficlight)


{


if (status = = 1)


{


return PROPERTIES.RESOURCES.STOPLIGHT_MULTIPLE0;


}


else if (status = 0)


{


return Properties.Resources.Stoplight_Multiple1;


}


else if (status = 1)


{


return Properties.Resources.Stoplight_Multiple2;


}


else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = statusgraph.roadsigns)


{


if (status = = 1)


{


return Properties.Resources.Road0;


}


else if (status = 0)


{


return Properties.Resources.Road1;


}


else if (status = 1)


{


return Properties.Resources.Road2;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = statusgraph.gaugeascending)


{


if (status = = 1)


{


return Properties.Resources.Gauge_Asc0;


}


else if (status = = 0.5)


{


return PROPERTIES.RESOURCES.GAUGE_ASC1;


}


else if (status = 0)


{


return PROPERTIES.RESOURCES.GAUGE_ASC2;


}


else if (status ==0.5)


{


return PROPERTIES.RESOURCES.GAUGE_ASC3;


}


else if (status = 1)


{


return PROPERTIES.RESOURCES.GAUGE_ASC4;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = statusgraph.gaugedescending)


{


if (status = = 1)


{


return Properties.Resources.Gauge_Desc0;


}


else if (status = = 0.5)


{


return PROPERTIES.RESOURCES.GAUGE_DESC1;


}


else if (status = 0)


{


return PROPERTIES.RESOURCES.GAUGE_DESC2;


}


else if (status = 0.5)


{


return PROPERTIES.RESOURCES.GAUGE_DESC3;


}


else if (status = 1)


{


return PROPERTIES.RESOURCES.GAUGE_DESC4;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = Statusgraph.thermometer)


{


if (status = = 1)


{


return Properties.Resources.Therm0;


}


else if (status = 0)


{


return Properties.Resources.Therm1;


}


else if (status = 1)


{


return Properties.Resources.Therm2;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = Statusgraph.cylinder)


{


if (status = = 1)


{


return PROPERTIES.RESOURCES.CYLINDER0;


}


else if (status = 0)


{


return Properties.Resources.Cylinder1;


}


else if (status = 1)


{


return Properties.Resources.Cylinder2;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = statusgraph.smileyface)


{


if (status = = 1)


{


return Properties.Resources.Smiley0;


}


else if (status = 0)


{


return Properties.Resources.Smiley1;


}


else if (status = 1)


{


return Properties.Resources.Smiley2;


}


Else


{


return Properties.Resources.empty;


}


}


else if (statusgraph = = Statusgraph.variancearrow)


{


if (status = = 1)


{


return Properties.Resources.Arrow_Beveled0;


}


else if (status = = 0.5)


{


return Properties.Resources.Arrow_Beveled1;


}


else if (status = 0)


{


return Properties.Resources.Arrow_Beveled2;


}


else if (status = 0.5)


{


return Properties.Resources.Arrow_Beveled3;


}


else if (status = 1)


{


return Properties.Resources.Arrow_Beveled4;


}


Else


{


return Properties.Resources.empty;


}


}


Else


{


return Properties.Resources.empty;


}


}


}


}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.