826 Commits
Author SHA1 Message Date
abrevet-dev 8683fa6db7 [WinForms] Fix #10559 In MaskedTextBox wrong Lines value when Mask setted (#17660)
[WinForms] Fix #10559 In MaskedTextBox wrong Lines value when Mask se…





<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
2019-11-12 01:55:53 +01:00
abrevet-dev 2b4801d9f1 [WinForms]: Fix #17546 Fix TabPage position when enabling MultiLine (#17670)
[WinForms] Fix TabPage position when enabling MultiLine

Fixes #17546
2019-11-12 00:15:51 +01:00
abrevet-dev 61811075ca [WinForms]: Fix #16632 special values (-1 and -2) of ListView Column header Width was not handled when using List.View. (#17669) 2019-11-11 23:00:45 +01:00
abrevet-dev 9eb0bcae57 [WinForms] Fix #12249 scroll orientation was not defined in ScrollEventArgs (#17662)
* [WinForms] Fix #12249 scroll orientation was not defined in ScrollEventArgs of ScrollBar.cs

* [WinForms] Fix 12249 scroll orientation was not defined in ScrollEventArgs of DataGridView.cs
2019-11-11 22:59:53 +01:00
abrevet-dev 6b3aa3a05b [WinForms] Change HotkeyPrefix default value in TabControlPainter.cs (#17579)
The default behavior on .NET Framework is _HotkeyPrefix.None_ when creating a _TabControl_ element (ampersands not escaped). 
If an user wants to override this behavior, he has to declare a _DrawItemEventHandler_ (with _DrawMode = OwnerDrawFixed_).

Fixes #16206
2019-10-31 13:48:12 +01:00
Leonard 4ec9bd03e5 Fixes #17190: SerializationException on ListViewItemCount (#17195)
* Fix issue #17190: SerializationException on ListViewItemCount

ListViewGroup doesn't (always) have a serialized member "ListViewItemCount".

This patch accounts for that and also adds support for the "ItemsCount"
property that upstream [1] seems to use.

Also items should be initialized regardless of the count, otherwise we get a NPE.

[1] https://github.com/dotnet/winforms/blob/master/src/System.Windows.Forms/src/System/Windows/Forms/ListViewGroup.cs#L144
2019-10-25 19:30:08 +02:00
Александр Хухлаев f91b64d9ad [WinForms] fix #16626 ControlBox property didn`t hide Close button and icon when set to false (#16627) 2019-09-17 14:26:05 -07:00
Nikita Voronchev 94797b95d6 [WinForms] Fix UIA event on node insertions into a TreeView object (#16559)
The UIA event doesn't emited by means of insertion a new `TreeNode` to a `TreeNodeCollection` of the respective `TreeNode`.
2019-08-30 18:29:18 +02:00
UnknownShadow200 69ebdd8b93 [WinForms] Fix NotifyIcon not showing in systray on 64bit linux (#16164)
https://bugzilla.xamarin.com/show_bug.cgi?id=14976

Credit goes to datnhanlz for noting that removing XChangeProperty(DisplayHandle, hwnd.whole_window, _XEMBED_INFO, _XEMBED_INFO, 32, PropertyMode.Replace, atoms, 2); would also fix the bug. 

Note that the type of Atom is actually unsigned long (see usr/include/X11/X.h), however the code used a C# int for the atoms. As such the code worked without a problem on 32 bit linux, but broke on 64 bit linux.

I switched to using IntPtr instead to make the code also work on 64-bit.
2019-08-12 16:09:08 +02:00
Nikita Voronchev c30a10bc3e [System.Windows.Forms] Fix crash of DataGridView in case of assigning a custom Column Header (#15135) 2019-06-24 21:51:47 -04:00
Steve Pfister d607506055 Merge pull request #14325 from HebaruSan/fix/listviewgroup-forecolor
Fix light on light ListViewGroup headers on dark theme
2019-05-30 22:05:37 -04:00
Alexander Köplinger 07c58ee2ed [bcl] Write newline-separated nunit/xunit excludes file for sdks archive (#14681)
During XI integration we noticed that just using the verbatim commandline
-exclude or -notrait is not ideal since XI uses the nunit/xunit APIs to
pass that information and not the command line parser.

Instead we now write the exclude categories/traits as a newline-separated file.
2019-05-28 18:49:26 +02:00
Alexander Köplinger 9606a8f180 [bcl] Remove usages of mono-project.com/go-mono.com/google.com in tests (#14586)
Use example.com and example.org instead.

Fixes https://github.com/mono/mono/issues/14585

Note that not all of the things I replaced make an actual network request but I thought it'd be nice to be consistent.
2019-05-23 14:12:14 +02:00
sancheolz 3e51e7d222 [WinForms] fix EditingCellFormattedValue getter and setter for bool value (#13845)
* [WinForms] If DataGridViewCheckBoxCell not in threeState mode
EditingCellFormattedValue must return true or false, instead of
value of CheckState type

* [WinForms] DataGrid: fix type check in EditingCellFormattedValue setter.
When set bool value to EditingCellFormattedValue there will be exception.
Type equality must be done through IsAssignableFrom not direct

* [WinForms] DataGrid: Add test for EditingCellFormattedValue getter and setter.
2019-05-06 15:11:49 +02:00
Paul Hebble 955faeac52 Fix light on light ListViewGroup headers on dark theme 2019-05-02 22:16:06 -05:00
Friedrich von Never c9c50f85f4 Fix #14255: correct type and bitness for TARGETS request of X11 clipboard 2019-05-02 14:23:02 +02:00
sancheolz 4eb4173b57 [WinForms] Fix displayed image in TreeNode when ImageIndex set to -2
When ImageIndex in TreeNode set to -2 must not displayed any image
2019-04-11 10:51:59 +02:00
sancheolz a68389fe9a Fix NRE when combobox was disposed and Text set (#13665)
If combobox already was disposed and we setting Text field there will be NullReferenceException. On .net winforms there no excetions.
2019-03-27 13:02:56 +01:00
Nikita Voronchev 037faa47cc [WinForms] Related Forms closing issue (#13150) (#13151)
Fixes #13150
2019-03-21 12:57:55 +01:00
sancheolz 1ca9fcc201 Fix local variable assign
Local variable must be assigned before use
2019-03-16 10:30:49 +01:00
[email protected] f278deee46 Fix Stackoverflow when SplitContainer`s SplitterDistance setted in SplitterMoved event subscription 2019-03-16 10:30:49 +01:00
Alexander Köplinger b31a445e85 [gitattributes] Do CRLF normalization on sln/proj files
They can be used with native line endings.

We now have a shared folder with the dotnet repos and they have CRLF normalization enabled.
This difference leads to conflicts while applying changes from the dotnet repos to mono.
2019-03-06 08:34:01 +01:00
sancheolz 89f264ad86 [SWF] Method OnClosed should pass FormClosedEventArgs type, instead of EventArgs.Empty (#13283)
Fixes #13282
2019-03-04 15:31:59 +01:00
Alexander Köplinger 602bdea385 Set executable bit for all .sh files in repo 2019-02-18 12:39:57 +01:00
Filip Navara 30b930a0fe Add sample from issue #12402. 2019-01-28 23:43:13 +01:00
DasSkelett cd814981ea Take text alignment for LinkLabels into account (#12643)
<!--
Thank you for your Pull Request!

If you are new to contributing to Mono, please try to do your best at conforming to our coding guidelines http://www.mono-project.com/community/contributing/coding-guidelines/ but don't worry if you get something wrong. One of the project members will help you to get things landed.

Does your pull request fix any of the existing issues? Please use the following format: Fixes #issue-number
-->
## Problem
`LinkLabels` ignore the text alignment for rendering the "hitbox" and the text color (= the `LinkArea`), and the focus rectangle. Also every text behind the end of this LinkArea/focus rectangle region is not painted at all.
This becomes visible if `AutoSize = false` and the `Size` is bigger than the text would need,
and if the text alignment is anything different than `TopLeft`.

## Cause
I think this is because the `piece.regions` are only translated regarding the padding, but neglecting the text alignment.

## Solution
Calculate the offset due to alignment and add it to the translation in `LinkLabel.CreateLinkPieces ()`

Fixes #12402 

## One more problem:
~Right now, a very tiny bit at the end of the label is still cut off (see my zipped and attached comparison pictures). Maybe `GetBounds ()` returns a value little bit smaller than it should be.
Can someone help?~

Also, maybe I took the wrong approach to this issue, but I don't know the inner mechanisms of mono.
So feel free to either advise me to change something, or change it yourself(s) :)
2019-01-28 23:30:10 +01:00
Eberhard Beilharz 7952489bd2 [swf] Fix dispose of panels in StatusBar (#12355)
This change implements disposing of the panels of a status bar.
2019-01-11 13:21:28 +01:00
monojenkins caf22d5f0b [csproj] Update project files 2019-01-02 13:54:08 +01:00
Filip Navara c628f13279 System.Windows.Forms: Fix incorrect layout for table layout nested in flow layout
Fixes issue #8922. The flow layout code specifies `int.MaxValue` as width in `GetPreferredSize` call, which the table layout didn't handle properly and tried to use all the available space.

Relevant WinForms open source code that implements the same behavior:
https://github.com/dotnet/winforms/blob/master/src/System.Windows.Forms/src/System/Windows/Forms/Layout/FlowLayout.cs#L183-L188

https://github.com/dotnet/winforms/blob/master/src/System.Windows.Forms/src/System/Windows/Forms/Layout/TableLayout.cs#L700-L702
2018-12-21 11:58:52 +01:00
PaulBol 7331c5e1d7 [WinForms] Dispose tooltips (#12059)
I noticed that some controls do not dispose tooltips and timers. Depending on the underlying implementation these may use native resources. Therefore I'd suggest to dispose these with the parent control to not rely on the garbage collector to eventually release the resources.

Additionally, in the case of `ToolStrip.cs` `CloseToolTip` would first create the objects before turning them off.
2018-12-21 10:50:12 +01:00
markusbeth 60d0977c65 prevent endless recursion in ListView.ToString() (#11049) (#11561)
prevent endless recursion in ListView.ToString()

do not access the Items[] in ListView.ToString() in VirtualMode
as this might cause an endless recursion if ToString() is called
from within the RetrieveVirtualItem event handler

Fixes #11049
2018-11-20 15:45:33 -05:00
Nikita Voronchev 1076d746b9 [WinForms] Matching Mono PropertyGrid behaviour with .Net one (#11618) 2018-11-16 14:29:43 -05:00
HebaruSan e743a7fd74 [WinForms] Really fix ToolStrip background (#11287)
## Problem

Even after #10942, menus and toolstrips still look awful with a dark theme:

![toolstrip](https://user-images.githubusercontent.com/1559108/46361551-8e6dea80-c633-11e8-97d1-242612b4b5cf.png)

## Previous attempt

#10942 was a first stab in the dark at what was going on here, before I managed to get mono to compile for testing. I was hopeful that it would address this, but the problem was different.

## Another red herring

Later I thought the problem might be that `SystemColors.ButtonFace.IsSystemColor` was `false`. It looked like this might have caused the runtime to interpret `ButtonFace`'s special 168 value as an RGB code instead of a system color marker.

This fix had no effect (see below for true cause), but I'll include it anyway; the lower bound of the upper system colors block needs to decrease from 170 to 168 to allow `ButtonFace` and `ButtonHighlight` to be considered system colors:

https://github.com/mono/mono/blob/44db64c620c2c957a49b3f5a69cb09c19c1c8c1a/mcs/class/System.Drawing/System.Drawing/KnownColor.cs#L200-L203

## Actual cause

The toolstrip color comes from `ProfessionalColorTable.ToolStripGradientBegin` and `ProfessionalColorTable.ToolStripGradientEnd`. The latter color is hard coded to a light shade, but the former defaults to `SystemColors.ButtonFace`.

These are the colors that are loaded from the GTK system theme:

https://github.com/mono/mono/blob/b104565ccfde477fc7b6308f2d3e4efff0af5848/mcs/class/System.Windows.Forms/System.Windows.Forms/X11DesktopColors.cs#L111-L116

Note that `ButtonFace` is not among them. This means that it uses a compile time default, and is not a good choice for the background of a control. `ToolStrip` is using it anyway, but other controls use `SystemColors.Control` instead.

## Changes

There are two obvious ways to fix this:

1. Use `SystemColors.Control` instead of `SystemColors.ButtonFace` in `ProfessionalColorTable`
2. Load `SystemColors.ButtonFace` from the system theme

This pull request does both. In addition, it also sets the other end of the toolstrip gradients to `SystemColors.ControlLight` instead of a hard coded value. The choice of `ControlLight` was made because in those cases where alternate hard coded values were available for both sides of the gradient, the "other" side was consistently lighter. Now it looks better:

![image](https://user-images.githubusercontent.com/1559108/47258840-efd0ee80-d466-11e8-842f-2fed8b3b9d82.png)
2018-11-16 20:09:20 +01:00
HebaruSan 89b1b8d049 Draw menu background with SystemColors.Menu to fix dark themes (#11301)
## Problem

Dropdown menus have light text on a light background in a dark theme:

![image](https://user-images.githubusercontent.com/1559108/47260376-2e26d780-d480-11e8-8330-86ecc82994df.png)

## Cause

The background is rendered here:

https://github.com/mono/mono/blob/4a6b11577fe06a58e6326b1c3a3bb58cfee6185c/mcs/class/System.Windows.Forms/System.Windows.Forms/ToolStripProfessionalRenderer.cs#L372-L375

`this.ColorTable.ToolStripDropDownBackground` is set to either `SystemColors.Window` or various hard coded shades of near-white in `ProfessionalColorTable`.

## Changes

Now that color comes from `SystemColors.Menu`, defined as "[Gets a Color structure that is the color of a menu's background](https://docs.microsoft.com/en-us/dotnet/api/system.drawing.systemcolors)", which looks better in a dark theme:

![image](https://user-images.githubusercontent.com/1559108/47260394-77772700-d480-11e8-85ad-03be8a59e56e.png)

It still looks fine in a normal theme as well:

![image](https://user-images.githubusercontent.com/1559108/47260396-7cd47180-d480-11e8-8989-4ee9448e9d05.png)

KeePass is not affected by this change, presumably thanks to its custom toolstrip renderer.
2018-11-16 20:07:55 +01:00
monojenkins 86941b00c1 [WinForms] Propagate the flags from DrawTextInternal to MeasureTextInternal (#11262)
Flags to DrawText never reached MeasureText therefore strings with '&' were measured incorrect when drawn with flag TextFormatFlags.NoPrefix.
Fixes #6352
2018-10-19 18:09:53 +02:00
HebaruSan b286fe3d74 Fix MessageBox text color for dark themes (#11196)
## Problem

`MessageBox` displays as black-on-dark in a dark theme:

![image](https://user-images.githubusercontent.com/1559108/47039608-f64f2580-d149-11e8-9c1d-1dd8d99d4cb8.png)

This can be difficult to read.

## Cause

The text is drawn with a hard coded color of `Color.Black`. This assumes that the background under the text will be light to contrast with black.

## Changes

Now the color is `SystemColors.ControlText` instead, to match the background of the popup.

In a normal theme this will still be black.
2018-10-17 14:10:17 +02:00
HebaruSan 0c2543cecf Fix default colors for DataGridView (#10944)
* Fix default colors for DataGridView

* Update tests
2018-10-04 10:54:56 +02:00
Paul Hebble 7d52f0fb7e Paint ToolStrip background with ToolStrip.BackColor 2018-10-03 08:42:40 +02:00
Alexander Köplinger afb344c155 [System.Windows.Forms] Switch tests to use embedded test resources 2018-09-28 19:52:47 +02:00
FrozenShade666 ca0eaf0828 [WinForms] Fix bug with multiline TextBox which contains /t characters in the middle of text. (#10348)
There is wrong cursor placement after the \t character. Example:

textBox1.Multiline = true;
textBox1.Text = "aa\taa\r\nbb\tbb\r\n";
Point pt = textBox1.GetPositionFromCharIndex(4); //pt.X is wrong for index 4 or any other char after \t in the line.
2018-09-25 16:40:56 +02:00
Katelyn Gadd 84af5b235e Move the PreBuild dependency property later in the file so targets can't override it (#10429)
* Move the PreBuild dependency property later in the file so targets can't override it

* [csproj] Update project files
2018-09-02 17:54:01 +02:00
Katelyn Gadd a6a8abde09 Kill sln dependencies (#10406)
* Remove use of sln dependencies and use csproj project references instead

* Rewrite jay.vcxproj so it builds correctly even without help from the sln file

* Force pre-build event to run after references are resolved. Change how culevel.exe path is computed to be more resilient.

* [csproj] Update project files
2018-08-31 17:44:27 +02:00
Filip Navara 1b5ebf2649 System.Windows.Forms: Fix regressions in layout code and TextBox Font handling (#10238)
* Fix layout of scrollbars in combobox.

* Fix TextBox height fixup to work properly inside TableLayout.

* Fix changing TextBox font before the Control handle has been created.

* Add test case.

* Reintroduce fix for TextBoxTest.Bug82749. We need to save the user requested control bounds outside of ExplicitBounds since ExplicitBounds are used by table layout engine.
2018-08-27 15:35:01 +02:00
Katelyn Gadd 14d20074ff Move to generating msbuild choose elements to get if-else selection behavior for sources in projects so that we don't get erroneous duplicate files in cases where there are both profile and host platform criteria (#9952)
A recent commit revealed that in cases where we select based on a mix of host platform and profile, genproj csproj files can end up with duplicate sources because the existing <ItemGroup Condition= approach could make multiple groups match for a given compile when we really just want one.

This PR changes to generating a cascade of msbuild <Choose> elements, which give if-else selection to ensure that we only ever build a single set of files.
2018-08-09 02:52:37 +02:00
Katelyn Gadd feaf8ee391 Use msbuild project reference to establish dependency on genconsts instead of solution dependencies (#9670)
Using solution dependencies in ```bcl.sln``` seems flaky and seems like it might not establish the full ordering we need to ensure that ```Consts.cs``` exists before we build things that require it. Let's try using project references (where ```corlib.dll``` 'depends' on ```genconsts.exe```) instead. This should also insert the dependency for any project that includes Consts.cs instead of just corlib.

This PR also makes update-solution-files actually fail if ```genconsts.exe``` fails to build because it was driving me mad.

Part of #6886
2018-08-02 00:30:54 +02:00
Alexander Schulz 491fa4d50d Return filled FormattedValueType instead of null 2018-07-11 10:53:26 +02:00
Katelyn Gadd e271c293ee Rework genproj to use gensources to build sources list for each profile and host platform (#8985)
* Update genproj makefile to include gensources
Update genproj argument parser to be more generous about displaying help

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint

* Fix rebase issue

* Checkpoint

* Checkpoint

* Fix built sources only being added to one profile

* Fix typo

* Checkpoint

* Fix indentation

* Use csc instead of mcs

* Checkpoint

* Fix BUILT_SOURCES only being handled for the first profile processed

* Checkpoint

* Checkpoint

* Strip double slashes from paths to fix spurious csproj change

* Checkpoint

* Checkpoint

* Checkpoint

* Checkpoint: Fix genproj compilation

* Checkpoint

* Checkpoint

* Checkpoint

* Fix crash when no targets were loaded (due to an error)

* Checkpoint

* Checkpoint

* Checkpoint

* Fix TryParseTargetInto bug

* Checkpoint

* Shuffle exclude logic around so that it works correctly during genproj diffing

* Remove gensources tracing

* Checkpoint

* Fix handling of oddball sources paths from executable.make

* Fix jay not being set to build

* Fix wrong slashes being used for embedded resource paths

* [csproj] Update project files
2018-06-29 08:01:31 +02:00
monojenkins ab4d81e794 [csproj] Update project files 2018-05-31 23:34:33 +02:00
sancheolz 6c6c52958f [System.Windows.Forms] Fix PropertyGrid (#8813)
When PropertyGrid contains more than one propertyTab it crashes whith NullReferenceException. And when clicking on propertyTab toolstripbutton it didn't switch to this tab.
2018-05-22 20:47:21 +02:00
Katelyn Gadd 7eff6686fd Default platform to net_4_x if none is specified, to fix tools that build without setting a platform (#8223)
* Default platform to net_4_x if none is specified, to fix tools that build without setting a platform

* [csproj] Update project files
2018-04-16 09:54:53 -04:00