public stdole.IPictureDisp catGallery_getItemImage(Office.IRibbonControl control, int index)
        {
            Category  cat  = sorted_cats.ElementAt(index);
            Rectangle rect = new Rectangle(0, 0, 20, 20);
            Bitmap    img  = new Bitmap(rect.Width, rect.Height);
            Graphics  gr   = Graphics.FromImage(img);

            // draw the interior with category color
            rect.Inflate(-4, -4);
            Brush b1 = new SolidBrush(ColorTranslator.FromOle((int)cat.CategoryGradientBottomColor));

            gr.FillRectangle(b1, rect);
            Pen p1 = new Pen(ColorTranslator.FromOle((int)cat.CategoryBorderColor), 1);

            gr.DrawRectangle(p1, rect);

            rect.Inflate(3, 3);
            Pen p2 = new Pen(Color.MediumBlue, 1);

            if (catsAllHave.Contains(cat.Name))
            {
                gr.DrawRectangle(p2, rect);
            }
            else if (catsSomeHave.Contains(cat.Name))
            {
                p2.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot;
                gr.DrawRectangle(p2, rect);
            }

            return(AxHostConverter.ImageToPictureDisp(img));
        }
Exemplo n.º 2
0
        private void txtCVMin_TextChanged(object eventSender, EventArgs eventArgs)
        {
            if (FieldInit == true)
            {
                return;
            }
            if (string.IsNullOrEmpty(txtCVMin.Text))
            {
                txtCVMin.Text = "0";
            }

            int ParseInt = 0;

            if (int.TryParse(txtCVMin.Text, out ParseInt))
            {
                if (Conversion.Val(txtCVMin.Text) > 59d)
                {
                    txtCVMin.BackColor = ColorTranslator.FromOle(0xFF);
                    ErrorMsgBox("CV Min Value too large - must be 0 to 59");
                    return;
                }
            }
            else
            {
                txtCVMin.BackColor = ColorTranslator.FromOle(0xFF);
                ErrorMsgBox("CV Min Value must be numeric between 0 to 59");
                return;
            }

            if (Conversion.Val(txtCVMin.Text) < 60d)
            {
                txtCVMin.BackColor = Control.DefaultBackColor;
            }
        }
Exemplo n.º 3
0
        public Result Save(string path, bool overwrite, bool compress = false) // compress is ignored.
        {
            var returnResult = new Result(string.Format("Saving heightmap to \"{0}\".", path), false);

            logger.Info("Saving heightmap to \"{0}\"", path);

            var heightmapBitmap = new Bitmap(map.Terrain.TileSize.X + 1, map.Terrain.TileSize.Y + 1);

            for (var Y = 0; Y <= map.Terrain.TileSize.Y; Y++)
            {
                for (var X = 0; X <= map.Terrain.TileSize.X; X++)
                {
                    heightmapBitmap.SetPixel(X, Y,
                                             ColorTranslator.FromOle(ColorUtil.OsRgb(Convert.ToInt32(map.Terrain.Vertices[X, Y].Height), map.Terrain.Vertices[X, Y].Height,
                                                                                     map.Terrain.Vertices[X, Y].Height)));
                }
            }

            var subResult = BitmapUtil.SaveBitmap(path, overwrite, heightmapBitmap);

            if (!subResult.Success)
            {
                returnResult.ProblemAdd(subResult.Problem);
            }

            return(returnResult);
        }
Exemplo n.º 4
0
        private void InitTextElementStyle(ITextElement textElement)
        {
            txtContent.Text = textElement.Text;

            Font font    = new Font(textElement.Symbol.Font.Name, (float)textElement.Symbol.Font.Size);
            Font fontOld = font;

            if (textElement.Symbol.Font.Bold)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Bold);
            }
            if (textElement.Symbol.Font.Italic)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Italic);
            }
            if (textElement.Symbol.Font.Strikethrough)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Strikeout);
            }
            if (textElement.Symbol.Font.Underline)
            {
                fontOld = font;
                font    = new Font(fontOld, FontStyle.Underline);
            }
            m_fontDialog.Font = font;
            lblExample.Font   = font;

            Color color = ColorTranslator.FromOle(textElement.Symbol.Color.RGB);

            m_fontDialog.Color   = color;
            lblExample.ForeColor = color;
        }
