Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorKarl <5079870+PreferLinux@users.noreply.github.com>2020-04-08 20:44:41 +0300
committerGitHub <noreply@github.com>2020-04-08 20:44:41 +0300
commit29214fcbf189598e26886caf1e0b4f1155b49fee (patch)
treef067d187132851faa344bf757022f471f1877c72 /mcs
parented23e5e41afe6c1f29b9d79a6a550e100d0ecb31 (diff)
Fix WinForms LinkLabel drawing (#19386)
MeasureCharacterRanges handles the alignment correctly by itself. This may have been to handle poor behaviour in libgdiplus, particularly when Pango text layout was not default.
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs66
1 files changed, 1 insertions, 65 deletions
diff --git a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs
index 17d50d15f55..5bb0e05abd1 100644
--- a/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs
+++ b/mcs/class/System.Windows.Forms/System.Windows.Forms/LinkLabel.cs
@@ -668,73 +668,9 @@ namespace System.Windows.Forms
PaddingClientRectangle,
string_format);
- // Get offset for different text alignments
- float align_offset_x = 0F;
- float align_offset_y = 0F;
-
- if (TextAlign != ContentAlignment.TopLeft) {
- Region all_regions = new Region (new Rectangle ());
-
- foreach (Region region in regions) {
- all_regions.Union (region);
- }
-
- Graphics graphics = CreateGraphics ();
-
- if (TextAlign == ContentAlignment.TopCenter) {
- float text_width = all_regions.GetBounds(graphics).Width;
-
- align_offset_x = (ClientRectangle.Width / 2 - text_width / 2);
- }
- if (TextAlign == ContentAlignment.TopRight) {
- float text_width = all_regions.GetBounds(graphics).Width;
-
- align_offset_x = (ClientRectangle.Width - text_width);
- }
- if (TextAlign == ContentAlignment.MiddleLeft) {
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_y = (ClientRectangle.Height / 2 - text_height / 2);
- }
- if (TextAlign == ContentAlignment.MiddleCenter) {
- float text_width = all_regions.GetBounds(graphics).Width;
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_x = (ClientRectangle.Width / 2 - text_width / 2);
- align_offset_y = (ClientRectangle.Height / 2 - text_height / 2);
- }
- if (TextAlign == ContentAlignment.MiddleRight) {
- float text_width = all_regions.GetBounds(graphics).Width;
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_x = (ClientRectangle.Width - text_width);
- align_offset_y = (ClientRectangle.Height / 2 - text_height / 2);
- }
- if (TextAlign == ContentAlignment.BottomLeft) {
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_y = (ClientRectangle.Height - text_height);
- }
- if (TextAlign == ContentAlignment.BottomCenter) {
- float text_width = all_regions.GetBounds(graphics).Width;
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_x = (ClientRectangle.Width / 2 - text_width / 2);
- align_offset_y = (ClientRectangle.Height - text_height);
- }
- if (TextAlign == ContentAlignment.BottomRight) {
- float text_width = all_regions.GetBounds(graphics).Width;
- float text_height = all_regions.GetBounds(graphics).Height;
-
- align_offset_x = (ClientRectangle.Width - text_width);
- align_offset_y = (ClientRectangle.Height - text_height);
- }
- }
-
-
for (int i = 0; i < pieces.Length; i ++) {
pieces[i].region = regions[i];
- pieces[i].region.Translate (Padding.Left + align_offset_x, Padding.Top + align_offset_y);
+ pieces[i].region.Translate (Padding.Left, Padding.Top);
}
Invalidate ();