mirror of
https://github.com/ShareX/ShareX.git
synced 2024-09-30 01:07:21 +13:00
Hide OK button in color picker, moved Copy all button to there instead
This commit is contained in:
parent
535332393f
commit
eebd1c33c9
7 changed files with 66 additions and 43 deletions
12
HelpersLib/Colors/DialogColor.Designer.cs
generated
12
HelpersLib/Colors/DialogColor.Designer.cs
generated
|
@ -83,9 +83,9 @@ private void InitializeComponent()
|
|||
// btnCancel
|
||||
//
|
||||
this.btnCancel.DialogResult = System.Windows.Forms.DialogResult.Cancel;
|
||||
this.btnCancel.Location = new System.Drawing.Point(536, 240);
|
||||
this.btnCancel.Location = new System.Drawing.Point(536, 232);
|
||||
this.btnCancel.Name = "btnCancel";
|
||||
this.btnCancel.Size = new System.Drawing.Size(64, 24);
|
||||
this.btnCancel.Size = new System.Drawing.Size(64, 32);
|
||||
this.btnCancel.TabIndex = 1;
|
||||
this.btnCancel.Text = "Cancel";
|
||||
this.btnCancel.UseVisualStyleBackColor = true;
|
||||
|
@ -93,9 +93,9 @@ private void InitializeComponent()
|
|||
//
|
||||
// btnOK
|
||||
//
|
||||
this.btnOK.Location = new System.Drawing.Point(464, 240);
|
||||
this.btnOK.Location = new System.Drawing.Point(464, 232);
|
||||
this.btnOK.Name = "btnOK";
|
||||
this.btnOK.Size = new System.Drawing.Size(64, 24);
|
||||
this.btnOK.Size = new System.Drawing.Size(64, 32);
|
||||
this.btnOK.TabIndex = 0;
|
||||
this.btnOK.Text = "OK";
|
||||
this.btnOK.UseVisualStyleBackColor = true;
|
||||
|
@ -608,8 +608,6 @@ private void InitializeComponent()
|
|||
|
||||
#endregion Windows Form Designer generated code
|
||||
|
||||
private System.Windows.Forms.Button btnCancel;
|
||||
private System.Windows.Forms.Button btnOK;
|
||||
private System.Windows.Forms.Label lblOld;
|
||||
private System.Windows.Forms.Label lblNew;
|
||||
private System.Windows.Forms.Label lblHex;
|
||||
|
@ -647,5 +645,7 @@ private void InitializeComponent()
|
|||
private MyPictureBox pbColorPreview;
|
||||
protected ColorPicker colorPicker;
|
||||
protected System.Windows.Forms.TextBox txtHex;
|
||||
protected System.Windows.Forms.Button btnCancel;
|
||||
protected System.Windows.Forms.Button btnOK;
|
||||
}
|
||||
}
|
13
ShareX/Forms/ScreenColorPicker.Designer.cs
generated
13
ShareX/Forms/ScreenColorPicker.Designer.cs
generated
|
@ -51,13 +51,12 @@ private void InitializeComponent()
|
|||
//
|
||||
// lblScreenColorPickerTip
|
||||
//
|
||||
this.lblScreenColorPickerTip.AutoSize = true;
|
||||
this.lblScreenColorPickerTip.Font = new System.Drawing.Font("Microsoft Sans Serif", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(162)));
|
||||
this.lblScreenColorPickerTip.Location = new System.Drawing.Point(408, 270);
|
||||
this.lblScreenColorPickerTip.Location = new System.Drawing.Point(336, 270);
|
||||
this.lblScreenColorPickerTip.Name = "lblScreenColorPickerTip";
|
||||
this.lblScreenColorPickerTip.Size = new System.Drawing.Size(193, 30);
|
||||
this.lblScreenColorPickerTip.Size = new System.Drawing.Size(265, 34);
|
||||
this.lblScreenColorPickerTip.TabIndex = 55;
|
||||
this.lblScreenColorPickerTip.Text = "Press Ctrl when this window active\r\nto stop screen color picker.";
|
||||
this.lblScreenColorPickerTip.Text = "Press \"Ctrl\" button when this window active\r\nto stop screen color picker.";
|
||||
this.lblScreenColorPickerTip.Visible = false;
|
||||
//
|
||||
// btnColorPicker
|
||||
|
@ -91,9 +90,9 @@ private void InitializeComponent()
|
|||
// btnCopyAll
|
||||
//
|
||||
this.btnCopyAll.ImageAlign = System.Drawing.ContentAlignment.MiddleLeft;
|
||||
this.btnCopyAll.Location = new System.Drawing.Point(336, 274);
|
||||
this.btnCopyAll.Location = new System.Drawing.Point(464, 232);
|
||||
this.btnCopyAll.Name = "btnCopyAll";
|
||||
this.btnCopyAll.Size = new System.Drawing.Size(64, 24);
|
||||
this.btnCopyAll.Size = new System.Drawing.Size(64, 32);
|
||||
this.btnCopyAll.TabIndex = 57;
|
||||
this.btnCopyAll.Text = "Copy all";
|
||||
this.btnCopyAll.UseVisualStyleBackColor = true;
|
||||
|
@ -137,6 +136,8 @@ private void InitializeComponent()
|
|||
this.Text = "ShareX - Screen color picker";
|
||||
this.TopMost = false;
|
||||
this.KeyDown += new System.Windows.Forms.KeyEventHandler(this.ScreenColorPicker_KeyDown);
|
||||
this.Controls.SetChildIndex(this.btnOK, 0);
|
||||
this.Controls.SetChildIndex(this.btnCancel, 0);
|
||||
this.Controls.SetChildIndex(this.txtHex, 0);
|
||||
this.Controls.SetChildIndex(this.colorPicker, 0);
|
||||
this.Controls.SetChildIndex(this.lblX, 0);
|
||||
|
|
|
@ -33,29 +33,15 @@ You should have received a copy of the GNU General Public License
|
|||
|
||||
namespace ShareX
|
||||
{
|
||||
public class PointInfo
|
||||
{
|
||||
public Point Position { get; set; }
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
|
||||
public partial class ScreenColorPicker : DialogColor
|
||||
{
|
||||
private Timer colorTimer = new Timer { Interval = 10 };
|
||||
private SurfaceOptions surfaceOptions;
|
||||
|
||||
public ScreenColorPicker(TaskSettings taskSettings)
|
||||
public ScreenColorPicker()
|
||||
{
|
||||
if (taskSettings != null)
|
||||
{
|
||||
surfaceOptions = taskSettings.CaptureSettings.SurfaceOptions;
|
||||
}
|
||||
else
|
||||
{
|
||||
surfaceOptions = new SurfaceOptions();
|
||||
}
|
||||
|
||||
InitializeComponent();
|
||||
btnOK.Visible = false;
|
||||
btnCancel.Text = "Close";
|
||||
colorPicker.DrawCrosshair = true;
|
||||
colorTimer.Tick += colorTimer_Tick;
|
||||
|
||||
|
@ -115,7 +101,6 @@ private void UpdateControls(bool colorTimerEnable)
|
|||
}
|
||||
|
||||
lblScreenColorPickerTip.Visible = colorTimerEnable;
|
||||
|
||||
TopMost = colorTimerEnable;
|
||||
}
|
||||
|
||||
|
@ -135,7 +120,7 @@ private void btnPipette_Click(object sender, EventArgs e)
|
|||
Hide();
|
||||
Thread.Sleep(250);
|
||||
|
||||
PointInfo pointInfo = TaskHelpers.SelectPointColor(surfaceOptions);
|
||||
PointInfo pointInfo = TaskHelpers.SelectPointColor();
|
||||
|
||||
if (pointInfo != null)
|
||||
{
|
||||
|
|
|
@ -112,9 +112,9 @@
|
|||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
39
ShareX/PointInfo.cs
Normal file
39
ShareX/PointInfo.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
#region License Information (GPL v3)
|
||||
|
||||
/*
|
||||
ShareX - A program that allows you to take screenshots and share any file type
|
||||
Copyright (C) 2007-2014 ShareX Developers
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to the Free Software
|
||||
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||
|
||||
Optionally you can also view the license at <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#endregion License Information (GPL v3)
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace ShareX
|
||||
{
|
||||
public class PointInfo
|
||||
{
|
||||
public Point Position { get; set; }
|
||||
public Color Color { get; set; }
|
||||
}
|
||||
}
|
|
@ -221,6 +221,7 @@
|
|||
<DependentUpon>MainForm.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="ImageTag.cs" />
|
||||
<Compile Include="PointInfo.cs" />
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
|
|
@ -361,18 +361,15 @@ public static bool SelectRegion(out Rectangle rect)
|
|||
|
||||
public static PointInfo SelectPointColor(SurfaceOptions surfaceOptions = null)
|
||||
{
|
||||
if (surfaceOptions == null)
|
||||
{
|
||||
surfaceOptions = new SurfaceOptions();
|
||||
}
|
||||
|
||||
using (Image fullscreen = Screenshot.CaptureFullscreen())
|
||||
using (RectangleRegion surface = new RectangleRegion(fullscreen))
|
||||
{
|
||||
if (surfaceOptions != null)
|
||||
{
|
||||
surface.Config = new SurfaceOptions
|
||||
{
|
||||
MagnifierPixelCount = surfaceOptions.MagnifierPixelCount,
|
||||
MagnifierPixelSize = surfaceOptions.MagnifierPixelSize
|
||||
};
|
||||
}
|
||||
|
||||
surface.Config = surfaceOptions;
|
||||
surface.OneClickMode = true;
|
||||
surface.Prepare();
|
||||
surface.ShowDialog();
|
||||
|
@ -506,7 +503,7 @@ public static void OpenScreenColorPicker(TaskSettings taskSettings = null)
|
|||
{
|
||||
if (taskSettings == null) taskSettings = TaskSettings.GetDefaultTaskSettings();
|
||||
|
||||
new ScreenColorPicker(taskSettings).Show();
|
||||
new ScreenColorPicker().Show();
|
||||
}
|
||||
|
||||
public static void OpenRuler()
|
||||
|
|
Loading…
Reference in a new issue