Exemplo n.º 5
0
            public ColorPalette(ColorUI colorUI, Color[] customColors)
            {
                if (!s_isScalingInitialized)
                {
                    if (DpiHelper.IsScalingRequired)
                    {
                        s_cellSizeX = DpiHelper.LogicalToDeviceUnitsX(CellSize);
                        s_cellSizeY = DpiHelper.LogicalToDeviceUnitsY(CellSize);
                        s_marginX   = DpiHelper.LogicalToDeviceUnitsX(MarginWidth);
                        s_marginY   = DpiHelper.LogicalToDeviceUnitsY(MarginWidth);
                    }

                    s_isScalingInitialized = true;
                }

                _colorUI = colorUI;
                SetStyle(ControlStyles.Opaque, true);

                BackColor = SystemColors.Control;

                Size = new Size(
                    CellsAcross * (s_cellSizeX + s_marginX) + s_marginX + 2,
                    CellsDown * (s_cellSizeY + s_marginY) + s_marginY + 2);

                _staticColors = new Color[TotalCells - CellsCustom];

                for (int i = 0; i < s_staticCells.Length; i++)
                {
                    _staticColors[i] = ColorTranslator.FromOle(s_staticCells[i]);
                }

                CustomColors = customColors;
            }
Exemplo n.º 6
0
        private void FrmFrameBorder_Load(object sender, EventArgs e)
        {
            //加载边框样式
            string EsriStylePathFram = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";

            axSymbologyCtlFrame.LoadStyleFile(EsriStylePathFram);
            axSymbologyCtlFrame.StyleClass = esriSymbologyStyleClass.esriStyleClassBorders;

            if (SymbolBorder != null)
            {
                pStyleGalleryItem.Item = SymbolBorder;

                ILineSymbol PLS = SymbolBorder.LineSymbol;
                this.SizeBorder.Text = PLS.Width.ToString();
                IColor pLineColor = PLS.Color;
                Color  pColor     = ColorTranslator.FromOle(pLineColor.RGB);
                colorBorder.SelectedColor = pColor;
                pLineSymbol = null;

                PreviewImage();
            }
            else
            {
                SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassBorders);
            }
        }
Exemplo n.º 7
0
        //边框样式选择
        private void btBorderStyle_Click(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                ISymbolBorder pSBorder = (ISymbolBorder)pStyleGalleryItem.Item;
                ILineSymbol   pLS      = pSBorder.LineSymbol;
                FrmSymbol     Frm      = new FrmSymbol(SymbolStyle, (ISymbol)pLS, esriSymbologyStyleClass.esriStyleClassLineSymbols);
                Frm.ShowDialog();
                if (Frm.DialogResult == DialogResult.OK)
                {
                    pLineSymbol          = Frm.GetStyleGalleryItem().Item as ILineSymbol;
                    this.SizeBorder.Text = pLineSymbol.Width.ToString();
                    IColor pLineColor = pLineSymbol.Color;
                    Color  pColor     = ColorTranslator.FromOle(pLineColor.RGB);
                    colorBorder.SelectedColor = pColor;
                    SymbolBorder            = (ISymbolBorder)pStyleGalleryItem.Item;
                    SymbolBorder.LineSymbol = pLineSymbol;

                    PreviewImage();
                }
            }
            else
            {
                MessageBox.Show("请选择一种样式!");
            }
        }
 protected override void OnModelCreating(ModelBuilder modelBuilder)
 {
     // KEYS
     modelBuilder.Entity <DoubleTime>()
     .HasKey(dt => new { dt.Day, dt.Start, dt.End });
     modelBuilder.Entity <WorkItem>()
     .HasKey(wi => new { wi.Start, wi.End, wi.Date });
     // CONVERSION
     modelBuilder.Entity <DateSpan>()
     .Property(ds => ds.Start)
     .HasConversion(dt => dt.ToString("dd.MM.yyyy"), dt => DateTime.ParseExact(dt, "dd.MM.yyyy", CultureInfo.CurrentUICulture));
     modelBuilder.Entity <UserText>()
     .Property(ut => ut.Color)
     .HasConversion(c => ColorTranslator.ToOle(c), c => ColorTranslator.FromOle(c));
     modelBuilder.Entity <Category>()
     .Property(c => c.Archived)
     .HasConversion(new BoolToZeroOneConverter <int>());
     modelBuilder.Entity <DoubleTime>()
     .Property(dt => dt.Day)
     .HasConversion(d => Enum.GetName(d), d => Enum.Parse <DayOfWeek>(d !));
     modelBuilder.Entity <Goal>()
     .Property(g => g.State)
     .HasConversion(d => Enum.GetName(d), d => Enum.Parse <StateEnum>(d !));
     // TITLES
     modelBuilder.Entity <DoubleTime>(b => b.ToTable("Times"));
     base.OnModelCreating(modelBuilder);
 }
