private IColor GetColorByColorPalette(int left, int top) { IColor pColor; pColor = new RgbColorClass(); pColor.RGB = 255; try { IColorPalette pPalette; pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = left; pRect.top = top; pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); pColor = pPalette.Color; return(pColor); } catch (Exception ex) { MessageBox.Show(ex.Message); return(pColor); } }
private void btn_BackGroundColor_Click(object sender, EventArgs e) { m_BackGroundColor.RGB = 255; IColorPalette pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = 10; pRect.top = 10; pPalette.TrackPopupMenu(ref pRect, m_BackGroundColor, false, 0); m_BackGroundColor = pPalette.Color; }
private void btn_Color_Click(object sender, EventArgs e) { ; m_BackGroundColor.RGB = 255; //新建一个颜色板对象 IColorPalette pPalette = new ColorPaletteClass(); //定义一个范围结构 tagRECT pRect = new tagRECT(); pRect.left = 10; pRect.top = 10; pPalette.TrackPopupMenu(ref pRect, m_BackGroundColor, false, 0); //获得新的颜色 m_BackGroundColor = pPalette.Color; PreviewImage(); }
protected override void OnClick(EventArgs e) { base.OnClick(e); tagRECT rect = new tagRECT(); GetWindowRect(this.Handle, ref rect); IColorPalette pColorPalette = new ColorPaletteClass(); IColor pInColor = new RgbColorClass(); pInColor.Transparency = 255; if (m_IsNoColor == true) pInColor.NullColor = true; else { if (m_ESRIColor == null) pInColor.RGB = ConvertSystemColorToESRIColor(m_SystemColor.ToArgb()); else { pInColor.RGB = m_ESRIColor.RGB; } } bool bSelectColor = false; bSelectColor = pColorPalette.TrackPopupMenu(ref rect, pInColor, false, this.Handle.ToInt32()); if (bSelectColor == true) { m_ESRIColor = pColorPalette.Color; if (m_ESRIColor.NullColor != true) { m_IsNoColor = false; m_SystemColor = Color.FromArgb(ConvertSystemColorToESRIColor(m_ESRIColor.RGB)); } else { m_IsNoColor = true; m_SystemColor = this.BackColor; } Invalidate(); } }
private IColor GetColorByColorPalette(int left, int top) { IColor pColor; pColor = new RgbColorClass(); pColor.RGB = 255; IColorPalette pPalette; pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = left; pRect.top = top; pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); pColor = pPalette.Color; return(pColor); }
private IColor GetColorByColorPalette(int left, int top) { IColor pColor; pColor = new RgbColorClass(); pColor.RGB = 255; try { IColorPalette pPalette; pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = left; pRect.top = top; pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); pColor = pPalette.Color; return pColor; } catch (Exception ex) { MessageBox.Show(ex.Message); return pColor; } }
private IColor GetColorByColorPalette(int left, int top) { IColor pColor; pColor = new RgbColorClass(); pColor.RGB = 255; IColorPalette pPalette; pPalette = new ColorPaletteClass(); tagRECT pRect = new tagRECT(); pRect.left = left; pRect.top = top; pPalette.TrackPopupMenu(ref pRect, pColor, false, 0); pColor = pPalette.Color; return pColor; }