private void UpdateSymbolControls() { _ignoreChanges = true; cmbScaleMode.SelectedItem = _symbolizer.ScaleMode.ToString(); chkSmoothing.Checked = _symbolizer.Smoothing; _disableUnitWarning = true; cmbUnits.SelectedItem = _symbolizer.Units.ToString(); _disableUnitWarning = false; ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cmbSymbolType.SelectedItem = "Character"; UpdateCharacterSymbolControls(cs); } ISimpleSymbol ss = ccSymbols.SelectedSymbol as ISimpleSymbol; if (ss != null) { cmbSymbolType.SelectedItem = "Simple"; UpdateSimpleSymbolControls(ss); } IPictureSymbol ps = ccSymbols.SelectedSymbol as IPictureSymbol; if (ps != null) { cmbSymbolType.SelectedItem = "Picture"; UpdatePictureSymbolControls(ps); } _ignoreChanges = false; }
/// <summary> /// Edits a value based on some user input which is collected from a character control. /// </summary> /// <param name="context">The type descriptor context.</param> /// <param name="provider">The service provider.</param> /// <param name="value">Not used.</param> /// <returns>Returns the selected character.</returns> public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { ICharacterSymbol symbol = context?.Instance as ICharacterSymbol; IWindowsFormsEditorService dialogProvider = provider?.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; CharacterControl cc = new(dialogProvider, symbol); dialogProvider?.DropDownControl(cc); return(cc.SelectedChar); }
private void CharCharacterPopupClicked(object sender, EventArgs e) { ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cs.Code = charCharacter.SelectedChar; } UpdatePreview(); }
private void CharCharacterPopupClicked(object sender, EventArgs e) { ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cs.Character = (char)charCharacter.SelectedChar; txtUnicode.Text = ((int)cs.Character).ToString(); } UpdatePreview(); }
private void UpdateCharacterSymbolControls(ICharacterSymbol cs) { cmbFontFamilly.SelectedFamily = cs.FontFamilyName; txtUnicode.Text = ((int)cs.Character).ToString(); charCharacter.TypeSet = (byte)(cs.Character / 256); charCharacter.SelectedChar = (byte)(cs.Character % 256); charCharacter.Font = new Font(cs.FontFamilyName, 10, cs.Style); cbColorCharacter.Color = cs.Color; sldOpacityCharacter.Value = (double)cs.Color.A / 255; sldOpacityCharacter.MaximumColor = Color.FromArgb(255, cs.Color); angleControl.Angle = -(int)cs.Angle; dbxOffsetX.Value = cs.Offset.X; dbxOffsetY.Value = cs.Offset.Y; sizeControl.Symbol = cs; }
private void CmbFontFamillySelectedItemChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cs.FontFamilyName = cmbFontFamilly.SelectedFamily; charCharacter.Font = new Font(cs.FontFamilyName, 10, cs.Style); // charCharacter. } UpdatePreview(); }
private void CmbFontFamillySelectedItemChanged(object sender, EventArgs e) { if (_ignoreChanges) { return; } ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cs.FontFamilyName = cmbFontFamilly.SelectedFamily; Properties.Settings.Default.DetailedPointSymbolControlFontFamilyName = cs.FontFamilyName; Properties.Settings.Default.Save(); charCharacter.Font = new Font(cs.FontFamilyName, 10, cs.Style); // charCharacter. } UpdatePreview(); }
private void UpdateSymbolControls() { _ignoreChanges = true; cmbScaleMode.SelectedIndex = Global.GetEnumIndex(_symbolizer.ScaleMode); chkSmoothing.Checked = _symbolizer.Smoothing; _disableUnitWarning = true; cmbUnits.SelectedIndex = Global.GetEnumIndex(_symbolizer.Units); _disableUnitWarning = false; ICharacterSymbol cs = ccSymbols.SelectedSymbol as ICharacterSymbol; if (cs != null) { cmbSymbolType.SelectedItem = "Character"; UpdateCharacterSymbolControls(cs); } cmbSymbolType.SelectedIndex = Global.GetEnumIndex(ccSymbols.SelectedSymbol.SymbolType); switch (ccSymbols.SelectedSymbol.SymbolType) { case SymbolType.Character: break; case SymbolType.Custom: break; case SymbolType.Picture: IPictureSymbol ps = ccSymbols.SelectedSymbol as IPictureSymbol; UpdatePictureSymbolControls(ps); break; case SymbolType.Simple: ISimpleSymbol ss = ccSymbols.SelectedSymbol as ISimpleSymbol; UpdateSimpleSymbolControls(ss); break; } _ignoreChanges = false; }
/// <summary> /// Creates a new instance of a CharacterControl designed to edit the specific symbol /// </summary> /// <param name="editorService"></param> /// <param name="symbol"></param> public CharacterControl(IWindowsFormsEditorService editorService, ICharacterSymbol symbol) { _editorService = editorService; _symbol = symbol; Configure(); }
/// <summary> /// Initializes a new instance of the <see cref="CharacterControl"/> class designed to edit the specific symbol. /// </summary> /// <param name="editorService">The editor service.</param> /// <param name="symbol">The character symbol.</param> public CharacterControl(IWindowsFormsEditorService editorService, ICharacterSymbol symbol) { _editorService = editorService; _symbol = symbol; Configure(); }
private void UpdateCharacterSymbolControls(ICharacterSymbol cs) { cmbFontFamilly.SelectedFamily = cs.FontFamilyName; txtUnicode.Text = ((int)cs.Character).ToString(); charCharacter.TypeSet = (byte)(cs.Character / 256); charCharacter.SelectedChar = (byte)(cs.Character % 256); charCharacter.Font = new Font(cs.FontFamilyName, 10, cs.Style); cbColorCharacter.Color = cs.Color; sldOpacityCharacter.Value = ((double)cs.Color.A / 255); sldOpacityCharacter.MaximumColor = Color.FromArgb(255, cs.Color); angleControl.Angle = -(int)cs.Angle; dbxOffsetX.Value = cs.Offset.X; dbxOffsetY.Value = cs.Offset.Y; sizeControl.Symbol = cs; }
/// <summary> /// Draws the specified character at the specified geographic coordinate, adjusted to the specified size. /// </summary> /// <param name="character"></param> /// <param name="center"></param> /// <param name="size"></param> public virtual void DrawCharacter(ICharacterSymbol character, ICoordinate center, SizeF size) { System.Drawing.Point c = _mapFrame.ProjToBuffer(center); Font tempFont = new Font(character.FontFamilyName, size.Height, character.Style, GraphicsUnit.Pixel); Brush brush = new SolidBrush(character.Color); _device.TextContrast = 0; _device.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; _device.DrawString(character.ToString(), tempFont, brush, c.X - size.Width / 2, c.Y - size.Height / 2); brush.Dispose(); tempFont.Dispose(); }
/// <summary> /// Draws the character when scaled to geographic sizes. /// </summary> /// <param name="character"></param> /// <param name="center"></param> /// <param name="size"></param> public virtual void DrawCharacter(ICharacterSymbol character, ICoordinate center, ISize size) { Envelope env = new Envelope(center.X - size.XSize / 2, center.X + size.XSize / 2, center.Y - size.YSize / 2, center.Y + size.YSize / 2); Rectangle r = ProjToBuffer(env); Font tempFont = new Font(character.FontFamilyName, r.Height, character.Style, GraphicsUnit.Pixel); Brush brush = new SolidBrush(character.Color); _device.TextContrast = 0; _device.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias; _device.DrawString(character.ToString(), tempFont, brush, r.Left, r.Top); brush.Dispose(); tempFont.Dispose(); }