Exemplo n.º 9
0
    /// <summary>
    /// Get RGB-color from WdColor
    /// </summary>
    /// <param name="wdColor">source color</param>
    /// <param name="doc">document, where this color from (for appropriate color theme)</param>
    public static Color GetRGBColor(WdColor wdColor, Document doc)
    {
        // separate 1st byte (the most significant) and 3 others to different vars
        int color     = ((int)wdColor) & ((int)0xFFFFFF);
        int colorType = (int)(((uint)wdColor) >> 24);

        if (colorType == RGB)
        {
            // simple color in OLE format (it's just a BGR - blue, green, red)
            // let's use standard color translator from system.drawing
            return(ColorTranslator.FromOle(color));
        }
        else if (colorType == Automatic)
        {
            // standard contrast color. In my case I was needed color. But I don't know the proper way to understand which one (black or white) I need to choose.
            return(Color.White);
        }
        else if (colorType == System)
        {
            // In ActiveX controls in documents, and in VBA (for UserForm controls, for example) special values for system colours
            // (for some reason lost in the mists of time these are also called OLE Colors) ranging from 0x80000000 to 0x80000018.
            // I used system dll function to retrieve system color and then used standard color translator
            int sysColor = GetSysColor(color);
            return(ColorTranslator.FromOle(sysColor));
        }
        else if (colorType >= ThemeLow && colorType <= ThemeHigh)
        {
            // color based on doc's color theme
            return(GetThemedColor(colorType, color, doc));
        }

        throw new Exception("Unknown color type");
    }
Exemplo n.º 10
0
        public static byte[] GetXorBitmap()
        {
            Bitmap     XorBitmap = new Bitmap(512, 512);
            FastBitmap FBitmap   = new FastBitmap(XorBitmap);

            for (int x = 0; x < XorBitmap.Width; x++)
            {
                for (int y = 0; y < XorBitmap.Height; y++)
                {
                    Color color = ColorTranslator.FromOle((x ^ y));
                    color = Color.FromArgb(color.R, color.R, color.R);
                    FBitmap.SetPixel(x, y, color);
                }
            }

            FBitmap.Release();

            ImageCodecInfo    codec       = WebShot.GetEncoderInfo("image/png");
            EncoderParameters codecParams = new EncoderParameters(1);

            codecParams.Param[0] = new EncoderParameter(System.Drawing.Imaging.Encoder.Quality, 90L);

            MemoryStream stream = new MemoryStream();

            XorBitmap.Save(stream, codec, codecParams);

            byte[] buffer = stream.ToArray();

            stream.Close();
            codecParams.Dispose();

            return(buffer);
        }
 /// <summary>
 /// Updates the color
 /// </summary>
 /// <param name="rgb">  The OLE color value. </param>
 private void UpdateColor(int rgb)
 {
     if (ColorTranslator.ToWin32(this.Color) != rgb)
     {
         this.Color = ColorTranslator.FromOle(rgb);
     }
 }
        public EditorFontAndColors()
        {
            FontFamily         = "Consolas";
            FontSize           = 10.0f;
            FontBold           = false;
            ForeColor          = Color.Black;
            BackColor          = Color.White;
            HighlightFontBold  = false;
            HighlightForeColor = Color.White;
            HighlightBackColor = Color.Blue;

            try {
                var dte   = (EnvDTE.DTE)IndentGuidePackage.GetGlobalService(typeof(EnvDTE.DTE));
                var props = dte.Properties["FontsAndColors", "TextEditor"];

                var fac = (EnvDTE.FontsAndColorsItems)props.Item("FontsAndColorsItems").Object;

                var colors = (EnvDTE.ColorableItems)fac.Item("Plain Text");

                FontFamily = props.Item("FontFamily").Value.ToString();
                FontSize   = (float)(short)props.Item("FontSize").Value;
                FontBold   = colors.Bold;
                ForeColor  = ColorTranslator.FromOle((int)colors.Foreground);
                BackColor  = ColorTranslator.FromOle((int)colors.Background);

                colors = (EnvDTE.ColorableItems)fac.Item("Selected Text");

                HighlightFontBold  = colors.Bold;
                HighlightForeColor = ColorTranslator.FromOle((int)colors.Foreground);
                HighlightBackColor = ColorTranslator.FromOle((int)colors.Background);
            } catch (Exception ex) {
                Trace.WriteLine("Error loading text editor font and colors");
                Trace.WriteLine(ex.ToString());
            }
        }
