public void LoadData(ClippingRegion clipping) { isNew = false; current = clipping; txtCaption.Text = current.Caption; chEnableLabels.Checked = !current.NoAutocomplete; chIndexCodes.Checked = current.IndexCodes; txtMinZoom.Text = current.LabelsMinZoom.ToString(); txtMaxZoom.Text = current.LabelsMaxZoom.ToString(); cmbParent.SelectItem(current.Parent); txtPriority.Text = current.Priority.ToString(); txtSymbol.Text = current.Symbol; if (uFile.HasFile) { cmbFieldCaptionName.Enabled = false; cmbFieldCodeName.Enabled = false; cmbParentItem.Enabled = false; cmbParent.Enabled = false; uFile.EnabledButtons = false; if (string.IsNullOrEmpty(current.FieldCodeName) == false) { cmbFieldCodeName.Items.Add(current.FieldCodeName); cmbFieldCodeName.SelectedIndex = 0; } } }
private void PaintThis(IntPtr hdc, RECT rc) { RECT clientRect = new RECT(); GetClientRect(this.Handle, ref clientRect); clientRect.Left = _tClientRect.Left - _tMargins.cxLeftWidth; clientRect.Top = _tMargins.cyTopHeight; clientRect.Right -= _tMargins.cxRightWidth; clientRect.Bottom -= _tMargins.cyBottomHeight; if (!_bPaintWindow) { int clr; IntPtr hb; using (ClippingRegion cp = new ClippingRegion(hdc, clientRect, rc)) { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } clr = ColorTranslator.ToWin32(this.BackColor); hb = CreateSolidBrush(clr); FillRect(hdc, ref clientRect, hb); DeleteObject(hb); } else { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } }
private void LoadItems(ClippingRegion clipping) { if (chkItems.Checked == false) { return; } using (new WaitCursor()) { lstItems.Items.Clear(); lstContainer.Panel2Collapsed = true; lstCount.Text = ""; if (clipping.ClippingRegionCaptions.Count == 0) { clipping.ClippingRegionCaptions = UI.GetItems <ClippingRegionItem>() .Where(x => x.ClippingRegion == clipping).Take(Settings.CantItems) .Select(x => new ClippingRegionCaption(x.Id.Value, x.Code, x.Caption, x.Parent.Caption, x.Parent.Code)).ToList(); } foreach (var item in clipping.ClippingRegionCaptions) { var ele = new ListViewItem(item.ToArray()); ele.Tag = item; lstItems.Items.Add(ele); } } lstCount.Text = UI.GetCountLegend(lstItems.Items); }
private Dictionary <string, string> GetDetail(ClippingRegion clipping) { using (new WaitCursor()) { var dict = new Dictionary <string, string>(); dict.Add("Id", clipping.Id.ToString()); dict.Add("Nombre", clipping.Caption); dict.Add("Campo código", clipping.FieldCodeName); dict.Add("Prioridad", clipping.Priority.ToString()); dict.Add("Indexa códigos", !clipping.IndexCodes ? "No" : "Sí"); dict.Add("Mostrar en etiquetas y búsqueda", clipping.NoAutocomplete ? "No" : "Sí"); dict.Add("Mínimo nivel de zoom para labels", clipping.LabelsMinZoom.ToString()); dict.Add("Máximo nivel de zoom para labels", clipping.LabelsMaxZoom.ToString()); dict.Add("Símbolo", clipping.Symbol == null ? "Ninguno" : clipping.Symbol); dict.Add("Metadatos", (clipping.Metadata != null ? clipping.Metadata.Title : "")); dict.Add("Fuente", (clipping.Metadata != null ? clipping.Metadata.SourcesCaption() : "")); if (clipping.ClippingRegionItemsCount.HasValue == false) { clipping.ClippingRegionItemsCount = UI.GetItems <ClippingRegionItem>().Where(x => x.ClippingRegion == clipping).Count(); } dict.Add("Ítems", clipping.ClippingRegionItemsCount.ToString()); SetChkItemsText(clipping); return(dict); } }
private void LoadList(ClippingRegion clipping) { if (clipping == null) { return; } using (new WaitCursor()) { lstClippingGeography.Items.Clear(); lstItems.Items.Clear(); var items = UI.GetItems <ClippingRegionGeography>() .Where(x => x.ClippingRegion == clipping).ToList(); foreach (var item in items) { ListViewItem lvi = new ListViewItem(item.ToArray()); lvi.Tag = item; lstClippingGeography.Items.Add(lvi); } if (lstClippingGeography.Items.Count > 0) { lstClippingGeography.Items[0].Selected = true; } if (lstClippingGeography.SelectedItems.Count > 0) { LoadItems(); } } }
public void LoadPartial(ClippingRegion clippingRegion) { if (clippingRegion == null) { return; } cmbRegion.SelectItem(clippingRegion); }
public ClippingRegionSave(ClippingRegion current, bool fileAdded, string iParent, string iCode, string iCaption, string Basename, ClippingRegionItem country) { this.current = current; this.fileAdded = fileAdded; this.iParent = iParent; this.iCode = iCode; this.iCaption = iCaption; this.Basename = Basename; this.country = country; }
private void CheckRegion(int regionId) { for (var n = 0; n < lstRegions.Items.Count; n++) { ClippingRegion cr = (lstRegions.Items[n] as ObjectCaption).Tag as ClippingRegion; if (cr.Id == regionId) { lstRegions.SetItemChecked(n, true); break; } } }
private void DeleteRecursive(ClippingRegion clipping) { foreach (var item in clipping.Children) { Progress.Total++; DeleteRecursive(item); Progress.Increment(); } // Borra los items context.Data.Session.Query <ClippingRegionItem>() .Where(x => x.ClippingRegion.Id == clipping.Id).DeleteQ(); context.Data.Session.Delete(clipping); }
private void SetChkItemsText(ClippingRegion c) { int cant = c.ClippingRegionItemsCount.GetValueOrDefault(); if (cant == 0) { chkItems.Text = "No hay ítems para mostrar"; } else if (cant > Settings.CantItems) { chkItems.Text = "Mostrar primeros " + Settings.CantItems + " ítems"; } else { chkItems.Text = "Mostrar ítems"; } }
private void AddChildren(TreeNode node) { using (new WaitCursor()) { if (node.Tag is ClippingRegionItem) { ClippingRegionItem clippingRegionItem = node.Tag as ClippingRegionItem; if (clippingRegionItem.ClippingRegion.Parent == null) { // es country var regions = UI.GetItems <ClippingRegion>().Where(x => x.Country == UI.CurrentCountry && x.Parent.Parent == null).OrderBy(x => x.Caption).ToList(); foreach (var r in regions) { CreateNode(r, node); } } else { if (clippingRegionItem.ClippingRegion.Children.Count > 1) { foreach (var r in clippingRegionItem.ClippingRegion.Children) { CreateNode(r, node); } } else { foreach (var r in clippingRegionItem.Children) { CreateNode(r, node); } } } } else if (node.Tag is ClippingRegion) { ClippingRegion clippingRegion = node.Tag as ClippingRegion; var items = UI.GetItems <ClippingRegionItem>().Where(x => x.ClippingRegion == clippingRegion && x.Parent == (node.Parent.Tag as ClippingRegionItem)).OrderBy(x => x.Caption).ToList(); foreach (var r in items) { CreateNode(r, node); } } } }
public void SetValueCmbParent(ClippingRegion cr) { cmbParent.SelectItem(cr); }
/// <summary> /// Draws the mist effect /// </summary> private void DrawMenuButtonMist(IntPtr destdc, Bitmap source, Rectangle cliprect, Rectangle bounds, float intensity) { using (ClippingRegion cp = new ClippingRegion(destdc, cliprect, bounds, CornerRadius)) { using (Graphics g = Graphics.FromHdc(destdc)) AlphaBlend(g, source, bounds, intensity); } }
private void PaintThis(IntPtr hdc, RECT rc) { RECT clientRect = new RECT(); GetClientRect(this.Handle, ref clientRect); if (_bExtendIntoFrame) { clientRect.Left = _tClientRect.Left - _tMargins.cxLeftWidth; clientRect.Top = _tMargins.cyTopHeight; clientRect.Right -= _tMargins.cxRightWidth; clientRect.Bottom -= _tMargins.cyBottomHeight; } else if (!_bPaintWindow) { clientRect.Left = _tMargins.cxLeftWidth; clientRect.Top = _tMargins.cyTopHeight; clientRect.Right -= _tMargins.cxRightWidth; clientRect.Bottom -= _tMargins.cyBottomHeight; } if (!_bPaintWindow) { int clr; IntPtr hb; using (ClippingRegion cp = new ClippingRegion(hdc, clientRect, rc)) { if (IsAero()) { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } else { clr = ColorTranslator.ToWin32(Color.FromArgb(0xC2, 0xD9, 0xF7)); hb = CreateSolidBrush(clr); FillRect(hdc, ref clientRect, hb); DeleteObject(hb); } } clr = ColorTranslator.ToWin32(this.BackColor); hb = CreateSolidBrush(clr); FillRect(hdc, ref clientRect, hb); DeleteObject(hb); } else { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } if (_bExtendIntoFrame && _bDrawCaption) { Rectangle captionBounds = new Rectangle(4, 4, rc.Right, CaptionHeight); using (Graphics g = Graphics.FromHdc(hdc)) { using (Font fc = new Font("Segoe UI", 12, FontStyle.Regular)) { SizeF sz = g.MeasureString(this.Text, fc); int offset = (rc.Right - (int)sz.Width) / 2; if (offset < 2 * FrameWidth) { offset = 2 * FrameWidth; } captionBounds.X = offset; captionBounds.Y = 4; using (StringFormat sf = new StringFormat()) { sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; using (GraphicsPath path = new GraphicsPath()) { g.SmoothingMode = SmoothingMode.HighQuality; path.AddString(this.Text, fc.FontFamily, (int)fc.Style, fc.Size, captionBounds, sf); g.FillPath(Brushes.Black, path); } } } } } }
public ClippingRegionDelete(ClippingRegion clipping) { current = clipping; }
private void PaintThis(IntPtr hdc, RECT rc) { RECT clientRect = new RECT(); GetClientRect(this.Handle, ref clientRect); if (_bExtendIntoFrame) { clientRect.Left = _tClientRect.Left - _tMargins.cxLeftWidth; clientRect.Top = _tMargins.cyTopHeight; clientRect.Right -= _tMargins.cxRightWidth; clientRect.Bottom -= _tMargins.cyBottomHeight; } else if (!_bPaintWindow) { clientRect.Left = _tMargins.cxLeftWidth; clientRect.Top = _tMargins.cyTopHeight; clientRect.Right -= _tMargins.cxRightWidth; clientRect.Bottom -= _tMargins.cyBottomHeight; } if (!_bPaintWindow) { int clr; IntPtr hb; using (ClippingRegion cp = new ClippingRegion(hdc, clientRect, rc)) { if (IsAero()) { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } else { clr = ColorTranslator.ToWin32(Color.FromArgb(0xC2, 0xD9, 0xF7)); hb = CreateSolidBrush(clr); FillRect(hdc, ref clientRect, hb); DeleteObject(hb); } } clr = ColorTranslator.ToWin32(this.BackColor); hb = CreateSolidBrush(clr); FillRect(hdc, ref clientRect, hb); DeleteObject(hb); } else { FillRect(hdc, ref rc, GetStockObject(BLACK_BRUSH)); } if (_bExtendIntoFrame && _bDrawCaption) { Rectangle captionBounds = new Rectangle(4, 4, rc.Right, CaptionHeight); using (Graphics g = Graphics.FromHdc(hdc)) { using (Font fc = new Font("Segoe UI", 12, FontStyle.Regular)) { SizeF sz = g.MeasureString(this.Text, fc); int offset = (rc.Right - (int)sz.Width) / 2; if (offset < 2 * FrameWidth) offset = 2 * FrameWidth; captionBounds.X = offset; captionBounds.Y = 4; using (StringFormat sf = new StringFormat()) { sf.HotkeyPrefix = System.Drawing.Text.HotkeyPrefix.None; sf.FormatFlags = StringFormatFlags.NoWrap; sf.Alignment = StringAlignment.Near; sf.LineAlignment = StringAlignment.Near; using (GraphicsPath path = new GraphicsPath()) { g.SmoothingMode = SmoothingMode.HighQuality; path.AddString(this.Text, fc.FontFamily, (int)fc.Style, fc.Size, captionBounds, sf); g.FillPath(Brushes.Black, path); } } } } } }