private static void DoChangeLabelStyle(DiagramObject portObj, LabelStyle style) { switch (style) { case LabelStyle.IsHidden: ChangeLabel(portObj, @"HDN=0", "HDN=1"); break; case LabelStyle.IsShown: ChangeLabel(portObj, @"HDN=1", "HDN=0"); break; case LabelStyle.PositionLeft: ChangeLabel(portObj, @"OX=[\+\-0-9]*", @"OX=-200"); break; case LabelStyle.PositionRight: ChangeLabel(portObj, @"OX=[\+\-0-9]*", @"OX=24"); break; case LabelStyle.PositionMinus: // get old x position Match match = Regex.Match(portObj.Style, @"OX=([\+\-0-9]*)"); if (match.Success) { int xPos = Convert.ToInt32(match.Groups[1].Value) - 15; ChangeLabel(portObj, @"OX=[\+\-0-9]*", String.Format("OX={0}", xPos)); } break; case LabelStyle.PositionPlus: // get old x position match = Regex.Match(portObj.Style, @"OX=([\+\-0-9]*)"); if (match.Success) { int xPos = Convert.ToInt32(match.Groups[1].Value) + 15; ChangeLabel(portObj, @"OX=[\+\-0-9]*", String.Format("OX={0}", xPos) ); } break; } //string style = (string)portObj.Style; //if (isHidden) style = style.Replace("HDN=0", "HDN=1"); //else style = style.Replace("HDN=1", "HDN=0"); //portObj.Style = style; }
public MvcHtmlString Label(string text, LabelStyle type = LabelStyle.Default) { var builder = new TagBuilder("span"); builder.MergeAttribute("class", "label label-" + type.ToString().ToLower()); builder.InnerHtml = text; return MvcHtmlString.Create(builder.ToString()); }
/// <summary> /// Initialize a new instance of the KryptonLabel class. /// </summary> public KryptonLabel() { // The label cannot take the focus SetStyle(ControlStyles.Selectable, false); // Set default properties _style = LabelStyle.NormalControl; _useMnemonic = true; _orientation = VisualOrientation.Top; _target = null; _enabledTarget = true; // Create content storage _labelValues = new LabelValues(NeedPaintDelegate); _labelValues.TextChanged += new EventHandler(OnLabelTextChanged); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); // Create the palette provider _stateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); _stateDisabled = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteContent(_stateCommon, NeedPaintDelegate); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_stateNormal, this, VisualOrientation.Top); _drawContent.UseMnemonic = _useMnemonic; // Create the view manager instance ViewManager = new ViewManager(this, _drawContent); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
public LabelWidget(WidgetGroup parentGroup, LabelStyle style, float x, float y, string text) : base(parentGroup, style.Width, style.Height, x, y) { Text = text; FontSize = style.FontSize; Alignment = style.Alignment; Color = new Color(1.0f, 1.0f, 1.0f, 1.0f); }
/// <summary> /// Initialise a new instance of the KryptonRibbonQATButton class. /// </summary> public KryptonRibbonQATButton() { // Default fields _image = _defaultImage; _visible = true; _enabled = true; _text = "QAT Button"; _shortcutKeys = Keys.None; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.ToolTip; }
public static Map InitializeGradientMap(Size size) { //Initialize a new map based on the simple map Map map = InitializeMap(size); //Set a gradient theme on the countries layer, based on Population density //First create two styles that specify min and max styles //In this case we will just use the default values and override the fill-colors //using a colorblender. If different line-widths, line- and fill-colors where used //in the min and max styles, these would automatically get linearly interpolated. VectorStyle min = new VectorStyle(); VectorStyle max = new VectorStyle(); //Create theme using a density from 0 (min) to 400 (max) GradientTheme popdens = new GradientTheme("PopDens", 0, 400, min, max); //We can make more advanced coloring using the ColorBlend'er. //Setting the FillColorBlend will override any fill-style in the min and max fills. //In this case we just use the predefined Rainbow colorscale popdens.FillColorBlend = ColorBlend.Rainbow5; (map.Layers[0] as VectorLayer).Theme = popdens; //Lets scale the labels so that big countries have larger texts as well LabelStyle lblMin = new LabelStyle(); LabelStyle lblMax = new LabelStyle(); lblMin.ForeColor = Color.Black; lblMin.Font = new Font(FontFamily.GenericSerif, 6); lblMax.ForeColor = Color.Blue; lblMax.BackColor = new SolidBrush(Color.FromArgb(128, 255, 255, 255)); lblMin.BackColor = lblMax.BackColor; lblMax.Font = new Font(FontFamily.GenericSerif, 9); (map.Layers[3] as LabelLayer).Theme = new GradientTheme("PopDens", 0, 400, lblMin, lblMax); //Lets scale city icons based on city population //cities below 1.000.000 gets the smallest symbol, and cities with more than 5.000.000 the largest symbol VectorStyle citymin = new VectorStyle(); VectorStyle citymax = new VectorStyle(); citymin.Symbol = new Bitmap(HttpContext.Current.Server.MapPath(@"~\App_data\icon.png")); citymin.SymbolScale = 0.5f; citymax.Symbol = new Bitmap(HttpContext.Current.Server.MapPath(@"~\App_data\icon.png")); citymax.SymbolScale = 1f; (map.Layers[2] as VectorLayer).Theme = new GradientTheme("Population", 1000000, 5000000, citymin, citymax); //Turn off the river layer map.Layers[1].Enabled = false; return map; }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupRadioButton class. /// </summary> public KryptonRibbonGroupRadioButton() { // Default fields _enabled = true; _visible = true; _checked = false; _autoCheck = true; _shortcutKeys = Keys.None; _textLine1 = "RadioButton"; _textLine2 = string.Empty; _keyTip = "R"; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupLabel class. /// </summary> public KryptonRibbonGroupLabel() { // Default fields _visible = true; _enabled = true; _imageSmall = null; _imageLarge = null; _textLine1 = "Label"; _textLine2 = string.Empty; _itemSizeCurrent = GroupItemSize.Medium; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; // Create delegate fired by a change to one of the state palettes _needPaintDelegate = new NeedPaintHandler(OnPaletteNeedPaint); // Create palette entries for customizing the label text color _stateNormal = new PaletteRibbonText(_needPaintDelegate); _stateDisabled = new PaletteRibbonText(_needPaintDelegate); }
/// <summary> /// Set the style of an diagram object. The style is code with enum LabelStyle. /// -HDN Hide Label /// - PType: Output type /// - OX=nn; Label Position, -nn=Left, +nn = Right /// </summary> /// <param name="portObj"></param> /// <param name="style"></param> public void DoChangeLabelStyle(EA.Element el, EA.DiagramObject portObj, LabelStyle style) { Match match; switch (style) { case LabelStyle.IsHidden: ChangeDiagramObjectStyle(portObj, @"HDN=0", "HDN=1"); break; case LabelStyle.IsShown: ChangeDiagramObjectStyle(portObj, @"HDN=1", "HDN=0"); break; case LabelStyle.IsPortResizable: ChangeDiagramObjectStyle(portObj, @"PortResizable=0", "PortResizable=1"); break; case LabelStyle.IsNotPortResizable: ChangeDiagramObjectStyle(portObj, @"PortResizable=1", "PortResizable=0"); break; case LabelStyle.IsTypeHidden: ChangeDiagramObjectStyle(portObj, @"PType=1", "PType=0"); break; case LabelStyle.IsTypeShown: ChangeDiagramObjectStyle(portObj, @"PType=0", "PType=1"); break; case LabelStyle.PositionLeft: ChangeDiagramObjectStyle(portObj, @"OX=[\+\-0-9]*", @"OX=-200"); break; case LabelStyle.PositionRight: ChangeDiagramObjectStyle(portObj, @"OX=[\+\-0-9]*", @"OX=24"); break; case LabelStyle.PositionDownPlus: MoveLabel(portObj, "OY", 15); break; case LabelStyle.PositionUpPlus: MoveLabel(portObj, "OY", -15); break; case LabelStyle.PositionMinus: // get old x position MoveLabel(portObj, "OX", -15); break; // add offset to position case LabelStyle.PositionPlus: MoveLabel(portObj, "OX", +15); break; // Round robin Rotation settings (no, clockwise, anti clockwise) case LabelStyle.RotateLabel: // get old rotation string newRotationValue = ""; match = Regex.Match((string)portObj.Style, @"ROT=(0|-1|1)"); if (match.Success) { string oldRotationValue = match.Value; switch (oldRotationValue) { case "ROT=0": newRotationValue = "ROT=1"; break; case "ROT=-1": newRotationValue = "ROT=0"; break; case "ROT=1": newRotationValue = "ROT=-1"; break; } if (newRotationValue != "") { ChangeDiagramObjectStyle(portObj, oldRotationValue, newRotationValue); } } break; // Align Label to default position case LabelStyle.AlignLabel1: var edge = portObj.Edge(_rep); if (el.Type.Contains("Interface")) { // Required / Provided Interface PortAlignmentItem settingsInterface = _portAlignmentItems.Find(x => x.Type == "Interface"); AlignLabel(portObj, edge, settingsInterface); } else { // Ports, Pins,.. PortAlignmentItem settingsPort = _portAlignmentItems.Find(x => x.Type == "Port"); AlignLabel(portObj, edge, settingsPort); } break; // Align Label to default position 2 case LabelStyle.AlignLabel2: edge = portObj.Edge(_rep); if (el.Type.Contains("Interface")) { // Required / Provided Interface PortAlignmentItem settingsInterface = _portAlignmentItems.Find(x => x.Type == "Interface1"); AlignLabel(portObj, edge, settingsInterface); } else { // Ports, Pins,.. PortAlignmentItem settingsPort = _portAlignmentItems.Find(x => x.Type == "Port1"); AlignLabel(portObj, edge, settingsPort); } break; } //string style = (string)portObj.Style; //if (isHidden) style = style.Replace("HDN=0", "HDN=1"); //else style = style.Replace("HDN=1", "HDN=0"); //portObj.Style = style; }
private Label CreateLabel(Geometry feature, string text, float rotation, LabelStyle style, Map map, Graphics g) { return(CreateLabel(feature, text, rotation, Priority, style, map, g)); }
private void SetupMap() { lifelines = new FeatureDataTable(); lifelines.Columns.Add("MapLifeLine", typeof(MapLifeLine)); lifelines.Columns.Add("LineCap", typeof(string)); lifelines.Columns.Add("Label", typeof(string)); lifelines.Columns.Add("ViewPort", typeof(Envelope)); GeometryFeatureProvider lifelinesGFP = new GeometryFeatureProvider(lifelines); VectorStyle linestyle = new VectorStyle { Line = new Pen(Color.Green, 2f) }; linestyle.Line.MiterLimit = 0; linesLayer = new VectorLayer("LifeLines") { DataSource = lifelinesGFP, Style = linestyle }; Dictionary <string, IStyle> styles = new Dictionary <string, IStyle>(); VectorStyle line = new VectorStyle { PointColor = new SolidBrush(Color.Green), PointSize = 2 }; styles.Add(MapLifeLine.LINE, line); VectorStyle startPoint = new VectorStyle { PointColor = new SolidBrush(Color.Green), PointSize = 2, Symbol = Image.FromFile(Path.Combine(Application.StartupPath, @"Resources\Icons\arrow-right.png")) }; styles.Add(MapLifeLine.START, startPoint); VectorStyle endPoint = new VectorStyle { PointColor = new SolidBrush(Color.Green), PointSize = 2, Symbol = Image.FromFile(Path.Combine(Application.StartupPath, @"Resources\Icons\arrow-left.png")) }; styles.Add(MapLifeLine.END, endPoint); linesLayer.Theme = new SharpMap.Rendering.Thematics.UniqueValuesTheme <string>("LineCap", styles, line); mapBox1.Map.Layers.Add(linesLayer); labelLayer = new LabelLayer("Label") { DataSource = lifelinesGFP, Enabled = true, //Specifiy field that contains the label string. LabelColumn = "Label", TextRenderingHint = TextRenderingHint.AntiAlias, SmoothingMode = SmoothingMode.AntiAlias }; LabelStyle style = new LabelStyle { ForeColor = Color.Black, Font = new Font(FontFamily.GenericSerif, 14, FontStyle.Bold), HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center, VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom, CollisionDetection = true, Offset = new PointF(0, 25), Halo = new Pen(Color.Yellow, 3) }; labelLayer.Style = style; mapBox1.Map.Layers.Add(labelLayer); points = new TearDropLayer("Points"); mapBox1.Map.Layers.Add(points); selections = new TearDropLayer("Selections"); mapBox1.Map.VariableLayers.Add(selections); mh.AddParishLayers(mapBox1.Map); mh.SetScaleBar(mapBox1); mapBox1.Map.MinimumZoom = 500; mapBox1.Map.MaximumZoom = 50000000; mapBox1.QueryGrowFactor = 30; mapBox1.Map.ZoomToExtents(); mapBox1.ActiveTool = SharpMap.Forms.MapBox.Tools.Pan; }
/// <summary> /// Update the view elements based on the requested label style. /// </summary> /// <param name="style">New label style.</param> protected virtual void SetLabelStyle(LabelStyle style) { _labelContentStyle = CommonHelper.ContentStyleFromLabelStyle(style); }
private static string[] BindChart(DataTable dt, string imgPath) { string[] arrReturn = new string[2]; Chart chart1 = new Chart(); chart1 = new Chart(); // chart1.RenderType = RenderType.BinaryStreaming; chart1.Width = Unit.Parse("1220px"); chart1.Height = Unit.Parse("550px"); chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss; chart1.Legends.Clear(); chart1.Legends.Add("Gaol"); ChartArea ca = chart1.ChartAreas.Add("Main"); LabelStyle ls = new LabelStyle(); ls.Format = "00.00%"; ca.AxisY.LabelStyle = ls; ca.AxisY.Title = "FPF Rate"; System.Drawing.Font titleFont = new System.Drawing.Font("Verdana", 16); ca.AxisY.TitleFont = titleFont; // ca.AxisY.TextOrientation = TextOrientation.Horizontal; // ca.AxisY.Crossing = 3; //chart1.ChartAreas[0].AxisX.IntervalOffset = -5; //chart1.ChartAreas[0].AxisY.RoundAxisValues(); // chart1.ChartAreas("Default").AxisX.IsMarginVisible = False ca.AxisX.IsMarginVisible = false; // ca.AxisX.IsStartedFromZero = false; //chart1.ChartAreas[0].AxisX.IntervalOffset =-1; //ca.AxisY2.TitleFont = titleFont; //ca.AxisY2.TextOrientation = TextOrientation.Horizontal; ca.AxisY2.MajorGrid.LineDashStyle = ChartDashStyle.Dash; ca.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash; ca.AxisY.Minimum = 0; ca.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; // ca.AxisX.LabelStyle.Angle = 90; // ca.AxisX.Minimum = -1; DataView dvView = dt.DefaultView; // ToTable的第一個變數即為是否Distinct DataTable dtLine = dvView.ToTable(true, "Line"); chart1.ChartAreas[0].AxisX.Interval = 1; // chart1.ChartAreas[0].AxisX.IntervalOffset =-1; DataRow[] drDataArray; string line = ""; string beginTime; string endTime; float FPF = 0; float FPF_1 = 0; string select; string timeSpn; List<string> lstTime = GetTimeRange(); // chart1.Series[0].ToolTip = "#VALY, #VALX"; int count ; string tipRate; foreach (DataRow drLine in dtLine.Select("Line<>'zzTotal'")) { line = drLine[0].ToString().Trim(); Series serFPFRate = new Series(line); // serFPFRate.IsValueShownAsLabel = true; // serFPFRate.ToolTip = "#VALY, #VALX"; serFPFRate.ToolTip = "Line: " + line; chart1.Series.Add(serFPFRate); serFPFRate.LabelFormat = "0%"; serFPFRate.ChartType = SeriesChartType.Line; serFPFRate.BorderWidth = 3; // serFPFRate.SmartLabelStyle.AllowOutsidePlotArea = LabelOutsidePlotAreaStyle.No; serFPFRate.ChartArea = "Main"; serFPFRate.YAxisType = AxisType.Primary; serFPFRate.MarkerStyle = MarkerStyle.Circle; serFPFRate.MarkerSize = 8; count = 0; foreach (string time in lstTime) { select = "Line='{0}' and BeginTime='{1}' and EndTime='{2}'"; beginTime = time.Split('-')[0].Trim(); endTime = time.Split('-')[1].Trim(); timeSpn = beginTime + "-" + endTime; select = string.Format(select, line, beginTime, endTime); drDataArray = dt.Select(select); if (drDataArray.Length == 0) { serFPFRate.Points.AddXY(timeSpn, FPF_1); tipRate="0"; } else { FPF = float.Parse(drDataArray[0]["FPF"].ToString()); tipRate = string.Format("{0:0.00%}", FPF); serFPFRate.Points.AddXY(timeSpn, FPF); // serFPFRate.Points[count].ToolTip = "FPF : " + tipRate + "\nLine: " + line; // serFPFRate.Points[count].ToolTip = "Line: " + line; } count++; } } // chart1.Series["B1D"].Points[3].ToolTip = "xxxxxxxxx"; //double d1= chart1.Series["B1D"].Points[3].XValue; //double[] d2 = chart1.Series["B1D"].Points[3].YValues; string guid = System.Guid.NewGuid().ToString(); chart1.SaveImage(imgPath + guid + ".png", ChartImageFormat.Png); string map = chart1.GetHtmlImageMap("chartMap"); arrReturn[0] = guid; arrReturn[1] = map; return arrReturn; }
public void DoChangeLabelGui(LabelStyle style) { Diagram dia = _rep.GetCurrentDiagram(); if (dia == null) return; int count = dia.SelectedObjects.Count; _rep.SaveDiagram(dia.DiagramID); // target object/element Element el; // for each selected element foreach (DiagramObject obj in dia.SelectedObjects) { el = _rep.GetElementByID(obj.ElementID); if (EmbeddedElementTypes.Contains(el.Type) ) { DiagramObject portObj = Util.GetDiagramObjectById(_rep, dia, el.ElementID); //EA.DiagramObject portObj = dia.GetDiagramObjectByID(el.ElementID, ""); DoChangeLabelStyle(portObj, style); } else { // all element like Class, Component,.. foreach (Element p in el.EmbeddedElements) { if (! (EmbeddedElementTypes.Contains(p.Type))) continue; DiagramObject portObj = Util.GetDiagramObjectById(_rep, dia, p.ElementID); if (portObj != null) { //EA.DiagramObject portObj = dia.GetDiagramObjectByID(p.ElementID, ""); // HDN=1; Label hidden // HDN=0; Label visible DoChangeLabelStyle(portObj, style); } } } } }
private void CalculateLabelStyle(LabelStyle style, LabelStyle min, LabelStyle max, double value) { style.CollisionDetection = min.CollisionDetection; style.Enabled = InterpolateBool(min.Enabled, max.Enabled, value); style.LabelColumn = InterpolateString(min.LabelColumn, max.LabelColumn, value); double fontSize = InterpolateDouble(min.Font.Size, max.Font.Size, value); style.Font = new Font { FontFamily = min.Font.FontFamily, Size = fontSize }; if (min.BackColor != null && max.BackColor != null) style.BackColor = InterpolateBrush(min.BackColor, max.BackColor, value); style.ForeColor = TextColorBlend == null ? InterpolateColor(min.ForeColor, max.ForeColor, value) : LineColorBlend.GetColor(Convert.ToSingle(Fraction(value))); if (min.Halo != null && max.Halo != null) style.Halo = InterpolatePen(min.Halo, max.Halo, value); var x = InterpolateDouble(min.Offset.X, max.Offset.X, value); var y = InterpolateDouble(min.Offset.Y, max.Offset.Y, value); style.Offset = new Offset { X = x, Y = y }; style.LabelColumn = min.LabelColumn; }
/// <summary> /// Initialize a new instance of the KryptonDataGridViewLinkCell. /// </summary> public KryptonDataGridViewLinkCell() { _labelStyle = LabelStyle.NormalControl; base.LinkBehavior = LinkBehavior.AlwaysUnderline; }
private void ResetCaptionStyle() { CaptionStyle = LabelStyle.GroupBoxCaption; }
CreateProfileLabelSetStyle(string name) { CivilDocument civDoc = CivilApplication.ActiveDocument; ObjectIdCollection ids = null; ObjectId id = ObjectId.Null; ProfileLabelSetStyle oProfileLabelSetStyle = null; try { using (Transaction tr = BaseObjs.startTransactionDb()) { ObjectIdCollection idStyles = new ObjectIdCollection(); id = civDoc.Styles.LabelSetStyles.ProfileLabelSetStyles.Add(name); oProfileLabelSetStyle = (ProfileLabelSetStyle)tr.GetObject(id, OpenMode.ForWrite); try { ObjectId idGradeBreakLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.GradeBreakLabelStyles.Add(name); idStyles.Add(idGradeBreakLabelStyle); LabelStyle oGradeBreakLabelStyle = (LabelStyle)tr.GetObject(idGradeBreakLabelStyle, OpenMode.ForWrite); ids = oGradeBreakLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oGradeBreakLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 45", ex.Message)); } try { ObjectId idCurveLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.CurveLabelStyles.Add(name); //idStyles.Add(idCurveLabelStyle); LabelStyle oCurveLabelStyle = (LabelStyle)tr.GetObject(idCurveLabelStyle, OpenMode.ForWrite); ids = oCurveLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oCurveLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 66", ex.Message)); } try { ObjectId idHorizontalGeometryPointLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.HorizontalGeometryPointLabelStyles.Add(name); idStyles.Add(idHorizontalGeometryPointLabelStyle); LabelStyle oHorizontalGeometryPointLabelStyle = (LabelStyle)tr.GetObject(idHorizontalGeometryPointLabelStyle, OpenMode.ForWrite); ids = oHorizontalGeometryPointLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oHorizontalGeometryPointLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 86", ex.Message)); } try { ObjectId idLineLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.LineLabelStyles.Add(name); idStyles.Add(idLineLabelStyle); LabelStyle oLineLabelStyle = (LabelStyle)tr.GetObject(idLineLabelStyle, OpenMode.ForWrite); ids = oLineLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oLineLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 106", ex.Message)); } try { ObjectId idMinorStationLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.MinorStationLabelStyles.Add(name); //idStyles.Add(idMinorStationLabelStyle); LabelStyle oMinorStationLabelStyle = (LabelStyle)tr.GetObject(idMinorStationLabelStyle, OpenMode.ForWrite); ids = oMinorStationLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oMinorStationLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 126", ex.Message)); } try { ObjectId idMajorStationLabelStyle = civDoc.Styles.LabelStyles.ProfileLabelStyles.MajorStationLabelStyles.Add(name); idStyles.Add(idMajorStationLabelStyle); LabelStyle oMajorStationLabelStyle = (LabelStyle)tr.GetObject(idMajorStationLabelStyle, OpenMode.ForWrite); ids = oMajorStationLabelStyle.GetComponents(LabelStyleComponentType.Line); if (ids.Count != 0) { foreach (ObjectId idLS in ids) { var lc = (LabelStyleLineComponent)tr.GetObject(idLS, OpenMode.ForWrite); lc.General.Visible.Value = false; } } else { id = oMajorStationLabelStyle.AddComponent("Line", LabelStyleComponentType.Line); var lc = (LabelStyleLineComponent)tr.GetObject(id, OpenMode.ForWrite); lc.General.Visible.Value = false; } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 146", ex.Message)); } foreach (ObjectId idStyle in idStyles) { oProfileLabelSetStyle.Add(idStyle); } tr.Commit(); } } catch (System.Exception ex) { BaseObjs.writeDebug(string.Format("{0} Prof_Style.cs: line: 156", ex.Message)); } return(oProfileLabelSetStyle.ObjectId); }
CreateProfileViewBandSetStyle(string name) { string PROFILEVIEW_BANDSET_STYLE_NAME = name; string PROFILEVIEW_PROFILE_BAND_STYLE_NAME = name; ObjectId idPVBandSetStyle = ObjectId.Null; ProfileViewBandSetStyleCollection pvBandSetStyleCol = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles; try{ idPVBandSetStyle = pvBandSetStyleCol[PROFILEVIEW_BANDSET_STYLE_NAME]; } catch {} if (!idPVBandSetStyle.IsNull) { return(idPVBandSetStyle); } idPVBandSetStyle = BaseObjs._civDoc.Styles.ProfileViewBandSetStyles.Add(PROFILEVIEW_BANDSET_STYLE_NAME); using (var tr = BaseObjs.startTransactionDb()){ ProfileViewBandSetStyle pvBandSetStyle = (ProfileViewBandSetStyle)tr.GetObject(idPVBandSetStyle, OpenMode.ForWrite); ObjectId id = ObjectId.Null; try{ id = BaseObjs._civDoc.Styles.BandStyles.ProfileViewProfileDataBandStyles[PROFILEVIEW_PROFILE_BAND_STYLE_NAME]; } catch {} if (!id.IsNull) { return(idPVBandSetStyle); } id = BaseObjs._civDoc.Styles.BandStyles.ProfileViewProfileDataBandStyles.Add(PROFILEVIEW_PROFILE_BAND_STYLE_NAME); ProfileDataBandStyle pDataBandStyle = (ProfileDataBandStyle)tr.GetObject(id, OpenMode.ForWrite); DisplayStyle displayStyle = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtVGP); displayStyle.Visible = true; displayStyle = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtHGP); displayStyle.Color = clr.red; displayStyle.Visible = true; id = pDataBandStyle.HGPLabelStyleId; LabelStyle labelStyle = (LabelStyle)tr.GetObject(id, OpenMode.ForWrite); ObjectIdCollection ids = labelStyle.GetComponents(LabelStyleComponentType.Text); id = ids[0]; LabelStyleTextComponent labelStyleText = (LabelStyleTextComponent)tr.GetObject(id, OpenMode.ForWrite); labelStyleText.Text.Contents.Value = "<[Station Value(Uft|FS|P0|RN|AP|Sn|TP|B2|EN|W0|OF)]>"; labelStyleText.Text.Color.Value = clr.c11; displayStyle = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TitleBox); displayStyle.Color = clr.red; displayStyle.Linetype = "ByBlock"; displayStyle.Visible = true; displayStyle = pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TitleBoxText); displayStyle.Color = clr.grn; displayStyle.Visible = true; id = pDataBandStyle.TitleTextLabelStyleId; labelStyle = (LabelStyle)tr.GetObject(id, OpenMode.ForWrite); ids = labelStyle.GetComponents(LabelStyleComponentType.Text); id = ids[0]; labelStyleText = (LabelStyleTextComponent)tr.GetObject(id, OpenMode.ForWrite); labelStyleText.Text.Contents.Value = "Profile Data: XX"; labelStyleText.Text.Height.Value = 0.09; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MajorStationLabel).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MajorTicks).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MinorStationLabel).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.MinorTicks).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtVGP).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.TicksAtStationEquations).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtVGP).Visible = false; pDataBandStyle.GetDisplayStylePlan(ProfileDataDisplayStyleType.LabelsAtStationEquations).Visible = false; pvBandSetStyle.GetBottomBandSetItems().Add(BaseObjs._db, Autodesk.Civil.BandType.ProfileData, PROFILEVIEW_PROFILE_BAND_STYLE_NAME); } return(idPVBandSetStyle); }
private void SetCheckBoxStyle(LabelStyle style) { _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); }
public static Map InitializeMap(float angle) { //Initialize a new map based on the simple map Map map = new Map(); //Set up countries layer VectorLayer layCountries = new VectorLayer("Countries"); //Set the datasource to a shapefile in the App_data folder layCountries.DataSource = new ShapeFile("GeoData/World/countries.shp", true); //Set fill-style to green layCountries.Style.Fill = new SolidBrush(Color.Green); //Set the polygons to have a black outline layCountries.Style.Outline = Pens.Black; layCountries.Style.EnableOutline = true; layCountries.SRID = 4326; map.Layers.Add(layCountries); //set up cities layer VectorLayer layCities = new VectorLayer("Cities"); //Set the datasource to a shapefile in the App_data folder layCities.DataSource = new ShapeFile("GeoData/World/cities.shp", true); layCities.Style.SymbolScale = 0.8f; layCities.MaxVisible = 40; layCities.SRID = 4326; map.Layers.Add(layCities); //Set up a country label layer LabelLayer layLabel = new LabelLayer("Country labels"); layLabel.DataSource = layCountries.DataSource; layLabel.Enabled = true; layLabel.LabelColumn = "Name"; layLabel.Style = new LabelStyle(); layLabel.Style.ForeColor = Color.White; layLabel.Style.Font = new Font(FontFamily.GenericSerif, 12); layLabel.Style.BackColor = new SolidBrush(Color.FromArgb(128, 255, 0, 0)); layLabel.MaxVisible = 90; layLabel.MinVisible = 30; layLabel.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center; layLabel.SRID = 4326; layLabel.MultipartGeometryBehaviour = LabelLayer.MultipartGeometryBehaviourEnum.Largest; map.Layers.Add(layLabel); //Set up a city label layer LabelLayer layCityLabel = new LabelLayer("City labels"); layCityLabel.DataSource = layCities.DataSource; layCityLabel.Enabled = true; layCityLabel.LabelColumn = "Name"; layCityLabel.Style = new LabelStyle(); layCityLabel.Style.ForeColor = Color.Black; layCityLabel.Style.Font = new Font(FontFamily.GenericSerif, 11); layCityLabel.MaxVisible = layLabel.MinVisible; layCityLabel.Style.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left; layCityLabel.Style.VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom; layCityLabel.Style.Offset = new PointF(3, 3); layCityLabel.Style.Halo = new Pen(Color.Yellow, 2); layCityLabel.TextRenderingHint = TextRendering.AntiAlias; layCityLabel.SmoothingMode = Smoothing.AntiAlias; layCityLabel.SRID = 4326; layCityLabel.LabelFilter = LabelCollisionDetection.ThoroughCollisionDetection; layCityLabel.Style.CollisionDetection = true; map.Layers.Add(layCityLabel); //Set a gradient theme on the countries layer, based on Population density //First create two styles that specify min and max styles //In this case we will just use the default values and override the fill-colors //using a colorblender. If different line-widths, line- and fill-colors where used //in the min and max styles, these would automatically get linearly interpolated. VectorStyle min = new VectorStyle(); VectorStyle max = new VectorStyle(); //Create theme using a density from 0 (min) to 400 (max) GradientTheme popdens = new GradientTheme("PopDens", 0, 400, min, max); //We can make more advanced coloring using the ColorBlend'er. //Setting the FillColorBlend will override any fill-style in the min and max fills. //In this case we just use the predefined Rainbow colorscale popdens.FillColorBlend = ColorBlend.Rainbow5; layCountries.Theme = popdens; //Lets scale the labels so that big countries have larger texts as well LabelStyle lblMin = new LabelStyle(); LabelStyle lblMax = new LabelStyle(); lblMin.ForeColor = Color.Black; lblMin.Font = new Font(FontFamily.GenericSerif, 6); lblMax.ForeColor = Color.Blue; lblMax.BackColor = new SolidBrush(Color.FromArgb(128, 255, 255, 255)); lblMin.BackColor = lblMax.BackColor; lblMax.Font = new Font(FontFamily.GenericSerif, 9); layLabel.Theme = new GradientTheme("PopDens", 0, 400, lblMin, lblMax); //Lets scale city icons based on city population //cities below 1.000.000 gets the smallest symbol, and cities with more than 5.000.000 the largest symbol VectorStyle citymin = new VectorStyle(); VectorStyle citymax = new VectorStyle(); string iconPath = "Images/icon.png"; if (!File.Exists(iconPath)) { throw new Exception( String.Format("Error file '{0}' could not be found, make sure it is at the expected location", iconPath)); } citymin.Symbol = new Bitmap(iconPath); citymin.SymbolScale = 0.5f; citymax.Symbol = new Bitmap(iconPath); citymax.SymbolScale = 1f; layCities.Theme = new GradientTheme("Population", 1000000, 5000000, citymin, citymax); //limit the zoom to 360 degrees width map.MaximumZoom = 360; map.BackColor = Color.LightBlue; map.MaximumExtents = new Envelope(-20, 70, -65, 80); map.MaximumZoom = 30; map.Zoom = 20; map.Center = new Point(0, 0); Matrix mat = new Matrix(); mat.RotateAt(angle, map.WorldToImage(map.Center)); map.MapTransform = mat; return(map); }
public static Map InitializeMap() { //Initialize a new map based on the simple map var map = new Map(); //Layer osm = new Layer("OSM"); //string url = "http://labs.metacarta.com/wms-c/tilecache.py?version=1.1.1&request=GetCapabilities&service=wms-c"; //var tileSources = TileSourceWmsC.TileSourceBuilder(new Uri(url), null); //var tileSource = new List<ITileSource>(tileSources).Find(source => source.Schema.Name == "osm-map"); //osm.DataSource = new TileProvider(tileSource, "OSM"); //map.Layers.Add(osm); //Set up countries layer var countryLayer = new Layer("Countries"); //Set the datasource to a shapefile in the App_data folder countryLayer.DataSource = new ShapeFile("GeoData/World/countries.shp", true); countryLayer.DataSource.SRID = 4326; var style = new VectorStyle { Fill = new Brush { Color = Color.Green }, Outline = new Pen { Color = Color.Black } }; countryLayer.Styles.Add(style); map.Layers.Add(countryLayer); //set up cities layer var cityLayer = new Layer("Cities"); //Set the datasource to a shapefile in the App_data folder cityLayer.DataSource = new ShapeFile("GeoData/World/cities.shp", true); cityLayer.DataSource.SRID = 4326; cityLayer.MaxVisible = 0.09; map.Layers.Add(cityLayer); //Set up a country label layer var countryLabelLayer = new LabelLayer("Country labels"); countryLabelLayer.DataSource = countryLayer.DataSource; countryLabelLayer.DataSource.SRID = 4326; countryLabelLayer.Enabled = true; countryLabelLayer.MaxVisible = 0.18; countryLabelLayer.MinVisible = 0.054; countryLabelLayer.LabelColumn = "NAME"; var labelStyle = new LabelStyle(); labelStyle.ForeColor = Color.Black; labelStyle.Font = new Font { FontFamily = "GenericSerif", Size = 12 }; labelStyle.BackColor = new Brush { Color = new Color { A = 128, R = 255, G = 255, B = 255 } }; labelStyle.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Center; countryLabelLayer.MultipartGeometryBehaviour = LabelLayer.MultipartGeometryBehaviourEnum.Largest; countryLabelLayer.Styles.Add(labelStyle); map.Layers.Add(countryLabelLayer); //Set up a city label layer var cityLabelLayer = new LabelLayer("City labels"); cityLabelLayer.DataSource = cityLayer.DataSource; cityLabelLayer.DataSource.SRID = 4326; cityLabelLayer.Enabled = true; cityLabelLayer.LabelColumn = "NAME"; cityLabelLayer.MaxVisible = countryLabelLayer.MinVisible; cityLabelLayer.MinVisible = 0; cityLabelLayer.LabelFilter = LabelCollisionDetection.ThoroughCollisionDetection; var cityLabelStyle = new LabelStyle(); cityLabelStyle.ForeColor = Color.Black; cityLabelStyle.Font = new Font { FontFamily = "GenericSerif", Size = 11 }; cityLabelStyle.HorizontalAlignment = LabelStyle.HorizontalAlignmentEnum.Left; cityLabelStyle.VerticalAlignment = LabelStyle.VerticalAlignmentEnum.Bottom; cityLabelStyle.Offset = new Offset { X = 3, Y = 3 }; cityLabelStyle.Halo = new Pen { Color = Color.Yellow, Width = 2 }; cityLabelStyle.CollisionDetection = true; cityLabelLayer.Styles.Add(cityLabelStyle); map.Layers.Add(cityLabelLayer); //Set a gradient theme on the countries layer, based on Population density //First create two styles that specify min and max styles //In this case we will just use the default values and override the fill-colors //using a colorblender. If different line-widths, line- and fill-colors where used //in the min and max styles, these would automatically get linearly interpolated. IStyle min = new Style(); IStyle max = new Style(); //Create theme using a density from 0 (min) to 400 (max) var popdens = new GradientTheme("PopDens", 0, 400, min, max); //We can make more advanced coloring using the ColorBlend'er. //Setting the FillColorBlend will override any fill-style in the min and max fills. //In this case we just use the predefined Rainbow colorscale popdens.FillColorBlend = ColorBlend.Rainbow5; countryLayer.Styles.Add(popdens); //Lets scale the labels so that big countries have larger texts as well var lblMin = new LabelStyle(); var lblMax = new LabelStyle(); lblMin.ForeColor = Color.Black; lblMin.Font = new Font { FontFamily = "Sans Serif", Size = 6 }; lblMax.ForeColor = Color.Black; lblMax.BackColor = new Brush { Color = new Color { A = 128, R = 255, G = 255, B = 255 } }; lblMin.BackColor = lblMax.BackColor; lblMax.Font = new Font { FontFamily = "Sans Serif", Size = 9 }; countryLabelLayer.Styles.Add(new GradientTheme("PopDens", 0, 400, lblMin, lblMax)); //Lets scale city icons based on city population //cities below 1.000.000 gets the smallest symbol, and cities with more than 5.000.000 the largest symbol var citymin = new SymbolStyle(); var citymax = new SymbolStyle(); const string iconPath = "Images/icon.png"; if (!File.Exists(iconPath)) { throw new Exception( String.Format("Error file '{0}' could not be found, make sure it is at the expected location", iconPath)); } citymin.Symbol = new Bitmap { Data = new FileStream(iconPath, FileMode.Open, FileAccess.Read) }; citymin.SymbolScale = 0.5f; citymax.Symbol = new Bitmap { Data = new FileStream(iconPath, FileMode.Open, FileAccess.Read) }; citymax.SymbolScale = 1f; cityLayer.Styles.Add(new GradientTheme("Population", 1000000, 5000000, citymin, citymax)); var geodanLayer = new Layer("Geodan"); geodanLayer.DataSource = new MemoryProvider(new Point(4.9130567, 52.3422033)); geodanLayer.Styles.Add(new SymbolStyle { Symbol = new Bitmap { Data = new FileStream(iconPath, FileMode.Open, FileAccess.Read) } }); map.Layers.Add(geodanLayer); //limit the zoom to 360 degrees width map.BackColor = Color.White; return(map); }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="text">The label text</param> /// <param name="location">The position of label</param> /// <param name="rotation">The rotation of the label (in degrees)</param> /// <param name="priority">A priority value. Labels with lower priority are less likely to be rendered</param> /// <param name="collisionbox">A bounding box used for collision detection</param> /// <param name="style">The label style to apply upon rendering</param> public PathLabel(string text, GraphicsPath location, float rotation, int priority, LabelBox collisionbox, LabelStyle style) : base(text, location, rotation, priority, collisionbox, style) { }
private void SetLinkLabelStyle(LabelStyle style) { PaletteContentStyle contentStyle = CommonHelper.ContentStyleFromLabelStyle(style); _stateNormalRedirect.Style = contentStyle; _stateVisitedRedirect.Style = contentStyle; _stateNotVisitedRedirect.Style = contentStyle; _statePressedRedirect.Style = contentStyle; _stateFocusRedirect.Style = contentStyle; }
/// <summary> /// Initialize a new instance of the KryptonPage class. /// </summary> /// <param name="text">Initial text.</param> /// <param name="imageSmall">Initial small image.</param> /// <param name="uniqueName">Initial unique name.</param> public KryptonPage(string text, Image imageSmall, string uniqueName) { // Default properties Text = text; MinimumSize = new Size(50, 50); _textTitle = "Page Title"; _textDescription = "Page Description"; _toolTipTitle = "Page ToolTip"; _toolTipBody = string.Empty; _toolTipImage = null; _toolTipStyle = LabelStyle.ToolTip; _toolTipImageTransparentColor = Color.Empty; _imageSmall = imageSmall; _setVisible = true; _autoHiddenSlideSize = new Size(200, 200); _uniqueName = (string.IsNullOrEmpty(uniqueName) ? CommonHelper.UniqueString : uniqueName); _flags.Flags = (int)(KryptonPageFlags.All); _flags.ClearFlags((int)KryptonPageFlags.PageInOverflowBarForOutlookMode); // Create delegates _needDisabledPaint = new NeedPaintHandler(OnNeedDisabledPaint); _needNormalPaint = new NeedPaintHandler(OnNeedNormalPaint); // Create redirector for inheriting from owning navigator _redirectNavigator = new PaletteRedirectDoubleMetric(Redirector); _redirectNavigatorPage = new PaletteRedirectDouble(Redirector); _redirectNavigatorHeaderGroup = new PaletteRedirectDoubleMetric(Redirector); _redirectNavigatorHeaderPrimary = new PaletteRedirectTripleMetric(Redirector); _redirectNavigatorHeaderSecondary = new PaletteRedirectTripleMetric(Redirector); _redirectNavigatorHeaderBar = new PaletteRedirectTripleMetric(Redirector); _redirectNavigatorHeaderOverflow = new PaletteRedirectTripleMetric(Redirector); _redirectNavigatorCheckButton = new PaletteRedirectTriple(Redirector); _redirectNavigatorOverflowButton = new PaletteRedirectTriple(Redirector); _redirectNavigatorMiniButton = new PaletteRedirectTriple(Redirector); _redirectNavigatorBar = new PaletteRedirectMetric(Redirector); _redirectNavigatorSeparator = new PaletteRedirectDoubleMetric(Redirector); _redirectNavigatorTab = new PaletteRedirectTriple(Redirector); _redirectNavigatorRibbonTab = new PaletteRedirectRibbonTabContent(Redirector); // Create the palette storage _stateCommon = new PaletteNavigatorRedirect(null, _redirectNavigator, _redirectNavigatorPage, _redirectNavigatorHeaderGroup, _redirectNavigatorHeaderPrimary, _redirectNavigatorHeaderSecondary, _redirectNavigatorHeaderBar, _redirectNavigatorHeaderOverflow, _redirectNavigatorCheckButton, _redirectNavigatorOverflowButton, _redirectNavigatorMiniButton, _redirectNavigatorBar, new PaletteRedirectBorder(Redirector), _redirectNavigatorSeparator, _redirectNavigatorTab, _redirectNavigatorRibbonTab, new PaletteRedirectRibbonGeneral(Redirector), NeedPaintDelegate); _stateDisabled = new PaletteNavigator(_stateCommon, _needDisabledPaint); _stateNormal = new PaletteNavigator(_stateCommon, _needNormalPaint); _stateTracking = new PaletteNavigatorOtherEx(_stateCommon, _needNormalPaint); _statePressed = new PaletteNavigatorOtherEx(_stateCommon, _needNormalPaint); _stateSelected = new PaletteNavigatorOther(_stateCommon, _needNormalPaint); _stateFocus = new PaletteNavigatorOtherRedirect(_redirectNavigatorCheckButton, _redirectNavigatorOverflowButton, _redirectNavigatorMiniButton, _redirectNavigatorTab, _redirectNavigatorRibbonTab, _needNormalPaint); // Our view contains just a simple canvas that covers entire client area _drawPanel = new ViewDrawPanel(_stateNormal.Page); // Create page specific button spec storage _buttonSpecs = new PageButtonSpecCollection(this); // Create the view manager instance ViewManager = new ViewManager(this, _drawPanel); }
/// <summary> /// Initialize a new instance of the KryptonContextMenuLinkLabel class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuLinkLabel(string initialText) { // Default fields _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _style = LabelStyle.NormalControl; _autoClose = true; // Create the redirectors _stateNormalRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateNotVisitedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _statePressedRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateFocusRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); // Create the states _stateNormal = new PaletteContent(_stateNormalRedirect); _stateVisited = new PaletteContent(_stateVisitedRedirect); _stateNotVisited = new PaletteContent(_stateNotVisitedRedirect); _stateFocus = new PaletteContent(_stateFocusRedirect); _statePressed = new PaletteContent(_statePressedRedirect); // Override the normal state to implement the underling logic _inheritBehavior = new LinkLabelBehaviorInherit(_stateNormal, KryptonLinkBehavior.AlwaysUnderline); // Create the override handling classes _overrideVisited = new PaletteContentInheritOverride(_stateVisited, _inheritBehavior, PaletteState.LinkVisitedOverride, false); _overrideNotVisited = new PaletteContentInheritOverride(_stateNotVisited, _overrideVisited, PaletteState.LinkNotVisitedOverride, true); _overrideFocusNotVisited = new PaletteContentInheritOverride(_stateFocus, _overrideNotVisited, PaletteState.FocusOverride, false); _overridePressed = new PaletteContentInheritOverride(_statePressed, _inheritBehavior, PaletteState.LinkPressedOverride, true); _overridePressedFocus = new PaletteContentInheritOverride(_stateFocus, _overridePressed, PaletteState.FocusOverride, false); }
/// <summary> /// Initialize a new instance of the KryptonCheckBox class. /// </summary> public KryptonCheckBox() { // Turn off standard click and double click events, we do that manually SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default properties _style = LabelStyle.NormalControl; _orientation = VisualOrientation.Top; _checkPosition = VisualOrientation.Left; _checked = false; _threeState = false; _checkState = CheckState.Unchecked; _useMnemonic = true; _autoCheck = true; // Create content storage _labelValues = new LabelValues(NeedPaintDelegate); _labelValues.TextChanged += new EventHandler(OnCheckBoxTextChanged); _images = new CheckBoxImages(NeedPaintDelegate); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, _images); // Create the palette provider _stateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); _stateDisabled = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateNormal = new PaletteContent(_stateCommon, NeedPaintDelegate); _stateFocus = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); // Override the normal values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride, false); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_overrideNormal, this, VisualOrientation.Top); _drawContent.UseMnemonic = _useMnemonic; // Only draw a focus rectangle when focus cues are needed in the top level form _drawContent.TestForFocusCues = true; // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages); _drawCheckBox.CheckState = _checkState; _layoutCenter = new ViewLayoutCenter(); _layoutCenter.Add(_drawCheckBox); // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker(); _layoutDocker.Add(_layoutCenter, ViewDockStyle.Left); _layoutDocker.Add(_drawContent, ViewDockStyle.Fill); // Need a controller for handling mouse input _controller = new CheckBoxController(_drawCheckBox, _layoutDocker, NeedPaintDelegate); _controller.Click += new EventHandler(OnControllerClick); _controller.Enabled = true; _layoutDocker.MouseController = _controller; _layoutDocker.KeyController = _controller; // Change the layout to match the inital right to left setting and orientation UpdateForOrientation(); // Create the view manager instance ViewManager = new ViewManager(this, _layoutDocker); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
private void OnShowToolTip(object sender, ToolTipEventArgs e) { if (!IsDisposed) { // Do not show tooltips when the form we are in does not have focus Form topForm = FindForm(); if ((topForm != null) && !topForm.ContainsFocus) { return; } // Never show tooltips are design time if (!DesignMode) { IContentValues sourceContent = null; LabelStyle toolTipStyle = LabelStyle.ToolTip; // Find the button spec associated with the tooltip request ButtonSpec buttonSpec = _buttonManager.ButtonSpecFromView(e.Target); // If the tooltip is for a button spec if (buttonSpec != null) { // Are we allowed to show page related tooltips if (AllowButtonSpecToolTips) { // Create a helper object to provide tooltip values ButtonSpecToContent buttonSpecMapping = new ButtonSpecToContent(Redirector, buttonSpec); // Is there actually anything to show for the tooltip if (buttonSpecMapping.HasContent) { sourceContent = buttonSpecMapping; toolTipStyle = buttonSpec.ToolTipStyle; } } } if (sourceContent != null) { // Remove any currently showing tooltip if (_visualPopupToolTip != null) { _visualPopupToolTip.Dispose(); } // Create the actual tooltip popup object _visualPopupToolTip = new VisualPopupToolTip(Redirector, sourceContent, Renderer, PaletteBackStyle.ControlToolTip, PaletteBorderStyle.ControlToolTip, CommonHelper.ContentStyleFromLabelStyle(toolTipStyle)); _visualPopupToolTip.Disposed += new EventHandler(OnVisualPopupToolTipDisposed); // Show relative to the provided screen rectangle _visualPopupToolTip.ShowCalculatingSize(RectangleToScreen(e.Target.ClientRectangle)); } } } }
/// <summary> /// Initialize a new instance of the KryptonContextMenuRadioButton class. /// </summary> /// <param name="initialText">Initial text for display.</param> public KryptonContextMenuRadioButton(string initialText) { // Default fields _enabled = true; _autoClose = false; _text = initialText; _extraText = string.Empty; _image = null; _imageTransparentColor = Color.Empty; _checked = false; _autoCheck = true; _style = LabelStyle.NormalControl; _images = new RadioButtonImages(); // Create the redirectors _stateCommonRedirect = new PaletteContentInheritRedirect(PaletteContentStyle.LabelNormalControl); _stateRadioButtonImages = new PaletteRedirectRadioButton(_images); // Create the states _stateCommon = new PaletteContent(_stateCommonRedirect); _stateDisabled = new PaletteContent(_stateCommon); _stateNormal = new PaletteContent(_stateCommon); _stateFocus = new PaletteContent(_stateCommonRedirect); // Override the normal/disabled values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(_stateFocus, _stateNormal, PaletteState.FocusOverride, false); _overrideDisabled = new PaletteContentInheritOverride(_stateFocus, _stateDisabled, PaletteState.FocusOverride, false); }
public BrowsableLabelStyleAttribute(LabelStyle LabelStyle) { eLabelStyle = LabelStyle; }
private void CreateChart() { if (!__TextBox_Inizio.Text.IsDateTime()) return; if (!__TextBox_Fine.Text.IsDateTime()) return; DateTime min = DateTime.Parse(__TextBox_Inizio.Text); DateTime max = DateTime.Parse(__TextBox_Fine.Text); var c = Business.Collection.StatisticheCollection.GetList(min, max); __Literal_Visite.Text = c.Sum(p => p.Visite).ToString(); __Literal_Vendite.Text = c.Sum(p => p.Vendite).ToString(); __Literal_Iscrizioni.Text = c.Sum(p => p.Iscrizioni).ToString(); __Literal_Contatti.Text = c.Sum(p => p.Contatti).ToString(); //Creo le serie Series visite = new Series("Visite") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series vendite = new Series("Vendite") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series iscrizioni = new Series("Iscrizioni") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series contatti = new Series("Contatti") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; //Carico i dati foreach (var stat in c) { visite.Points.AddXY(stat.Data.Date, stat.Visite); vendite.Points.AddXY(stat.Data.Date, stat.Vendite); iscrizioni.Points.AddXY(stat.Data.Date, stat.Iscrizioni); contatti.Points.AddXY(stat.Data.Date, stat.Contatti); } //Sistemo l'asse X var labelStyleX = new LabelStyle { Angle = 45, Enabled = true, IsEndLabelVisible = true, Font = new Font("Tahoma", 8), ForeColor = Color.FromArgb(78, 70, 40), Interval = 1, }; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IsMarginVisible = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IntervalType = DateTimeIntervalType.Days; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IsLabelAutoFit = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep30; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.Interval = 1; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.LineWidth = 1; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.LineColor = Color.Gainsboro; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.LabelStyle = labelStyleX; //Sistemo l'asse Y var labelStyleY = new LabelStyle { Angle = 0, Enabled = true, IsEndLabelVisible = true, Font = new Font("Tahoma", 8), ForeColor = Color.FromArgb(78, 70, 40), }; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.IsMarginVisible = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep30; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.MajorGrid.LineColor = Color.Gainsboro; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.IsLabelAutoFit = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.LabelStyle = labelStyleY; __Chart_Statistiche.AntiAliasing = AntiAliasingStyles.All; __Chart_Statistiche.BackColor = Color.White; // Add series into the chart's series collection if (__CheckBox_Contatti.Checked) __Chart_Statistiche.Series.Add(contatti); if (__CheckBox_Iscrizioni.Checked) __Chart_Statistiche.Series.Add(iscrizioni); if (__CheckBox_Vendite.Checked) __Chart_Statistiche.Series.Add(vendite); if (__CheckBox_Visite.Checked) __Chart_Statistiche.Series.Add(visite); }
private void ResetLabelStyle() { LabelStyle = LabelStyle.NormalControl; }
public TextTooltipStyle(LabelStyle label, IDrawable background) { this.labelStyle = label; this.background = background; }
/// <summary> /// Update the view elements based on the requested label style. /// </summary> /// <param name="style">New label style.</param> protected virtual void SetLabelStyle(LabelStyle style) { _paletteCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); }
private static Label CreateLabel(Geometry feature, string text, float rotation, int priority, LabelStyle style, Map map, Graphics g) { //SizeF size = g.MeasureString(text, style.Font); SizeF size = VectorRenderer.SizeOfString(g, text, style.Font); //PointF position = map.WorldToImage(feature.GetBoundingBox().GetCentroid()); PointF position = Transform.WorldtoMap(feature.GetBoundingBox().GetCentroid(), map); position.X = position.X - size.Width * (short)style.HorizontalAlignment * 0.5f; position.Y = position.Y - size.Height * (short)(2 - (int)style.VerticalAlignment) * 0.5f; if (position.X - size.Width > map.Size.Width || position.X + size.Width < 0 || position.Y - size.Height > map.Size.Height || position.Y + size.Height < 0) { return(null); } Label lbl; if (!style.CollisionDetection) { lbl = new Label(text, position, rotation, priority, null, style); } else { //Collision detection is enabled so we need to measure the size of the string lbl = new Label(text, position, rotation, priority, new LabelBox(position.X - size.Width * 0.5f - style.CollisionBuffer.Width, position.Y + size.Height * 0.5f + style.CollisionBuffer.Height, size.Width + 2f * style.CollisionBuffer.Width, size.Height + style.CollisionBuffer.Height * 2f), style); } if (feature is LineString) { LineString line = feature as LineString; if (line.Length / map.PixelSize > size.Width) //Only label feature if it is long enough { CalculateLabelOnLinestring(line, ref lbl, map); } else { return(null); } } return(lbl); }
public static void Draw(SKCanvas canvas, LabelStyle style, IFeature feature, float x, float y) { var text = style.GetLabelText(feature); DrawLabel(canvas, x, y, style, text); }
private static void DetermineTextWidthAndHeightWpf(out double width, out double height, LabelStyle style, string text) { // in WPF the width and height is not calculated at this point. So we use FormattedText var formattedText = new FormattedText( text, CultureInfo.InvariantCulture, FlowDirection.LeftToRight, new Typeface(style.Font.FontFamily), style.Font.Size, new SolidColorBrush(style.ForeColor.ToXaml())); width = formattedText.Width; height = formattedText.Height; }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupClusterButton class. /// </summary> public KryptonRibbonGroupClusterButton() { // Default fields _enabled = true; _visible = true; _checked = false; _textLine = string.Empty; _keyTip = "B"; _shortcutKeys = Keys.None; _itemSizeMax = GroupItemSize.Medium; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Medium; _imageSmall = _defaultButtonImageSmall; _buttonType = GroupButtonType.Push; _contextMenuStrip = null; _kryptonContextMenu = null; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; }
private void OnShowToolTip(object sender, ToolTipEventArgs e) { if (!_ribbon.IsDisposed) { // Do not show tooltips when the form we are in does not have focus Form topForm = _ribbon.FindForm(); if ((topForm != null) && !topForm.ContainsFocus) { return; } // Never show tooltips are design time if (!_ribbon.InDesignMode) { IContentValues sourceContent = null; LabelStyle toolTipStyle = LabelStyle.SuperTip; Rectangle screenRect = new Rectangle(e.ControlMousePosition, new Size(1, 1)); // If the target is the application button switch (e.Target) { case ViewLayoutRibbonAppButton _: case ViewLayoutRibbonAppTab _: // Create a content that recovers values from a the ribbon for the app button/tab AppButtonToolTipToContent appButtonContent = new AppButtonToolTipToContent(_ribbon); // Is there actually anything to show for the tooltip if (appButtonContent.HasContent) { sourceContent = appButtonContent; // Grab the style from the app button settings toolTipStyle = _ribbon.RibbonAppButton.AppButtonToolTipStyle; // Display below the mouse cursor screenRect.Height += (SystemInformation.CursorSize.Height / 3) * 2; } break; case ViewDrawRibbonQATButton viewElement1: // If the target is a QAT button // Cast to correct type // Create a content that recovers values from a IQuickAccessToolbarButton QATButtonToolTipToContent qatButtonContent = new QATButtonToolTipToContent(viewElement1.QATButton); // Is there actually anything to show for the tooltip if (qatButtonContent.HasContent) { sourceContent = qatButtonContent; // Grab the style from the QAT button settings toolTipStyle = viewElement1.QATButton.GetToolTipStyle(); // Display below the mouse cursor screenRect.Height += (SystemInformation.CursorSize.Height / 3) * 2; } break; default: if (e.Target.Parent is ViewDrawRibbonGroupLabel viewElement2) { // Cast to correct type // Create a content that recovers values from a KryptonRibbonGroupItem GroupItemToolTipToContent groupItemContent = new GroupItemToolTipToContent(viewElement2.GroupLabel); // Is there actually anything to show for the tooltip if (groupItemContent.HasContent) { sourceContent = groupItemContent; // Grab the style from the group label settings toolTipStyle = viewElement2.GroupLabel.ToolTipStyle; // Display below the bottom of the ribbon control Rectangle ribbonScreenRect = _ribbon.ToolTipScreenRectangle; screenRect.Y = ribbonScreenRect.Y; screenRect.Height = ribbonScreenRect.Height; screenRect.X = ribbonScreenRect.X + viewElement2.ClientLocation.X; screenRect.Width = viewElement2.ClientWidth; } } else { switch (e.Target) { case ViewDrawRibbonGroupButtonBackBorder viewElement3: { // Is the target is a button or cluster button // Cast to correct type // Create a content that recovers values from a KryptonRibbonGroupItem GroupItemToolTipToContent groupItemContent = new GroupItemToolTipToContent(viewElement3.GroupItem); // Is there actually anything to show for the tooltip if (groupItemContent.HasContent) { sourceContent = groupItemContent; // Grab the style from the group button/group cluster button settings toolTipStyle = viewElement3.GroupItem.InternalToolTipStyle; // Display below the bottom of the ribbon control Rectangle ribbonScreenRect = _ribbon.ToolTipScreenRectangle; screenRect.Y = ribbonScreenRect.Y; screenRect.Height = ribbonScreenRect.Height; screenRect.X = ribbonScreenRect.X + viewElement3.ClientLocation.X; screenRect.Width = viewElement3.ClientWidth; } break; } case ViewLayoutRibbonCheckBox _: { // Cast to correct type ViewDrawRibbonGroupCheckBox viewElement = (ViewDrawRibbonGroupCheckBox)e.Target.Parent; // Create a content that recovers values from a KryptonRibbonGroupItem GroupItemToolTipToContent groupItemContent = new GroupItemToolTipToContent(viewElement.GroupCheckBox); // Is there actually anything to show for the tooltip if (groupItemContent.HasContent) { sourceContent = groupItemContent; // Grab the style from the group check box cluster button settings toolTipStyle = viewElement.GroupCheckBox.InternalToolTipStyle; // Display below the bottom of the ribbon control Rectangle ribbonScreenRect = _ribbon.ToolTipScreenRectangle; screenRect.Y = ribbonScreenRect.Y; screenRect.Height = ribbonScreenRect.Height; screenRect.X = ribbonScreenRect.X + viewElement.ClientLocation.X; screenRect.Width = viewElement.ClientWidth; } break; } case ViewLayoutRibbonRadioButton _: { // Cast to correct type ViewDrawRibbonGroupRadioButton viewElement = (ViewDrawRibbonGroupRadioButton)e.Target.Parent; // Create a content that recovers values from a KryptonRibbonGroupItem GroupItemToolTipToContent groupItemContent = new GroupItemToolTipToContent(viewElement.GroupRadioButton); // Is there actually anything to show for the tooltip if (groupItemContent.HasContent) { sourceContent = groupItemContent; // Grab the style from the group radio button button settings toolTipStyle = viewElement.GroupRadioButton.InternalToolTipStyle; // Display below the bottom of the ribbon control Rectangle ribbonScreenRect = _ribbon.ToolTipScreenRectangle; screenRect.Y = ribbonScreenRect.Y; screenRect.Height = ribbonScreenRect.Height; screenRect.X = ribbonScreenRect.X + viewElement.ClientLocation.X; screenRect.Width = viewElement.ClientWidth; } break; } default: // Find the button spec associated with the tooltip request ButtonSpec buttonSpec = ButtonSpecManager.ButtonSpecFromView(e.Target); // If the tooltip is for a button spec if (buttonSpec != null) { // Are we allowed to show page related tooltips if (_ribbon.AllowButtonSpecToolTips) { // Create a helper object to provide tooltip values ButtonSpecToContent buttonSpecMapping = new ButtonSpecToContent(_ribbon.GetRedirector(), buttonSpec); // Is there actually anything to show for the tooltip if (buttonSpecMapping.HasContent) { sourceContent = buttonSpecMapping; // Grab the style from the button spec settings toolTipStyle = buttonSpec.ToolTipStyle; // Display below the mouse cursor screenRect.Height += (SystemInformation.CursorSize.Height / 3) * 2; } } } break; } } break; } if (sourceContent != null) { // Remove any currently showing tooltip _visualPopupToolTip?.Dispose(); // Create the actual tooltip popup object _visualPopupToolTip = new VisualPopupToolTip(_ribbon.GetRedirector(), sourceContent, _ribbon.Renderer, PaletteBackStyle.ControlToolTip, PaletteBorderStyle.ControlToolTip, CommonHelper.ContentStyleFromLabelStyle(toolTipStyle)); _visualPopupToolTip.Disposed += OnVisualPopupToolTipDisposed; // The popup tooltip control always adds on a border above/below so we negate that here. screenRect.Height -= 20; _visualPopupToolTip.ShowRelativeTo(e.Target, screenRect.Location); } } } }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupColorButton class. /// </summary> public KryptonRibbonGroupColorButton() { // Default fields _enabled = true; _visible = true; _checked = false; _visibleThemes = true; _visibleStandard = true; _visibleRecent = true; _visibleNoColor = true; _visibleMoreColors = true; _autoRecentColors = true; _shortcutKeys = Keys.None; _imageSmall = _defaultButtonImageSmall; _imageLarge = _defaultButtonImageLarge; _textLine1 = "Color"; _textLine2 = string.Empty; _keyTip = "B"; _selectedColor = Color.Red; _emptyBorderColor = Color.DarkGray; _selectedRectSmall = new Rectangle(0, 12, 16, 4); _selectedRectLarge = new Rectangle(2, 26, 28, 4); _schemeThemes = ColorScheme.OfficeThemes; _schemeStandard = ColorScheme.OfficeStandard; _buttonType = GroupButtonType.Split; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; _maxRecentColors = 10; _recentColors = new List<Color>(); // Create the context menu items _kryptonContextMenu = new KryptonContextMenu(); _separatorTheme = new KryptonContextMenuSeparator(); _headingTheme = new KryptonContextMenuHeading("Theme Colors"); _colorsTheme = new KryptonContextMenuColorColumns(ColorScheme.OfficeThemes); _separatorStandard = new KryptonContextMenuSeparator(); _headingStandard = new KryptonContextMenuHeading("Standard Colors"); _colorsStandard = new KryptonContextMenuColorColumns(ColorScheme.OfficeStandard); _separatorRecent = new KryptonContextMenuSeparator(); _headingRecent = new KryptonContextMenuHeading("Recent Colors"); _colorsRecent = new KryptonContextMenuColorColumns(ColorScheme.None); _separatorNoColor = new KryptonContextMenuSeparator(); _itemNoColor = new KryptonContextMenuItem("&No Color", Properties.Resources.ButtonNoColor, new EventHandler(OnClickNoColor)); _itemsNoColor = new KryptonContextMenuItems(); _itemsNoColor.Items.Add(_itemNoColor); _separatorMoreColors = new KryptonContextMenuSeparator(); _itemMoreColors = new KryptonContextMenuItem("&More Colors...", new EventHandler(OnClickMoreColors)); _itemsMoreColors = new KryptonContextMenuItems(); _itemsMoreColors.Items.Add(_itemMoreColors); _kryptonContextMenu.Items.AddRange(new KryptonContextMenuItemBase[] { _separatorTheme, _headingTheme, _colorsTheme, _separatorStandard, _headingStandard, _colorsStandard, _separatorRecent, _headingRecent, _colorsRecent, _separatorNoColor, _itemsNoColor, _separatorMoreColors, _itemsMoreColors}); }
/// <summary> /// Creates an instance of this class /// </summary> /// <param name="text">The label text</param> /// <param name="location">The position of label</param> /// <param name="rotation">The rotation of the label (in degrees)</param> /// <param name="priority">A priority value. Labels with lower priority are less likely to be rendered</param> /// <param name="collisionbox">A bounding box used for collision detection</param> /// <param name="style">The label style to apply upon rendering</param> public Label(string text, PointF location, float rotation, int priority, LabelBox collisionbox, LabelStyle style) : base(text, location, rotation, priority, collisionbox, style) { LabelPoint = location; }
private void BuildWaterfallChart() { var ca = new ChartArea { Name = "Total Fleet Area" }; var pos = new ElementPosition { Width = ShowLegend ? 70 : 90, Height = 90, X = 0, Y = 5 }; ca.Position = pos; ca.AxisX.MajorGrid.Enabled = false; //ca.AxisX.CustomLabels.Add(new CustomLabel()); ca.AxisX.Interval = 2; //ca.AxisX.LabelStyle.Angle = -45; ca.AxisY.MajorGrid.Enabled = true; var ls = new LabelStyle { Format = "#,#" }; ca.AxisY.LabelStyle = ls; ca.AxisY.MajorGrid.LineColor = Color.LightGray; //ca.InnerPlotPosition.Width = 55; chrtFleetStatus.ChartAreas.Add(ca); var totalFleet = 0.0; foreach (var cd in GraphInformation.SeriesData) { var cs = new Series(cd.SeriesName) { ChartType = SeriesChartType.RangeColumn , Color = cd.GraphColour , XValueType = ChartValueType.String , YValuesPerPoint = 2 }; //cs["DrawSideBySide"] = "false"; cs["DrawingStyle"] = "Emboss"; if (TodaysData) { cs.PostBackValue = "BarClick/" + cd.SeriesName; } cs.IsValueShownAsLabel = GraphInformation.ShowLabelSeriesNames.Contains(cd.SeriesName); cs.LabelFormat = "#,#"; //cs.Label = cd.SeriesName; //cs.LabelAngle = -45; cs.ToolTip = "#SERIESNAME #CUSTOMPROPERTY(SIZE)"; cs.Points.AddXY(cd.SeriesName, cd.Yvalue.Cast <object>().ToArray()); //cs.Label = string.Format("{0:#,#}", cd.Yvalue[0] - cd.Yvalue[1]); //cs.LabelAngle = -45; cs.AxisLabel = cd.SeriesName; //cs.Points.AddXY(cd.SeriesName, cd.Yvalue[0]); var size = cd.Yvalue[0] - cd.Yvalue[1]; var availTopic = TopicTranslation.GetAvailabilityTopicFromDescription(cd.SeriesName); if (availTopic == AvailabilityTopic.TotalFleet) { totalFleet = cd.Yvalue[0]; } cs.Points[0]["SIZE"] = string.Format("{0:#,#}", size); cs["PixelPointWidth"] = "400"; chrtFleetStatus.Series.Add(cs); var imageLocation = cd.Displayed ? Checkedboximagelocation : Uncheckedboximagelocation; var legendItem = new LegendItem { Name = "Legend Item" }; var legendCell = new LegendCell { CellType = LegendCellType.Image, Image = imageLocation, Name = "Cell1", Margins = { Left = 15, Right = 15 }, PostBackValue = "LegendClick/" + cd.SeriesName }; var seriesHidden = GraphInformation.HiddenSeriesNames.Contains(cd.SeriesName); var legendCell2Colour = cd.GraphColour;//seriesHidden ? MarsColours.ChartLegendValuesHidden : cd.GraphColour; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell2", Text = cd.SeriesName, ForeColor = legendCell2Colour, Alignment = ContentAlignment.MiddleLeft }; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell3", Text = string.Format("{0:#,0}", size), ForeColor = legendCell2Colour, Font = new Font("Tahoma", 9), Alignment = ContentAlignment.MiddleRight, //PostBackValue = "LegendShowLabels/" + cd.SeriesName }; legendItem.Cells.Add(legendCell); legendCell = new LegendCell { Name = "Cell4", Text = string.Format("{0:p}", (size / totalFleet)), ForeColor = legendCell2Colour, Font = new Font("Tahoma", 9), Alignment = ContentAlignment.MiddleRight, }; legendItem.Cells.Add(legendCell); chrtFleetStatus.Legends["RightLegend"].CustomItems.Add(legendItem); if (cd.Displayed == false) { cs.IsVisibleInLegend = false; cs.Enabled = false; } } var slideLegendItem = new LegendItem { Name = "SlideButton" }; var slideLegendCell = new LegendCell { Name = "Cell4", Alignment = ContentAlignment.TopRight, PostBackValue = ShowLegend ? "HideLegend" : "ShowLegend", CellType = LegendCellType.Image, Image = ShowLegend ? "~/App.Images/hideRightIcon.gif" : "~/App.Images/hideLeftIcon.gif", }; slideLegendItem.Cells.Add(slideLegendCell); chrtFleetStatus.Legends["SlideLegend"].CustomItems.Add(slideLegendItem); }
public void ChangeLabelGui(LabelStyle style) { try { Cursor.Current = Cursors.WaitCursor; DoChangeLabelGui(style); Cursor.Current = Cursors.Default; } catch (Exception e11) { MessageBox.Show(e11.ToString(), "Error label hide/show"); } finally { Cursor.Current = Cursors.Default; } }
private void BindChart(DataTable dt, IList<string> lstPdLine) { chart1.Series.Clear(); chart1.ChartAreas.Clear(); chart1.Titles.Clear(); chart1.BorderSkin.SkinStyle = BorderSkinStyle.Emboss; chart1.Legends.Clear(); chart1.Legends.Add("Gaol"); ChartArea ca = chart1.ChartAreas.Add("Main"); LabelStyle ls = new LabelStyle(); ls.Format = "0%"; ca.AxisY2.Minimum = 0; ca.AxisY2.LabelStyle = ls; ca.AxisY.Title = "Defect Qty"; System.Drawing.Font titleFont = new System.Drawing.Font("Times New Roman", 12); ca.AxisY.TitleFont = titleFont; ca.AxisY.TextOrientation = TextOrientation.Horizontal; ca.AxisY2.Title = "FPF Rate"; ca.AxisY2.TitleFont = titleFont; ca.AxisY2.TextOrientation = TextOrientation.Horizontal; ca.AxisY2.MajorGrid.LineDashStyle = ChartDashStyle.Dash; ca.AxisY.MajorGrid.LineDashStyle = ChartDashStyle.Dash; ca.AxisY.Minimum = 0; ca.AxisX.MajorGrid.LineColor = System.Drawing.Color.LightGray; float InputQty; float DefectQty; float FPF = 0; float max = 0.1F; string station; float maxDefect = 1; ca.AxisX.LineWidth = 0; DataRow[] drArr; if (lstPdLine.Count == 0) { lstPdLine.Add("ALL"); } foreach (string line in lstPdLine) { drArr = dt.Select("Line='" + line + "'"," Station"); if (drArr.Length > 0) { var serDefect = chart1.Series.Add(line); serDefect.ChartType = SeriesChartType.Column; // serDefect.ChartType = SeriesChartType.Line; serDefect.ChartArea = "Main"; // serDefect.ToolTip = "xx12345"; serDefect.LegendText = line + " Defect"; var serFPFRate = chart1.Series.Add(line + "FPFRate"); serFPFRate.ChartType = SeriesChartType.Line; serFPFRate.BorderWidth = 3; serFPFRate.LabelFormat = "0%"; serFPFRate.YAxisType = AxisType.Secondary; serFPFRate.IsValueShownAsLabel = false; serFPFRate.ChartArea = "Main"; serFPFRate.LegendText = line +" FPF Rate"; int i = 0; foreach (DataRow dr in drArr) { station = dr["Station"].ToString().Substring(0, 2); DefectQty = int.Parse(dr["DefectQty"].ToString()); InputQty = float.Parse(dr["InputQty"].ToString()); if (DefectQty > 0) { FPF = (DefectQty / InputQty); } else { FPF = 0; } serFPFRate.Points.AddXY(station, FPF); if (FPF > max) { max = FPF; } if (DefectQty > maxDefect) { maxDefect = DefectQty; } serDefect.Points.AddXY(station, DefectQty); if (DefectQty == 0) { serDefect.Points[i].IsValueShownAsLabel = false; } else { serDefect.Points[i].IsValueShownAsLabel = true; } i++; } } } ca.AxisX.Interval = 1; int t = (int)Math.Ceiling(max * 100); double d = Math.Ceiling((double)t / 5); d = d * 0.05; ca.AxisY2.Maximum = d; double d3 = Math.Ceiling(maxDefect / 5) * 5; ca.AxisY.Interval = d3 / 5; ca.AxisY.Maximum = d3; foreach (Legend L in chart1.Legends) { L.Docking = Docking.Top; } }
protected override void RenderFooter(HtmlTextWriter writer) { writer.AddStyleAttribute(HtmlTextWriterStyle.Margin, "4px"); writer.RenderBeginTag(HtmlTextWriterTag.Div); DropDownList zonesDropDownList = new DropDownList(); zonesDropDownList.ClientIDMode = ClientIDMode.AutoID; zonesDropDownList.ID = ZonesID; // Populate the DropDownList if (DesignMode) { // Add sample zone to dropdown zonesDropDownList.Items.Add(SR.GetString(SR.Zone_SampleHeaderText)); } else { if (WebPartManager != null && WebPartManager.Zones != null) { foreach (WebPartZoneBase zone in WebPartManager.Zones) { if (zone.AllowLayoutChange) { Debug.Assert(!String.IsNullOrEmpty(zone.ID)); ListItem item = new ListItem(zone.DisplayTitle, zone.ID); if (String.Equals(zone.ID, _selectedZoneID, StringComparison.OrdinalIgnoreCase)) { item.Selected = true; } zonesDropDownList.Items.Add(item); } } } } LabelStyle.AddAttributesToRender(writer, this); // Only render the "for" attribute if we are going to render the associated DropDownList (VSWhidbey 541458) if (zonesDropDownList.Items.Count > 0) { writer.AddAttribute(HtmlTextWriterAttribute.For, zonesDropDownList.ClientID); } writer.RenderBeginTag(HtmlTextWriterTag.Label); writer.Write(SelectTargetZoneText); writer.RenderEndTag(); // Render before the DropDownList (VSWhidbey 77709) writer.Write(" "); zonesDropDownList.ApplyStyle(EditUIStyle); // Do not render empty DropDownList (VSWhidbey 534498) if (zonesDropDownList.Items.Count > 0) { zonesDropDownList.RenderControl(writer); } writer.Write(" "); RenderVerbs(writer); writer.RenderEndTag(); // Div }
public Label(string text, PointF location, float rotation, int priority, LabelStyle style) : base(text, location, rotation, priority, style) { }
/// <summary> /// Initialize a new instance of the KryptonDataGridViewLinkColumn class. /// </summary> public KryptonDataGridViewLinkColumn() : base(new KryptonDataGridViewLinkCell()) { // Define defaults _labelStyle = LabelStyle.NormalControl; }
public static CALayer RenderLabel(Mapsui.Geometries.Point point, LabelStyle style, IViewport viewport) { //Offset stackOffset, //return RenderLabel(point, stackOffset, style, viewport, style.Text); return(new CALayer()); }
private void SetRadioButtonStyle(LabelStyle style) { _stateCommonRedirect.Style = CommonHelper.ContentStyleFromLabelStyle(style); }
private static void AddAnnotation(UltraChart chart, MeteoGtzYear meteoGtzYear, bool pdf) { var relativeData = meteoGtzYear.ToRelativeData(); var textStyle = new LabelStyle { Font = new Font("Verdana", pdf ? 6.5f : 8.5f, FontStyle.Italic, GraphicsUnit.Point), FontColor = Constants.YearsChartColors[1], HorizontalAlign = StringAlignment.Center, FontSizeBestFit = false, ClipText = true, Orientation = TextOrientation.Horizontal, WrapText = false, Flip = true, VerticalAlign = StringAlignment.Center, Dy = 0 }; var ann = new TextAnnatation { Width = pdf ? 80 : -1, Location = new Location { Type = LocationType.RowColumn, Row = 0, Column = 1 }, Text = GetAnnotationText(relativeData.Period2, "war um"), TextStyle = textStyle }; chart.Annotations.Add(ann); ann = new TextAnnatation { Width = pdf ? 80 : -1, Location = new Location { Type = LocationType.RowColumn, Row = 0, Column = 2, ValueY = meteoGtzYear.Period2 }, Text = GetAnnotationText(relativeData.Period3, "war um"), TextStyle = textStyle }; chart.Annotations.Add(ann); }
public TextTooltipStyle( LabelStyle label, IDrawable background ) { this.label = label; this.background = background; }
/// <summary> /// Initialize a new instance of the KryptonCheckBox class. /// </summary> public KryptonCheckBox() { // Turn off standard click and double click events, we do that manually SetStyle(ControlStyles.StandardClick | ControlStyles.StandardDoubleClick, false); // Set default properties _style = LabelStyle.NormalControl; _orientation = VisualOrientation.Top; _checkPosition = VisualOrientation.Left; _checked = false; _threeState = false; _checkState = CheckState.Unchecked; _useMnemonic = true; AutoCheck = true; // Create content storage Values = new LabelValues(NeedPaintDelegate); Values.TextChanged += OnCheckBoxTextChanged; Images = new CheckBoxImages(NeedPaintDelegate); // Create palette redirector _paletteCommonRedirect = new PaletteContentInheritRedirect(Redirector, PaletteContentStyle.LabelNormalControl); _paletteCheckBoxImages = new PaletteRedirectCheckBox(Redirector, Images); // Create the palette provider StateCommon = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); StateDisabled = new PaletteContent(StateCommon, NeedPaintDelegate); StateNormal = new PaletteContent(StateCommon, NeedPaintDelegate); OverrideFocus = new PaletteContent(_paletteCommonRedirect, NeedPaintDelegate); // Override the normal values with the focus, when the control has focus _overrideNormal = new PaletteContentInheritOverride(OverrideFocus, StateNormal, PaletteState.FocusOverride, false); // Our view contains background and border with content inside _drawContent = new ViewDrawContent(_overrideNormal, this, VisualOrientation.Top) { UseMnemonic = _useMnemonic, // Only draw a focus rectangle when focus cues are needed in the top level form TestForFocusCues = true }; // Create the check box image drawer and place inside element so it is always centered _drawCheckBox = new ViewDrawCheckBox(_paletteCheckBoxImages) { CheckState = _checkState }; _layoutCenter = new ViewLayoutCenter { _drawCheckBox }; // Place check box on the left and the label in the remainder _layoutDocker = new ViewLayoutDocker { { _layoutCenter, ViewDockStyle.Left }, { _drawContent, ViewDockStyle.Fill } }; // Need a controller for handling mouse input _controller = new CheckBoxController(_drawCheckBox, _layoutDocker, NeedPaintDelegate); _controller.Click += OnControllerClick; _controller.Enabled = true; _layoutDocker.MouseController = _controller; _layoutDocker.KeyController = _controller; // Change the layout to match the inital right to left setting and orientation UpdateForOrientation(); // Create the view manager instance ViewManager = new ViewManager(this, _layoutDocker); // We want to be auto sized by default, but not the property default! AutoSize = true; AutoSizeMode = AutoSizeMode.GrowAndShrink; }
/// <summary> /// Initialise a new instance of the KryptonRibbonGroupGallery class. /// </summary> public KryptonRibbonGroupGallery() { // Default fields _visible = true; _enabled = true; _keyTip = "X"; _itemSizeMax = GroupItemSize.Large; _itemSizeMin = GroupItemSize.Small; _itemSizeCurrent = GroupItemSize.Large; _largeItemCount = 9; _mediumItemCount = 3; _dropButtonItemWidth = 9; _imageLarge = _defaultButtonImageLarge; _textLine1 = "Gallery"; _textLine2 = string.Empty; _toolTipImageTransparentColor = Color.Empty; _toolTipTitle = string.Empty; _toolTipBody = string.Empty; _toolTipStyle = LabelStyle.SuperTip; // Create the actual text box control and set initial settings _gallery = new KryptonGallery(); _gallery.AlwaysActive = false; _gallery.TabStop = false; _gallery.InternalPreferredItemSize = new Size(_largeItemCount, 1); // Hook into events to expose via this container _gallery.SelectedIndexChanged += new EventHandler(OnGallerySelectedIndexChanged); _gallery.ImageListChanged += new EventHandler(OnGalleryImageListChanged); _gallery.TrackingImage += new EventHandler<ImageSelectEventArgs>(OnGalleryTrackingImage); _gallery.GalleryDropMenu += new EventHandler<GalleryDropMenuEventArgs>(OnGalleryGalleryDropMenu); _gallery.GotFocus += new EventHandler(OnGalleryGotFocus); _gallery.LostFocus += new EventHandler(OnGalleryLostFocus); // Ensure we can track mouse events on the gallery MonitorControl(_gallery); }
private void CreateChart() { if (!__TextBox_Inizio.Text.IsDateTime()) return; if (!__TextBox_Fine.Text.IsDateTime()) return; DateTime min = DateTime.Parse(__TextBox_Inizio.Text); DateTime max = DateTime.Parse(__TextBox_Fine.Text); var c = StatisticheCollection.GetList("Giorno >= @0 AND Giorno <= @1", min, max); __Literal_EmailBloccate.Text = c.Sum(p => p.EmailBloccate).ToString(); __Literal_Messaggi.Text = c.Sum(p => p.Messaggi).ToString(); __Literal_Registrazioni.Text = c.Sum(p => p.Registrazioni).ToString(); __Literal_Inserimenti.Text = c.Sum(p => p.Inserimenti).ToString(); __Literal_Visite.Text = c.Sum(p => p.Visite).ToString(); __Literal_AvvisiAnnunciScaduti.Text = c.Sum(p => p.AvvisiScaduto).ToString(); __Literal_AvvisiScadenza.Text = c.Sum(p => p.AvvisiScadenza).ToString(); __Literal_StatisticheMensili.Text = c.Sum(p => p.StatisticheMensili).ToString(); //Creo le serie Series inserimenti = new Series("Inserimenti") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series messaggi = new Series("Messaggi") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series visite = new Series("Visite") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true }; Series registrazioni = new Series("Registrazioni") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true, }; Series emailbloccate = new Series("Email bloccate") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true, }; Series statisticheMensili = new Series("Statistiche mensili") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true, }; Series avvisiScadenza = new Series("Avvisi scadenza") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true, }; Series avvisiAnnunciScaduti = new Series("Avvisi annunci scaduti") { ChartType = SeriesChartType.Line, BorderWidth = 3, ShadowOffset = 2, IsValueShownAsLabel = true, }; //Carico i dati foreach (var stat in c) { inserimenti.Points.AddXY(stat.Giorno, stat.Inserimenti); messaggi.Points.AddXY(stat.Giorno.Date, stat.Messaggi); visite.Points.AddXY(stat.Giorno.Date, stat.Visite); registrazioni.Points.AddXY(stat.Giorno.Date, stat.Registrazioni); emailbloccate.Points.AddXY(stat.Giorno.Date, stat.EmailBloccate); statisticheMensili.Points.AddXY(stat.Giorno.Date, stat.EmailBloccate); avvisiScadenza.Points.AddXY(stat.Giorno.Date, stat.EmailBloccate); avvisiAnnunciScaduti.Points.AddXY(stat.Giorno.Date, stat.EmailBloccate); } //Sistemo l'asse X var labelStyleX = new LabelStyle { Angle = 45, Enabled = true, IsEndLabelVisible = true, Font = new Font("Tahoma", 8), ForeColor = Color.FromArgb(78, 70, 40), Interval = 1, }; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IsMarginVisible = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IntervalType = DateTimeIntervalType.Days; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.IsLabelAutoFit = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep30; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.Interval = 1; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.LineWidth = 1; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.MajorGrid.LineColor = Color.Gainsboro; __Chart_Statistiche.ChartAreas["ChartArea"].AxisX.LabelStyle = labelStyleX; //Sistemo l'asse Y var labelStyleY = new LabelStyle { Angle = 0, Enabled = true, IsEndLabelVisible = true, Font = new Font("Tahoma", 8), ForeColor = Color.FromArgb(78, 70, 40), }; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.IsMarginVisible = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.LabelAutoFitStyle = LabelAutoFitStyles.LabelsAngleStep30; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.MajorGrid.LineColor = Color.Gainsboro; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.IsLabelAutoFit = true; __Chart_Statistiche.ChartAreas["ChartArea"].AxisY.LabelStyle = labelStyleY; __Chart_Statistiche.AntiAliasing = AntiAliasingStyles.All; __Chart_Statistiche.BackColor = Color.White; // Add series into the chart's series collection if (__CheckBox_EmailBloccate.Checked) __Chart_Statistiche.Series.Add(emailbloccate); if (__CheckBox_Inserimenti.Checked) __Chart_Statistiche.Series.Add(inserimenti); if (__CheckBox_Messaggi.Checked) __Chart_Statistiche.Series.Add(messaggi); if (__CheckBox_Registrazioni.Checked) __Chart_Statistiche.Series.Add(registrazioni); if (__CheckBox_Visite.Checked) __Chart_Statistiche.Series.Add(visite); if (__CheckBox_StatisticheMensili.Checked) __Chart_Statistiche.Series.Add(statisticheMensili); if (__CheckBox_AvvisiScadenza.Checked) __Chart_Statistiche.Series.Add(avvisiScadenza); if (__CheckBox_AvvisiScaduti.Checked) __Chart_Statistiche.Series.Add(avvisiAnnunciScaduti); }
/// <summary> /// Find the appropriate content style to match the incoming label style. /// </summary> /// <param name="style">LabelStyle enumeration.</param> /// <returns>Matching PaletteContentStyle enumeration value.</returns> public static PaletteContentStyle ContentStyleFromLabelStyle(LabelStyle style) { switch (style) { case LabelStyle.NormalControl: return PaletteContentStyle.LabelNormalControl; case LabelStyle.BoldControl: return PaletteContentStyle.LabelBoldControl; case LabelStyle.ItalicControl: return PaletteContentStyle.LabelItalicControl; case LabelStyle.TitleControl: return PaletteContentStyle.LabelTitleControl; case LabelStyle.NormalPanel: return PaletteContentStyle.LabelNormalPanel; case LabelStyle.BoldPanel: return PaletteContentStyle.LabelBoldPanel; case LabelStyle.ItalicPanel: return PaletteContentStyle.LabelItalicPanel; case LabelStyle.TitlePanel: return PaletteContentStyle.LabelTitlePanel; case LabelStyle.GroupBoxCaption: return PaletteContentStyle.LabelGroupBoxCaption; case LabelStyle.ToolTip: return PaletteContentStyle.LabelToolTip; case LabelStyle.SuperTip: return PaletteContentStyle.LabelSuperTip; case LabelStyle.KeyTip: return PaletteContentStyle.LabelKeyTip; case LabelStyle.Custom1: return PaletteContentStyle.LabelCustom1; case LabelStyle.Custom2: return PaletteContentStyle.LabelCustom2; case LabelStyle.Custom3: return PaletteContentStyle.LabelCustom3; default: // Should never happen! Debug.Assert(false); return PaletteContentStyle.LabelNormalPanel; } }
private static Label CreateLabel(IGeometry feature, string text, float rotation, int priority, LabelStyle style, IViewport viewport, Graphics g) { var gdiSize = g.MeasureString(text, style.Font.ToGdi()); var size = new Styles.Size { Width = gdiSize.Width, Height = gdiSize.Height }; var position = viewport.WorldToScreen(feature.GetBoundingBox().GetCentroid()); position.X = position.X - size.Width * (short)style.HorizontalAlignment * 0.5f; position.Y = position.Y - size.Height * (short)style.VerticalAlignment * 0.5f; if (position.X - size.Width > viewport.Width || position.X + size.Width < 0 || position.Y - size.Height > viewport.Height || position.Y + size.Height < 0) { return(null); } Label label; if (!style.CollisionDetection) { label = new Label(text, position, rotation, priority, null, style); } else { //Collision detection is enabled so we need to measure the size of the string label = new Label(text, position, rotation, priority, new LabelBox(position.X - size.Width * 0.5f - style.CollisionBuffer.Width, position.Y + size.Height * 0.5f + style.CollisionBuffer.Height, size.Width + 2f * style.CollisionBuffer.Width, size.Height + style.CollisionBuffer.Height * 2f), style); } if (!(feature is LineString)) { return(label); } var line = feature as LineString; if (line.Length / viewport.Resolution > size.Width) //Only label feature if it is long enough { CalculateLabelOnLinestring(line, ref label, viewport); } else { return(null); } return(label); }
/// <summary> /// Creates the chart. /// </summary> /// <param name="currency">The currency.</param> /// <param name="labels">The labels.</param> /// <param name="values">The values.</param> private void CreateChart(Currency currency, string[] labels, decimal[] values) { // Label style (x and y label) LabelStyle labelStyleX = new LabelStyle(); labelStyleX.Font = new Font("Arial", 10); labelStyleX.ForeColor = Color.Black; labelStyleX.Name = "xStyle"; c_chartVisits.LabelStyles.Add(labelStyleX); // Data point style DataPointLabelStyle dataPointStyle = c_chartVisits.DataPointLabelStyles.CreateNew("CustomStyle"); if (dataPointStyle != null) { dataPointStyle.ForeColor = System.Drawing.Color.Black; dataPointStyle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.GraphicsUnit.Point); dataPointStyle.LabelPosition = LabelPositionKind.AboveVertical; } // Chart settings c_chartVisits.View.Kind = ProjectionKind.TwoDimensional; c_chartVisits.View.LightsOffOn2D = false; c_chartVisits.ResizeMarginsToFitLabels = true; //c_chartVisits.MainStyle = "Line"; if (ViewState["ChartWidth"] != null) { c_chartVisits.Width = new Unit((double)ViewState["ChartWidth"]); } else { ViewState["ChartWidth"] = c_chartVisits.Width.Value; } // If more than 24 columns, if (labels.Length > 24) { c_chartVisits.Width = labels.Length * 23; //title.Font = new System.Drawing.Font("Arial", 10, System.Drawing.GraphicsUnit.Point); dataPointStyle.Font = new System.Drawing.Font("Arial", 10, System.Drawing.GraphicsUnit.Point); } // Line style LineStyle2D lineStyle2D = new LineStyle2D(); lineStyle2D.Color = ColorTranslator.FromHtml("#0266fb"); lineStyle2D.Width = 2; lineStyle2D.ShadeWidth = 2; c_chartVisits.LineStyles2D.Add(lineStyle2D); // Series style SeriesStyle seriesStyle = new SeriesStyle(); seriesStyle.ChartKind = ChartKind.Rectangle; seriesStyle.LineStyle2DName = lineStyle2D.Name; c_chartVisits.SeriesStyles.Add(seriesStyle); // Series Series s1 = new Series("S1"); s1.StyleName = seriesStyle.Name; s1.Parameters["pointAreaAttributes"] = "alt=\"#[Param(y)]\""; s1.DataPointParameters["color"] = System.Drawing.Color.Black; c_chartVisits.RenderAreaMap = true; c_chartVisits.Series.Add(s1); c_chartVisits.DefineValue("S1:y", values); c_chartVisits.DefineValue("x", labels); c_chartVisits.DataBind(); SeriesLabels sLabels = s1.CreateAnnotation("y", "CustomStyle"); for (int i = 0; i < sLabels.Count; i++) { DataPointLabel label = sLabels[i]; decimal value = Convert.ToDecimal(label.Text); label.Text = value.ToString(currency.GetNumberFormatInfo(CultureInfo.CurrentUICulture)); } // Y axis AxisAnnotation yAnnotation = c_chartVisits.CoordinateSystem.YAxis.AxisAnnotations["Y@Xmin"]; //yAnnotation.AxisTitle = CurrentModule.Strings.GetValue("Visits", FoundationContext.LanguageID, true); yAnnotation.AxisTitleStyleName = "xStyle"; yAnnotation.LabelStyleName = "xStyle"; yAnnotation.AxisTitleOffsetPts = 35; foreach (AxisLabel label in yAnnotation.Labels) { decimal value; if (decimal.TryParse(label.Text, out value)) { label.Text = value.ToString(currency.GetNumberFormatInfo(CultureInfo.CurrentUICulture)); } } // X axis AxisAnnotation xAnnotation = c_chartVisits.CoordinateSystem.XAxis.AxisAnnotations["X@Ymin"]; xAnnotation.AxisTitleStyleName = "xStyle"; xAnnotation.LabelStyleName = "xStyle"; xAnnotation.HOffset = 3; xAnnotation.VOffset = 0; xAnnotation.RotationAngle = 45; // Background StripSet yStripSet1 = c_chartVisits.CoordinateSystem.PlaneXY.StripSets["YinPlaneXY"]; yStripSet1.Color = Color.White; yStripSet1.AlternateColor = Color.FromArgb(242, 242, 242); c_chartVisits.Frame.FrameKind = ChartFrameKind.Thin2DFrame; c_chartVisits.Frame.FrameColor = Color.Gray; c_chartVisits.BackGradientKind = GradientKind.Center; }
protected virtual void SetLabelStyle(int score, UILabel label) { LabelStyle style = score >= 0 ? PostiveLabelStyle : NegativeLabelStyle; SetLabelStyle(label, style); }