Exemplo n.º 13
0
        private static bool GetIsDark()
        {
            var storage = Package.GetGlobalService(typeof(SVsFontAndColorStorage)) as IVsFontAndColorStorage;

            if (storage == null)
            {
                return(false);
            }

            var category = Microsoft.VisualStudio.Editor.DefGuidList.guidTextEditorFontCategory;
            var success  = storage.OpenCategory(ref category, (uint)(__FCSTORAGEFLAGS.FCSF_READONLY | __FCSTORAGEFLAGS.FCSF_LOADDEFAULTS | __FCSTORAGEFLAGS.FCSF_NOAUTOCOLORS));

            try
            {
                if (success == 0)
                {
                    var colors  = new ColorableItemInfo[1];
                    var hresult = storage.GetItem("Plain Text", colors);
                    if (hresult == 0)
                    {
                        var dcolor = ColorTranslator.FromOle(Convert.ToInt32(colors[0].crBackground));
                        var hsp    = Math.Sqrt(0.299 * (dcolor.R * dcolor.R) + 0.587 * (dcolor.G * dcolor.G) + 0.114 * (dcolor.B * dcolor.B));
                        return(hsp < 127.5);
                    }
                }
            }
            finally
            {
                storage.CloseCategory();
            }

            return(false);
        }
Exemplo n.º 14
0
 /// <summary>
 /// Handles the Click event of the btnChangeOutlineStyle control.
 /// </summary>
 /// <param name="obj">The source of the event.</param>
 /// <param name="eventArgs">The <see cref="EventArgs"/> instance containing the event data.</param>
 private void btnChangeOutlineStyle_Click(object obj, EventArgs eventArgs)
 {
     if (this._styleGalleryItem != null)
     {
         this._fillSymble = (this._styleGalleryItem.Item as IFillSymbol);
         if (this._fillSymble != null)
         {
             ILineSymbol       lineSymbol      = this._fillSymble.Outline;
             frmSymbolSelector frmSymbolSelect = new frmSymbolSelector();
             IStyleGalleryItem item            = frmSymbolSelect.GetItem(esriSymbologyStyleClass.esriStyleClassLineSymbols, lineSymbol as ISymbol);
             if (item != null)
             {
                 lineSymbol = (item.Item as ILineSymbol);
                 if (lineSymbol.Color != null)
                 {
                     this.cmbFillLineColor.Color = ColorTranslator.FromOle(lineSymbol.Color.RGB);
                 }
                 else
                 {
                     this.cmbFillLineColor.Color = Color.Empty;
                 }
                 this.cmbFillWidth.Value  = Convert.ToDecimal(lineSymbol.Width);
                 this._fillSymble.Outline = lineSymbol;
                 this.ViewSymble();
             }
         }
     }
 }
