Imported Upstream version 5.10.0.47

Former-commit-id: d0813289fa2d35e1f8ed77530acb4fb1df441bc0
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-01-24 17:04:36 +00:00
parent 88ff76fe28
commit e46a49ecf1
5927 changed files with 226314 additions and 129848 deletions

View File

@ -39,28 +39,30 @@ using System.Reflection;
using System.Resources;
namespace System.Windows.Forms {
internal sealed class Locale {
//#region Local Variables
//private static ResourceManager rm;
//#endregion // Local Variables
internal static class Locale {
#region Local Variables
private static ResourceManager rm;
#endregion // Local Variables
//#region Constructors
//static Locale () {
// rm = new ResourceManager("System.Windows.Forms", Assembly.GetExecutingAssembly());
//}
//#endregion
#region Constructors
static Locale () {
rm = new ResourceManager("System.Windows.Forms", Assembly.GetExecutingAssembly());
}
#endregion
//#region Static Properties
//public static ResourceManager ResourceManager {
// get {
// return rm;
// }
//}
//#endregion // Static Properties
#region Static Properties
public static ResourceManager ResourceManager {
get {
return rm;
}
}
#endregion // Static Properties
#region Static Methods
public static string GetText (string msg){
public static string GetText (string msg) {
string ret = ResourceManager.GetString (msg);
if (ret != null)
return ret;
return msg;
// string ret;
@ -74,8 +76,7 @@ namespace System.Windows.Forms {
// return msg;
}
public static string GetText (string msg, params object [] args)
{
public static string GetText (string msg, params object [] args) {
return String.Format (GetText (msg), args);
}

View File

@ -14,7 +14,8 @@ LIB_MCS_FLAGS += /define:GENERATING_RESOURCES
endif
RESX_RESOURCES = \
resources/keyboards.resources
resources/keyboards.resources \
resources/System.Windows.Forms.resources
CLEAN_FILES += $(RESX_RESOURCES)
@ -134,4 +135,4 @@ simple-test.exe: Test/simple/Program.cs $(topdir)/class/lib/$(PROFILE)/System.Wi
$(CSCOMPILE) -out:$@ Test/simple/Program.cs -r:$(topdir)/class/lib/$(PROFILE)/System.Windows.Forms.dll
test-simple: simple-test.exe
$(TEST_RUNTIME) simple-test.exe
$(TEST_RUNTIME) $(TEST_RUNTIME_FLAGS) simple-test.exe

View File

@ -7,6 +7,7 @@
-resource:resources/DnDLink.cur,System.Windows.Forms.DnDLink.cur
-resource:resources/DnDMove.cur,System.Windows.Forms.DnDMove.cur
-resource:resources/keyboards.resources
-resource:resources/System.Windows.Forms.resources
-resource:resources/16_computer.png
-resource:resources/32_computer.png
-resource:resources/computer.png

View File

@ -1 +1 @@
3ce4ab7b5741a9728bb3e05cf1ee6e332633f94e
a4a747537c315e0839c50ad99dd26b90eb018d34

View File

@ -432,6 +432,32 @@ namespace System.Windows.Forms {
[EditorBrowsable (EditorBrowsableState.Advanced)]
public virtual DataGridViewAdvancedBorderStyle AdjustCellBorderStyle (DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStyleInput, DataGridViewAdvancedBorderStyle dataGridViewAdvancedBorderStylePlaceholder, bool singleVerticalBorderAdded, bool singleHorizontalBorderAdded, bool isFirstDisplayedColumn, bool isFirstDisplayedRow) {
if (dataGridViewAdvancedBorderStyleInput.All == DataGridViewAdvancedCellBorderStyle.Single) {
dataGridViewAdvancedBorderStylePlaceholder.Left = (isFirstDisplayedColumn && singleVerticalBorderAdded) ? DataGridViewAdvancedCellBorderStyle.Single : DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Right = DataGridViewAdvancedCellBorderStyle.Single;
dataGridViewAdvancedBorderStylePlaceholder.Top = (isFirstDisplayedRow && singleHorizontalBorderAdded)? DataGridViewAdvancedCellBorderStyle.Single : DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Bottom = DataGridViewAdvancedCellBorderStyle.Single;
return dataGridViewAdvancedBorderStylePlaceholder;
}
if ((dataGridViewAdvancedBorderStyleInput.All == DataGridViewAdvancedCellBorderStyle.NotSet) && (DataGridView != null) && (DataGridView.AdvancedCellBorderStyle == dataGridViewAdvancedBorderStyleInput)) {
if (DataGridView.CellBorderStyle == DataGridViewCellBorderStyle.SingleVertical) {
dataGridViewAdvancedBorderStylePlaceholder.Left = (isFirstDisplayedColumn && singleVerticalBorderAdded) ? DataGridViewAdvancedCellBorderStyle.Single : DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Right = DataGridViewAdvancedCellBorderStyle.Single;
dataGridViewAdvancedBorderStylePlaceholder.Top = DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Bottom = DataGridViewAdvancedCellBorderStyle.None;
return dataGridViewAdvancedBorderStylePlaceholder;
}
if (DataGridView.CellBorderStyle == DataGridViewCellBorderStyle.SingleHorizontal) {
dataGridViewAdvancedBorderStylePlaceholder.Left = DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Right = DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Top = (isFirstDisplayedRow && singleHorizontalBorderAdded)? DataGridViewAdvancedCellBorderStyle.Single : DataGridViewAdvancedCellBorderStyle.None;
dataGridViewAdvancedBorderStylePlaceholder.Bottom = DataGridViewAdvancedCellBorderStyle.Single;
return dataGridViewAdvancedBorderStylePlaceholder;
}
}
return dataGridViewAdvancedBorderStyleInput;
}
@ -1166,62 +1192,167 @@ namespace System.Windows.Forms {
PaintErrorIcon (graphics, clipBounds, cellBounds, ErrorText);
}
private void PaintDividers (Graphics graphics, ref Rectangle bounds, DataGridViewAdvancedBorderStyle advancedBorderStyle)
{
// Paint the vertical divider
int dividerWidth = OwningColumn != null ? OwningColumn.DividerWidth : 0;
if (dividerWidth > 0) {
if (dividerWidth > bounds.Width)
dividerWidth = bounds.Width;
Color color;
switch (advancedBorderStyle.Right) {
case DataGridViewAdvancedCellBorderStyle.Single:
color = DataGridView.GridColor;
break;
case DataGridViewAdvancedCellBorderStyle.Inset:
color = SystemColors.ControlLightLight;
break;
default:
color = SystemColors.ControlDark;
break;
}
graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color), bounds.Right - dividerWidth, bounds.Y, dividerWidth, bounds.Height);
bounds.Width -= dividerWidth;
if (bounds.Width <= 0)
return;
}
dividerWidth = OwningRow != null ? OwningRow.DividerHeight : 0;
if (dividerWidth > 0) {
if (dividerWidth > bounds.Height)
dividerWidth = bounds.Height;
Color color;
switch (advancedBorderStyle.Bottom) {
case DataGridViewAdvancedCellBorderStyle.Single:
color = DataGridView.GridColor;
break;
case DataGridViewAdvancedCellBorderStyle.Inset:
color = SystemColors.ControlLightLight;
break;
default:
color = SystemColors.ControlDark;
break;
}
graphics.FillRectangle (ThemeEngine.Current.ResPool.GetSolidBrush (color), bounds.X, bounds.Bottom - dividerWidth, bounds.Width, dividerWidth);
bounds.Height -= dividerWidth;
}
}
protected virtual void PaintBorder (Graphics graphics, Rectangle clipBounds, Rectangle bounds, DataGridViewCellStyle cellStyle, DataGridViewAdvancedBorderStyle advancedBorderStyle)
{
Pen pen = new Pen (DataGridView.GridColor);
PaintDividers(graphics, ref bounds, advancedBorderStyle);
if (bounds.Height <= 0 || bounds.Width <= 0)
return;
if (advancedBorderStyle.All == DataGridViewAdvancedCellBorderStyle.None)
return;
Pen penGrid = ThemeEngine.Current.ResPool.GetPen (DataGridView.GridColor);
CPColor cpColor = ThemeEngine.Current.ResPool.GetCPColor (cellStyle.BackColor);
Pen penDark = ThemeEngine.Current.ResPool.GetPen (cpColor.Dark);
Pen penLight = ThemeEngine.Current.ResPool.GetPen (cpColor.LightLight);
int left = bounds.X;
int right = bounds.Right - 1;
int top = bounds.Y;
int bottom = bounds.Bottom - 1;
// Paint the left border, if any
switch (advancedBorderStyle.Left) {
case DataGridViewAdvancedCellBorderStyle.Single:
if (DataGridView.CellBorderStyle != DataGridViewCellBorderStyle.Single)
graphics.DrawLine (pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
graphics.DrawLine (penGrid, left, top, left, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.Outset:
case DataGridViewAdvancedCellBorderStyle.Inset:
graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
graphics.DrawLine (penLight, left, top, left, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.Inset:
graphics.DrawLine (penDark, left, top, left, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.InsetDouble:
graphics.DrawLine(penLight, left, top, left, bottom);
graphics.DrawLine(penDark, left + 1, (advancedBorderStyle.Top != DataGridViewAdvancedCellBorderStyle.None)? top + 1 : top, left + 1, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X, bounds.Y + bounds.Height - 1);
graphics.DrawLine(pen, bounds.X + 2, bounds.Y, bounds.X + 2, bounds.Y + bounds.Height - 1);
graphics.DrawLine(penDark, left, top, left, bottom);
graphics.DrawLine(penLight, left + 1, (advancedBorderStyle.Top != DataGridViewAdvancedCellBorderStyle.None)? top + 1 : top, left + 1, bottom);
break;
}
// Paint the right border, if any
switch (advancedBorderStyle.Right) {
case DataGridViewAdvancedCellBorderStyle.Single:
graphics.DrawLine(pen, bounds.X + bounds.Width - 1, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
graphics.DrawLine(penGrid, right, top, right, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.Outset:
graphics.DrawLine (penDark, right, top, right, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.Inset:
graphics.DrawLine (penLight, right, top, right, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.InsetDouble:
graphics.DrawLine (penLight, right - 1, top, right - 1, bottom);
graphics.DrawLine (penDark, right, (advancedBorderStyle.Top != DataGridViewAdvancedCellBorderStyle.None)? top + 1 : top, right, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
graphics.DrawLine(pen, bounds.X + bounds.Width, bounds.Y, bounds.X + bounds.Width, bounds.Y + bounds.Height - 1);
graphics.DrawLine (penDark, right - 1, top, right - 1, bottom);
graphics.DrawLine (penLight, right, (advancedBorderStyle.Top != DataGridViewAdvancedCellBorderStyle.None)? top + 1 : top, right, bottom);
break;
}
// Paint the top border, if any
switch (advancedBorderStyle.Top) {
case DataGridViewAdvancedCellBorderStyle.Single:
if (DataGridView.CellBorderStyle != DataGridViewCellBorderStyle.Single)
graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y);
graphics.DrawLine(penGrid, left, top, right, top);
break;
case DataGridViewAdvancedCellBorderStyle.Outset:
case DataGridViewAdvancedCellBorderStyle.Inset:
case DataGridViewAdvancedCellBorderStyle.Outset: {
int _left = (advancedBorderStyle.Left == DataGridViewAdvancedCellBorderStyle.InsetDouble) || (advancedBorderStyle.Left == DataGridViewAdvancedCellBorderStyle.OutsetDouble) ? left + 1 : left;
int _right = (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.Inset) || (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.Outset) ? right - 1 : right;
graphics.DrawLine (penLight, _left, top, _right, top);
} break;
case DataGridViewAdvancedCellBorderStyle.Inset: {
int _left = (advancedBorderStyle.Left == DataGridViewAdvancedCellBorderStyle.InsetDouble) || (advancedBorderStyle.Left == DataGridViewAdvancedCellBorderStyle.OutsetDouble) ? left + 1 : left;
int _right = (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.Inset) || (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.Outset) ? right - 1 : right;
graphics.DrawLine (penDark, _left, top, _right, top);
} break;
case DataGridViewAdvancedCellBorderStyle.InsetDouble:
graphics.DrawLine(penLight, left, top, right, top);
graphics.DrawLine(penDark, (advancedBorderStyle.Left != DataGridViewAdvancedCellBorderStyle.None)? left + 1 : left, top + 1,
(advancedBorderStyle.Right != DataGridViewAdvancedCellBorderStyle.None)? right -1 : right, top + 1);
break;
case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
graphics.DrawLine(pen, bounds.X, bounds.Y, bounds.X + bounds.Width - 1, bounds.Y);
graphics.DrawLine(penDark, left, top, right, top);
graphics.DrawLine(penLight, (advancedBorderStyle.Left != DataGridViewAdvancedCellBorderStyle.None)? left + 1 : left, top + 1,
(advancedBorderStyle.Right != DataGridViewAdvancedCellBorderStyle.None)? right - 1 : right, top + 1);
break;
}
// Paint the bottom border, if any
switch (advancedBorderStyle.Bottom) {
case DataGridViewAdvancedCellBorderStyle.Outset:
case DataGridViewAdvancedCellBorderStyle.Inset:
case DataGridViewAdvancedCellBorderStyle.Single:
case DataGridViewAdvancedCellBorderStyle.InsetDouble:
case DataGridViewAdvancedCellBorderStyle.OutsetDouble:
graphics.DrawLine(pen, bounds.X, bounds.Y + bounds.Height - 1, bounds.X + bounds.Width - 1, bounds.Y + bounds.Height - 1);
graphics.DrawLine(penGrid, left, bottom, right, bottom);
break;
case DataGridViewAdvancedCellBorderStyle.Outset: {
int _right = (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.InsetDouble) || (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.OutsetDouble) ? right - 1 : right;
graphics.DrawLine (penDark, left, bottom, _right, bottom);
} break;
case DataGridViewAdvancedCellBorderStyle.Inset:
graphics.DrawLine(penLight, left, bottom, (advancedBorderStyle.Right == DataGridViewAdvancedCellBorderStyle.InsetDouble)? right - 1: right, bottom);
break;
}
}

View File

@ -46,7 +46,6 @@ namespace System.Windows.Forms
public DataGridViewRow ()
{
cells = new DataGridViewCellCollection(this);
minimumHeight = 3;
height = -1;
explicit_height = -1;
@ -64,7 +63,11 @@ namespace System.Windows.Forms
[Browsable (false)]
[DesignerSerializationVisibility (DesignerSerializationVisibility.Content)]
public DataGridViewCellCollection Cells {
get { return cells; }
get {
if (cells == null)
cells = CreateCellsInstance ();
return cells;
}
}
[DefaultValue (null)]
@ -356,10 +359,10 @@ namespace System.Windows.Forms
row.HeaderCell = (DataGridViewRowHeaderCell)HeaderCell.Clone ();
row.SetIndex (-1);
row.cells = new DataGridViewCellCollection (row);
row.cells = null;
foreach (DataGridViewCell cell in cells)
row.cells.Add (cell.Clone () as DataGridViewCell);
foreach (DataGridViewCell cell in Cells)
row.Cells.Add (cell.Clone () as DataGridViewCell);
row.SetDataGridView (null);
@ -374,14 +377,13 @@ namespace System.Windows.Forms
if (dataGridView.Rows.Contains(this)) {
throw new InvalidOperationException("The row already exists in the DataGridView.");
}
DataGridViewCellCollection newCellCollection = new DataGridViewCellCollection(this);
Cells.Clear ();
foreach (DataGridViewColumn column in dataGridView.Columns) {
if (column.CellTemplate == null) {
throw new InvalidOperationException("Cell template not set in column: " + column.Index.ToString() + ".");
}
newCellCollection.Add((DataGridViewCell) column.CellTemplate.Clone());
Cells.Add((DataGridViewCell) column.CellTemplate.Clone());
}
cells = newCellCollection;
}
public void CreateCells (DataGridView dataGridView, params object[] values)
@ -391,7 +393,7 @@ namespace System.Windows.Forms
}
CreateCells(dataGridView);
for (int i = 0; i < values.Length; i++) {
cells[i].Value = values[i];
Cells[i].Value = values[i];
}
}
@ -482,11 +484,11 @@ namespace System.Windows.Forms
/////// COLUMNAS //////////
for (int i = 0; i < values.Length; i++) {
DataGridViewCell cell;
if (cells.Count > i) {
cell = cells [i];
if (Cells.Count > i) {
cell = Cells [i];
} else {
cell = new DataGridViewTextBoxCell ();
cells.Add (cell);
Cells.Add (cell);
}
cell.Value = values[i];
}
@ -508,8 +510,7 @@ namespace System.Windows.Forms
[EditorBrowsable (EditorBrowsableState.Advanced)]
protected virtual DataGridViewCellCollection CreateCellsInstance ()
{
cells = new DataGridViewCellCollection(this);
return cells;
return new DataGridViewCellCollection(this);
}
[EditorBrowsable (EditorBrowsableState.Advanced)]
@ -556,6 +557,9 @@ namespace System.Windows.Forms
bounds.X += DataGridView.RowHeadersWidth;
bounds.Width -= DataGridView.RowHeadersWidth;
}
bool singleVerticalBorderAdded = !DataGridView.RowHeadersVisible;
bool singleHorizontalBorderAdded = !DataGridView.ColumnHeadersVisible;
for (int i = DataGridView.first_col_index; i < sortedColumns.Count; i++) {
DataGridViewColumn col = sortedColumns[i];
@ -592,7 +596,7 @@ namespace System.Windows.Forms
}
DataGridViewAdvancedBorderStyle intermediateBorderStyle = (DataGridViewAdvancedBorderStyle)((ICloneable)DataGridView.AdvancedCellBorderStyle).Clone ();
DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle (DataGridView.AdvancedCellBorderStyle, intermediateBorderStyle, true, true, cell.ColumnIndex == 0, cell.RowIndex == 0);
DataGridViewAdvancedBorderStyle borderStyle = cell.AdjustCellBorderStyle (DataGridView.AdvancedCellBorderStyle, intermediateBorderStyle, singleVerticalBorderAdded, singleHorizontalBorderAdded, cell.ColumnIndex == 0, cell.RowIndex == 0);
DataGridView.OnCellFormattingInternal (new DataGridViewCellFormattingEventArgs (cell.ColumnIndex, cell.RowIndex, value, cell.FormattedValueType, style));
@ -614,7 +618,7 @@ namespace System.Windows.Forms
{
base.SetDataGridView(dataGridView);
headerCell.SetDataGridView(dataGridView);
foreach (DataGridViewCell cell in cells)
foreach (DataGridViewCell cell in Cells)
cell.SetDataGridView (dataGridView);
}

View File

@ -211,17 +211,30 @@ namespace System.Windows.Forms {
flags |= AlignmentToFlags (cellStyle.Alignment);
Rectangle contentbounds = cellBounds;
contentbounds.Height -= 2;
contentbounds.Width -= 2;
// If we are top aligned, give ourselves some padding from the top
if (((int)cellStyle.Alignment & 7) > 0) {
contentbounds.Offset (0, 2);
contentbounds.Height -= 2;
//Border widths
Rectangle borderWidths = BorderWidths(advancedBorderStyle);
contentbounds.Offset(borderWidths.X, borderWidths.Y);
contentbounds.Width -= borderWidths.Right;
contentbounds.Height -= borderWidths.Bottom;
//Padding
if (cellStyle.Padding != Padding.Empty)
{
contentbounds.Offset(cellStyle.Padding.Left, cellStyle.Padding.Top);
contentbounds.Width -= cellStyle.Padding.Horizontal;
contentbounds.Height -= cellStyle.Padding.Vertical;
}
if (formattedValue != null)
const int textTopAdditionalPadding = 1;
const int textBottomAdditionalPadding = 2;
const int textLeftAdditionalPadding = 0;
const int textRightAdditionalPadding = 2;
contentbounds.Offset (textLeftAdditionalPadding, textTopAdditionalPadding);
contentbounds.Width -= textLeftAdditionalPadding + textRightAdditionalPadding;
contentbounds.Height -= textTopAdditionalPadding + textBottomAdditionalPadding;
if (formattedValue != null && contentbounds.Width > 0 && contentbounds.Height > 0)
TextRenderer.DrawText (graphics, formattedValue.ToString (), cellStyle.Font, contentbounds, color, flags);
}

View File

@ -1 +1 @@
d0223334e7d6018247664ecadbc0bb7d04241204
ef65c5b54b4bc8c52fb1c210031b3f1641bba8d9

View File

@ -1029,11 +1029,15 @@ namespace System.Windows.Forms {
// Handle arrow keys
protected override bool IsInputKey (Keys keyData) {
switch (keyData) {
switch (keyData & ~Keys.Shift) {
case Keys.Up:
case Keys.Down:
case Keys.Right:
case Keys.Left:
case Keys.PageUp:
case Keys.PageDown:
case Keys.Home:
case Keys.End:
return true;
default:
break;
@ -1299,15 +1303,23 @@ namespace System.Windows.Forms {
internal DateTime CurrentMonth {
set {
// only interested in if the month (not actual date) has change
if (value < MinDate || value > MaxDate) {
if (value < new DateTime(MinDate.Year, MinDate.Month, 1) || value > MaxDate) {
return;
}
if (value.Month != current_month.Month ||
value.Year != current_month.Year) {
this.SelectionRange = new SelectionRange(
this.SelectionStart.Add(value.Subtract(current_month)),
this.SelectionEnd.Add(value.Subtract(current_month)));
DateTime start = this.SelectionStart.Add(value.Subtract(current_month));
if (start < MinDate)
start = MinDate;
else if (start > MaxDate)
start = MaxDate;
DateTime end = this.SelectionEnd.Add (value.Subtract (current_month));
if (end < MinDate)
end = MinDate;
else if (end > MaxDate)
end = MaxDate;
this.SelectionRange = new SelectionRange (start, end);
current_month = value;
UpdateBoldedDates();
this.Invalidate();
@ -1574,6 +1586,12 @@ namespace System.Windows.Forms {
}
}
// validate range
if (range.Start < MinDate)
range.Start = MinDate;
if (range.End > MaxDate)
range.End = MaxDate;
// Avoid re-setting SelectionRange to the same value and fire an extra DateChanged event
if (range.Start != selection_range.Start || range.End != selection_range.End)
SelectionRange = range;
@ -1581,6 +1599,8 @@ namespace System.Windows.Forms {
// attempts to add the date to the selection without throwing exception
private void SelectDate (DateTime date) {
if (date < MinDate || date > MaxDate)
return;
// try and add the new date to the selction range
SelectionRange range = null;
if (is_shift_pressed || (click_state [0])) {
@ -1594,14 +1614,12 @@ namespace System.Windows.Forms {
}
}
} else {
if (date >= MinDate && date <= MaxDate) {
range = new SelectionRange (date, date);
first_select_start_date = date;
}
range = new SelectionRange (date, date);
first_select_start_date = date;
}
// Only set if we re actually getting a different range (avoid an extra DateChanged event)
if (range != null && range.Start != selection_range.Start || range.End != selection_range.End)
if (range.Start != selection_range.Start || range.End != selection_range.End)
SelectionRange = range;
}
@ -1723,7 +1741,10 @@ namespace System.Windows.Forms {
// called when today context menu is clicked
private void TodayMenuItemClickHandler (object sender, EventArgs e)
{
this.SetSelectionRange (DateTime.Now.Date, DateTime.Now.Date);
DateTime date = DateTime.Now.Date;
if (date < MinDate || date > MaxDate)
return;
this.SetSelectionRange (date, date);
this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
}
@ -2010,10 +2031,14 @@ namespace System.Windows.Forms {
ShowYearUpDown = true;
}
break;
case HitArea.TodayLink:
this.SetSelectionRange (DateTime.Now.Date, DateTime.Now.Date);
this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
case HitArea.TodayLink: {
DateTime date = DateTime.Now.Date;
if (date >= MinDate && date <= MaxDate) {
this.SetSelectionRange (date, date);
this.OnDateSelected (new DateRangeEventArgs (SelectionStart, SelectionEnd));
}
break;
}
default:
this.is_previous_clicked = false;
this.is_next_clicked = false;
@ -2055,9 +2080,13 @@ namespace System.Windows.Forms {
if (date < first_select_start_date.AddDays ((MaxSelectionCount-1)*-1)) {
date = first_select_start_date.AddDays ((MaxSelectionCount-1)*-1);
}
if (date < MinDate)
date = MinDate;
this.SetSelectionRange (date, first_select_start_date);
} else {
DateTime date = GetFirstDateInMonth (this.SelectionStart);
if (date < MinDate)
date = MinDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2069,9 +2098,13 @@ namespace System.Windows.Forms {
if (date > first_select_start_date.AddDays (MaxSelectionCount-1)) {
date = first_select_start_date.AddDays (MaxSelectionCount-1);
}
if (date > MaxDate)
date = MaxDate;
this.SetSelectionRange (date, first_select_start_date);
} else {
DateTime date = GetLastDateInMonth (this.SelectionStart);
if (date > MaxDate)
date = MaxDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2082,6 +2115,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (-1, false);
} else {
DateTime date = this.SelectionStart.AddMonths (-1);
if (date < MinDate)
date = MinDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2092,6 +2127,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (1, false);
} else {
DateTime date = this.SelectionStart.AddMonths (1);
if (date > MaxDate)
date = MaxDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2102,6 +2139,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (-7, true);
} else {
DateTime date = this.SelectionStart.AddDays (-7);
if (date < MinDate)
date = MinDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2112,6 +2151,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (7, true);
} else {
DateTime date = this.SelectionStart.AddDays (7);
if (date > MaxDate)
date = MaxDate;
this.SetSelectionRange (date, date);
}
e.Handled = true;
@ -2122,7 +2163,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (-1, true);
} else {
DateTime date = this.SelectionStart.AddDays (-1);
this.SetSelectionRange (date, date);
if (date >= MinDate)
this.SetSelectionRange (date, date);
}
e.Handled = true;
break;
@ -2132,7 +2174,8 @@ namespace System.Windows.Forms {
this.AddTimeToSelection (1, true);
} else {
DateTime date = this.SelectionStart.AddDays (1);
this.SetSelectionRange (date, date);
if (date <= MaxDate)
this.SetSelectionRange (date, date);
}
e.Handled = true;
break;

View File

@ -38,12 +38,12 @@ namespace System.Windows.Forms {
{
form.SuspendLayout ();
form.Text = "Open";
form.Text = Locale.GetText("Open");
CheckFileExists = true;
OpenSaveButtonText = "Open";
SearchSaveLabel = "Look in:";
OpenSaveButtonText = Locale.GetText("Open");
SearchSaveLabel = Locale.GetText("Look in:");
fileDialogType = FileDialogType.OpenFileDialog;
form.ResumeLayout (false);
@ -139,7 +139,7 @@ namespace System.Windows.Forms {
get {
string title = base.DialogTitle;
if (title.Length == 0)
title = "Open";
title = Locale.GetText("Open");
return title;
}
}

View File

@ -39,11 +39,11 @@ namespace System.Windows.Forms {
{
form.SuspendLayout ();
form.Text = "Save As";
form.Text = Locale.GetText("Save As");
FileTypeLabel = "Save as type:";
OpenSaveButtonText = "Save";
SearchSaveLabel = "Save in:";
FileTypeLabel = Locale.GetText("Save as type:");
OpenSaveButtonText = Locale.GetText("Save");
SearchSaveLabel = Locale.GetText("Save in:");
fileDialogType = FileDialogType.SaveFileDialog;
form.ResumeLayout (false);
@ -103,7 +103,7 @@ namespace System.Windows.Forms {
get {
string title = base.DialogTitle;
if (title.Length == 0)
title = "Save As";
title = Locale.GetText("Save As");
return title;
}
}

View File

@ -450,6 +450,7 @@ namespace System.Windows.Forms {
document.PasswordChar = PasswordChar.ToString ();
else
document.PasswordChar = string.Empty;
this.CalculateDocument();
Invalidate ();
}
}
@ -504,6 +505,7 @@ namespace System.Windows.Forms {
document.PasswordChar = string.Empty;
}
this.CalculateDocument();
Invalidate();
}
}
}

View File

@ -408,5 +408,28 @@ namespace MonoTests.System.Windows.Forms {
Assert.AreEqual ("Helo", row2.Tag, "A8");
Assert.AreEqual (false, row2.Visible, "A9");
}
private class TestDataGridViewRow : DataGridViewRow
{
protected override DataGridViewCellCollection CreateCellsInstance ()
{
return new MockDataGridViewCellCollection (this);
}
}
private class MockDataGridViewCellCollection : DataGridViewCellCollection
{
public MockDataGridViewCellCollection(DataGridViewRow dataGridViewRow) : base(dataGridViewRow)
{
}
}
[Test]
public void CreateCellsInstance ()
{
var row = new TestDataGridViewRow ();
Assert.That (row.Cells, Is.TypeOf<MockDataGridViewCellCollection> (), "#A row.CreateCellsInstance");
}
}
}

View File

@ -0,0 +1,259 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used forserialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=1.0.5000.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<!-- System.Windows.Forms.Design/EventsTab.cs -->
<data name="Events">
<value>Events</value>
</data>
<!-- System.Windows.Forms.X11Internal/X11Display.cs -->
<data name="at">
<value>at</value>
</data>
<data name="&lt;unknown method&gt;" xml:space="preserve">
<value>&lt;unknown method&gt;</value>
</data>
<!-- System.Windows.Forms/BindingNavigator.cs -->
<data name="of {0}" xml:space="preserve">
<value>of {0}</value>
</data>
<data name="Move first" xml:space="preserve">
<value>Move first</value>
</data>
<data name="Move previous" xml:space="preserve">
<value>Move previous</value>
</data>
<data name="Current position" xml:space="preserve">
<value>Current position</value>
</data>
<data name="Total number of items" xml:space="preserve">
<value>Total number of items</value>
</data>
<data name="Move next" xml:space="preserve">
<value>Move next</value>
</data>
<data name="Move last" xml:space="preserve">
<value>Move last</value>
</data>
<data name="Add new" xml:space="preserve">
<value>Add new</value>
</data>
<!-- System.Windows.Forms/ColorDialog.cs -->
<data name="Red">
<value>Red</value>
</data>
<data name="Blue">
<value>Blue</value>
</data>
<data name="Green">
<value>Green</value>
</data>
<data name="Color">
<value>Color</value>
</data>
<data name="Hue">
<value>Hue</value>
</data>
<data name="Sat">
<value>Sat</value>
</data>
<data name="Bri">
<value>Bri</value>
</data>
<data name="Define Custom Colors &gt;&gt;" xml:space="preserve">
<value>Define Custom Colors &gt;&gt;</value>
</data>
<data name="Add To Custom Colors" xml:space="preserve">
<value>Add To Custom Colors</value>
</data>
<data name="Base Colors" xml:space="preserve">
<value>Base Colors</value>
</data>
<data name="User Colors" xml:space="preserve">
<value>User Colors</value>
</data>
<!-- System.Windows.Forms/ComboBox.cs -->
<data name="Enum argument value '{0}' is not valid for AutoCompleteMode" xml:space="preserve">
<value>Enum argument value '{0}' is not valid for AutoCompleteMode </value>
</data>
<data name="Enum argument value '{0}' is not valid for AutoCompleteSource" xml:space="preserve">
<value>Enum argument value '{0}' is not valid for AutoCompleteSource</value>
</data>
<!-- System.Windows.Forms/MessageBox.cs -->
<data name="OK">
<value>OK</value>
</data>
<data name="Retry">
<value>Retry</value>
</data>
<data name="Yes">
<value>Yes</value>
</data>
<data name="Cancel">
<value>Cancel</value>
</data>
<data name="Abort">
<value>Abort</value>
</data>
<data name="No">
<value>No</value>
</data>
<data name="Ignore">
<value>Ignore</value>
</data>
<data name="Help">
<value>Help</value>
</data>
<!-- System.Windows.Forms/PropertyGrid.cs -->
<data name="Categorized">
<value>Categorized</value>
</data>
<data name="Alphabetic">
<value>Alphabetic</value>
</data>
<!-- System.Windows.Forms/TextBox.cs -->
<data name="&amp;Undo">
<value>&amp;Undo</value>
</data>
<data name="Cu&amp;t">
<value>Cu&amp;t</value>
</data>
<data name="&amp;Copy">
<value>&amp;Copy</value>
</data>
<data name="&amp;Paste">
<value>&amp;Paste</value>
</data>
<data name="&amp;Delete">
<value>&amp;Delete</value>
</data>
<data name="Select &amp;All">
<value>Select &amp;All</value>
</data>
<data name="Enum argument value '{0}' is not valid for AutoCompleteMode" xml:space="preserve">
<value>Enum argument value '{0}' is not valid for AutoCompleteMode</value>
</data>
<data name="Enum argument value '{0}' is not valid for AutoCompleteSource" xml:space="preserve">
<value>Enum argument value '{0}' is not valid for AutoCompleteSource</value>
</data>
<!-- System.Windows.Forms/TextBoxBase.cs -->
<data name="Cut">
<value>Cut</value>
</data>
<data name="Delete">
<value>Delete</value>
</data>
<data name="Paste">
<value>Paste</value>
</data>
<!-- System.Windows.Forms/TextControl.cs -->
<data name="Typing">
<value>Typing</value>
</data>
</root>