Exemplo n.º 15
0
        public Result Save(string path, bool overwrite, bool compress = false) // compress is ignored.
        {
            var returnResult = new Result(string.Format("Saving minimap to \"{0}\".", path), false);

            logger.Info("Saving minimap to \"{0}\"", path);

            var minimapBitmap = new Bitmap(map.Terrain.TileSize.X, map.Terrain.TileSize.Y);

            var texture = new clsMinimapTexture(new XYInt(map.Terrain.TileSize.X, map.Terrain.TileSize.Y));

            map.MinimapTextureFill(texture);

            for (var y = 0; y <= map.Terrain.TileSize.Y - 1; y++)
            {
                for (var x = 0; x <= map.Terrain.TileSize.X - 1; x++)
                {
                    minimapBitmap.SetPixel(x, y,
                                           ColorTranslator.FromOle(
                                               ColorUtil.OsRgb(
                                                   MathUtil.ClampSng(Convert.ToSingle(texture.get_Pixels(x, y).Red * 255.0F), 0.0F, 255.0F).ToInt(),
                                                   (MathUtil.ClampSng(Convert.ToSingle(texture.get_Pixels(x, y).Green * 255.0F), 0.0F, 255.0F)).ToInt(),
                                                   (MathUtil.ClampSng(Convert.ToSingle(texture.get_Pixels(x, y).Blue * 255.0F), 0.0F, 255.0F)).ToInt()
                                                   )));
                }
            }

            var subResult = BitmapUtil.SaveBitmap(path, overwrite, minimapBitmap);

            if (!subResult.Success)
            {
                returnResult.ProblemAdd(subResult.Problem);
            }

            return(returnResult);
        }
Exemplo n.º 16
0
        /// <summary>
        /// Couleurs the long to HTML.
        /// </summary>
        /// <param name="CouleurLong">The couleur long.</param>
        /// <returns></returns>
        public string CouleurLongToHtml(int CouleurLong)
        {
            Color  MaCouleur   = ColorTranslator.FromOle(CouleurLong);
            string CouleurHTML = ColorTranslator.ToHtml(MaCouleur);

            return(CouleurHTML);
        }
Exemplo n.º 17
0
        //背景样式选择,调用FrmSy窗口
        private void btBackgroundStyle_Click(object sender, EventArgs e)
        {
            if (pStyleGalleryItem != null)
            {
                ISymbolBackground pSBackground = pStyleGalleryItem.Item as ISymbolBackground;
                IFillSymbol       pFS          = pSBackground.FillSymbol;
                FrmSymbol         Frm          = new FrmSymbol(SymbolStyle, (ISymbol)pFS, esriSymbologyStyleClass.esriStyleClassFillSymbols);
                Frm.ShowDialog();
                if (Frm.DialogResult == DialogResult.OK)
                {
                    pFillSymbol = Frm.GetStyleGalleryItem().Item as IFillSymbol;
                    this.SizeBackgroundOutline.Text = pFillSymbol.Outline.Width.ToString();

                    IColor pFillColor = pFillSymbol.Color;
                    Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                    colorFill.SelectedColor = pColorFill;

                    IColor pOutlineColor = pFillSymbol.Outline.Color;
                    Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                    colorOutline.SelectedColor = pColorOutline;

                    SymbolBackground            = pStyleGalleryItem.Item as ISymbolBackground;
                    SymbolBackground.FillSymbol = pFillSymbol;

                    PreviewImage();
                }
            }
            else
            {
                MessageBox.Show("请选择一种样式!");
            }
        }
Exemplo n.º 18
0
            public ColorPalette(ColorUI colorUI, Color[] customColors)
            {
                if (!isScalingInitialized)
                {
                    if (DpiHelper.IsScalingRequired)
                    {
                        cellSizeX = DpiHelper.LogicalToDeviceUnitsX(CELL_SIZE);
                        cellSizeY = DpiHelper.LogicalToDeviceUnitsY(CELL_SIZE);
                        marginX   = DpiHelper.LogicalToDeviceUnitsX(MARGIN);
                        marginY   = DpiHelper.LogicalToDeviceUnitsY(MARGIN);
                    }
                    isScalingInitialized = true;
                }

                this.colorUI = colorUI;
                SetStyle(ControlStyles.Opaque, true);

                BackColor = SystemColors.Control;

                Size = new Size(CELLS_ACROSS * (cellSizeX + marginX) + marginX + 2,
                                CELLS_DOWN * (cellSizeY + marginY) + marginY + 2);

                staticColors = new Color[CELLS - CELLS_CUSTOM];

                for (int i = 0; i < staticCells.Length; i++)
                {
                    staticColors[i] = ColorTranslator.FromOle(staticCells[i]);
                }

                CustomColors = customColors;
            }
Exemplo n.º 19
0
        private void LoadBackImage()
        {
            ImageBox.Load(LocalPath + "CardBack.png");
            Color temp = ColorTranslator.FromOle(0x54FF70);

            ImageBox.BackColor = Color.FromArgb(250, temp);
        }
Exemplo n.º 20
0
    private static Color GetThemedColor(int colorThemeIndex, double tintAndShade, Document doc)
    {
        // translate from wdThemeColorIndex to MsoThemeColorSchemeIndex
        MsoThemeColorSchemeIndex colorSchemeIndex = ThemeIndexToSchemeIndex(colorThemeIndex);
        // get color scheme by this index and take its RGB property, but this RGB still OLE RGB - i.e. BGR -> need to convert it to real RGB, i.e. use ColorTranslator.FromOle() and ToArgb after
        OfficeTheme      theme  = doc.DocumentTheme;
        ThemeColorScheme scheme = theme.ThemeColorScheme;
        ThemeColor       color  = scheme.Colors(colorSchemeIndex);
        int colorSchemeRGB      = ColorTranslator.FromOle(color.RGB).ToArgb();

        Marshal.ReleaseComObject(color);
        Marshal.ReleaseComObject(scheme);
        Marshal.ReleaseComObject(theme);

        // do RGB -> HSL translation to apply tint/shade
        HSL colorSchemeHSL = RGBtoHSL(colorSchemeRGB);

        // apply it
        if (tintAndShade > 0)
        {
            colorSchemeHSL.L += (1 - colorSchemeHSL.L) * tintAndShade;
        }
        else
        {
            colorSchemeHSL.L *= 1 - Math.Abs(tintAndShade);
        }

        // do backward HSL -> RGB translation
        int tintedAndShadedRGB = HSLtoRGB(colorSchemeHSL);

        return(Color.FromArgb(tintedAndShadedRGB));
    }
        protected override void OnDrawItem(DrawItemEventArgs e)
        {
            if (this.DesignMode)
            {
                base.OnDrawItem(e);
            }
            else
            {
                var masterCategoryName = this.Items[e.Index].ToString();
                var masterCategory     = Globals.GreatFollowUpperAddin.Application.Session.Categories.Cast <Outlook.Category>().SingleOrDefault(c => c.Name == masterCategoryName);

                if (masterCategory == null)
                {
                    base.OnDrawItem(e);
                }
                else
                {
                    var color = ColorTranslator.FromOle((int)masterCategory.CategoryGradientBottomColor);

                    var e2 = new DrawItemEventArgs(
                        e.Graphics,
                        e.Font,
                        new Rectangle(e.Bounds.Location, e.Bounds.Size),
                        e.Index,
                        (e.State & DrawItemState.Focus) == DrawItemState.Focus ? DrawItemState.Focus : DrawItemState.None, /* Remove 'selected' state so that the base.OnDrawItem doesn't obliterate the work we are doing here. */
                        PerceivedBrightness(color) > 130 ? Color.Black : Color.White,
                        color);

                    base.OnDrawItem(e2);
                }
            }
        }
        //===============================
        Color Hex_to_Color(string hx)
        {
            int   x = int.Parse(hx, System.Globalization.NumberStyles.HexNumber);
            Color c = ColorTranslator.FromOle(x);

            return(c);
        }
Exemplo n.º 23
0
        public ColourControl(Rgb newColour)
        {
            InitializeComponent();

            if (newColour == null)
            {
                Debugger.Break();
                Hide();
                return;
            }

            colour = newColour;
            var red   = MathUtil.ClampDbl(colour.Red * 255.0D, 0.0D, 255.0D).ToInt();
            var green = MathUtil.ClampDbl(colour.Green * 255.0D, 0.0D, 255.0D).ToInt();
            var blue  = MathUtil.ClampDbl(colour.Blue * 255.0D, 0.0D, 255.0D).ToInt();

            colourColor = ColorTranslator.FromOle(ColorUtil.OsRgb(red, green, blue));

            if (colour is Rgba)
            {
                nudAlpha.Value         = (decimal)(((Rgba)colour).Alpha);
                nudAlpha.ValueChanged += nudAlpha_Changed;
                nudAlpha.Leave        += nudAlpha_Changed;
            }
            else
            {
                nudAlpha.Hide();
            }

            colourBoxGraphics = pnlColour.CreateGraphics();

            ColourBoxRedraw();
        }
Exemplo n.º 24
0
        private void txtLoDeg_TextChanged(object eventSender, EventArgs eventArgs)
        {
            if (Conversion.Val(txtLoDeg.Text) != 180d)
            {
                txtLoMin.Enabled = true;
            }
            if (Conversion.Val(txtLoDeg.Text) == 180d)
            {
                txtLoMin.Text      = "";
                txtLoMin.Enabled   = false;
                txtLoMin.BackColor = Color.Gray;
            }

            txtLoDeg.BackColor = Control.DefaultBackColor;
            if (Conversion.Val(txtLoDeg.Text) > 180d | Conversion.Val(txtLoDeg.Text) == 180d & Conversion.Val(txtLoMin.Text) != 0d)
            {
                txtLoDeg.BackColor = ColorTranslator.FromOle(0xFF);
                ErrorMsgBox("Out of Range");
            }

            if (Conversion.Val(txtLoDeg.Text) < 180d)
            {
                txtLoMin.BackColor = Control.DefaultBackColor;
            }
        }
Exemplo n.º 25
0
        private void FrmFrameBackground_Load(object sender, EventArgs e)
        {
            //加载背景样式
            string EsriStylePathFram = ClsGDBDataCommon.GetParentPathofExe() + @"Resource\Style\ESRI.ServerStyle";

            axSymbologyCtlFrame.LoadStyleFile(EsriStylePathFram);
            axSymbologyCtlFrame.StyleClass = esriSymbologyStyleClass.esriStyleClassBackgrounds;
            if (SymbolBackground != null)
            {
                pStyleGalleryItem.Item = SymbolBackground;

                IFillSymbol pFS = SymbolBackground.FillSymbol;
                this.SizeBackgroundOutline.Text = pFS.Outline.Width.ToString();

                IColor pFillColor = pFS.Color;
                Color  pColorFill = ColorTranslator.FromOle(pFillColor.RGB);
                colorFill.SelectedColor = pColorFill;

                IColor pOutlineColor = pFS.Outline.Color;
                Color  pColorOutline = ColorTranslator.FromOle(pOutlineColor.RGB);
                colorOutline.SelectedColor = pColorOutline;
            }
            else
            {
                SetFeatureClassStyle(esriSymbologyStyleClass.esriStyleClassBackgrounds);
            }
        }
        private void RenderChartFields(int left, int top)
        {
            var color = ColorTranslator.FromOle(Convert.ToInt32(_sf.Charts.LineColor));
            var pen   = new Pen(color);

            for (var i = 0; i < _sf.Charts.NumFields; i++)
            {
                var rect = new Rectangle(left, top, Constants.IconWidth, Constants.IconHeight);
                color = ColorTranslator.FromOle(Convert.ToInt32(_sf.Charts.Field[i].Color));
                var brush = new SolidBrush(color);
                _graphics.FillRectangle(brush, rect);
                _graphics.DrawRectangle(pen, rect);

                _layer.Elements.Add(LayerElementType.ChartField, rect, i);

                rect = new Rectangle(
                    left + Constants.IconWidth + 5,
                    top,
                    _bounds.Width - Constants.TextRightPadNoIcon - Constants.CsTextLeftIndent,
                    Constants.TextHeight);
                var name = _sf.Charts.Field[i].Name;
                DrawText(_graphics, name, rect, Font, Color.Black);

                _layer.Elements.Add(LayerElementType.ChartFieldName, rect);

                top += Constants.CsItemHeight + Constants.VerticalPad;
            }
        }
Exemplo n.º 27
0
        private void txtm_TextChanged(object eventSender, EventArgs eventArgs)
        {
            if (Flag1 == true)
            {
                return;
            }
            if (Flag2 == true)
            {
                return;
            }
            // If txtm.Enabled = False Then txtm.Clear()
            if (!string.IsNullOrEmpty(txth.Text) | !string.IsNullOrEmpty(txtm.Text))
            {
                txtTime.Enabled   = false;
                txtTime.BackColor = Color.Gray;
                txtTime.Clear();
            }
            else
            {
                txtTime.Enabled   = true;
                txtTime.BackColor = Control.DefaultBackColor;
            }

            if (Conversion.Val(txtm.Text) > 59d)
            {
                txtm.BackColor = ColorTranslator.FromOle(0xFF);
                ErrorMsgBox("Out of Range");
            }

            if (Conversion.Val(txtm.Text) <= 59d)
            {
                txtm.BackColor = Control.DefaultBackColor;
            }
        }
Exemplo n.º 28
0
        bool ESRI.ArcGIS.esriSystem.IClone.IsEqual(IClone other)
        {
            bool angle = false;
            ILogoMarkerSymbol logoMarkerSymbol  = null;
            ILogoMarkerSymbol logoMarkerSymbol1 = null;
            IMarkerSymbol     markerSymbol      = null;
            IMarkerSymbol     markerSymbol1     = null;
            ISymbol           symbol            = null;
            ISymbol           symbol1           = null;
            IDisplayName      displayName       = null;
            IDisplayName      displayName1      = null;
            ISymbolRotation   symbolRotation    = null;
            ISymbolRotation   symbolRotation1   = null;
            IMapLevel         mapLevel          = null;
            IMapLevel         mapLevel1         = null;

            if (other != null)
            {
                if (other is ILogoMarkerSymbol)
                {
                    logoMarkerSymbol  = other as ILogoMarkerSymbol;
                    logoMarkerSymbol1 = this;
                    System.Drawing.Color color =
                        ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorBorder.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorBorder.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorLeft.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorLeft.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorRight.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorRight.RGB)));
                    color = ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol1.ColorTop.RGB));
                    angle = angle &
                            color.Equals(ColorTranslator.FromOle(Convert.ToInt32(logoMarkerSymbol.ColorTop.RGB)));
                    markerSymbol    = other as IMarkerSymbol;
                    markerSymbol1   = this;
                    angle           = angle & markerSymbol1.Angle == markerSymbol.Angle;
                    color           = ColorTranslator.FromOle(Convert.ToInt32(markerSymbol1.Color.RGB));
                    angle           = angle & color.Equals(ColorTranslator.FromOle(Convert.ToInt32(markerSymbol.Color.RGB)));
                    angle           = angle & markerSymbol1.Size == markerSymbol.Size;
                    angle           = angle & markerSymbol1.XOffset == markerSymbol.XOffset;
                    angle           = angle & markerSymbol1.YOffset == markerSymbol.YOffset;
                    symbol          = other as ISymbol;
                    symbol1         = this;
                    angle           = angle & symbol1.ROP2 == symbol.ROP2;
                    displayName     = other as IDisplayName;
                    displayName1    = this;
                    angle           = angle & (displayName1.NameString == displayName.NameString);
                    symbolRotation  = other as ISymbolRotation;
                    symbolRotation1 = this;
                    angle           = angle & symbolRotation1.RotateWithTransform == symbolRotation.RotateWithTransform;
                    mapLevel        = other as IMapLevel;
                    mapLevel1       = this;
                    angle           = angle & mapLevel1.MapLevel == mapLevel.MapLevel;
                }
            }
            return(angle);
        }
Exemplo n.º 29
0
 /// <include file='doc\FontDialog.uex' path='docs/doc[@for="FontDialog.UpdateColor"]/*' />
 /// <devdoc>
 /// </devdoc>
 /// <internalonly/>
 private void UpdateColor(int rgb)
 {
     if (ColorTranslator.ToWin32(color) != rgb)
     {
         color = ColorTranslator.FromOle(rgb);
         usingDefaultIndirectColor = false;
     }
 }
Exemplo n.º 30
0
 private void CopyBaseColor(FORBaseColor bc1, FORBaseColor bc2)
 {
     bc1.UID    = bc2.UID;
     bc1.Title  = bc2.Title;
     bc1.Remark = bc2.Remark;
     bc1.Color  = bc2.Color;
     bc1.Color1 = ColorTranslator.FromOle(bc2.Color);
 }