More Profile Image Sizing Fixes

This commit is contained in:
Alan Moon 2025-07-11 12:28:22 -07:00
parent 217e3f301a
commit ffa44ff036
2 changed files with 5 additions and 8 deletions

View File

@ -55,7 +55,7 @@
pbUserPfp.Location = new Point(13, 11); pbUserPfp.Location = new Point(13, 11);
pbUserPfp.Name = "pbUserPfp"; pbUserPfp.Name = "pbUserPfp";
pbUserPfp.Size = new Size(128, 128); pbUserPfp.Size = new Size(128, 128);
pbUserPfp.SizeMode = PictureBoxSizeMode.Zoom; pbUserPfp.SizeMode = PictureBoxSizeMode.StretchImage;
pbUserPfp.TabIndex = 2; pbUserPfp.TabIndex = 2;
pbUserPfp.TabStop = false; pbUserPfp.TabStop = false;
// //

View File

@ -18,6 +18,7 @@ using QtCNETAPI.Schema;
using System.Diagnostics; using System.Diagnostics;
using System.Drawing.Imaging; using System.Drawing.Imaging;
using System.Drawing.Design; using System.Drawing.Design;
using System.Drawing.Drawing2D;
namespace qtc_net_client_2.Forms namespace qtc_net_client_2.Forms
{ {
@ -53,11 +54,7 @@ namespace qtc_net_client_2.Forms
{ {
using (var ms = new MemoryStream(pfpRes.Data)) using (var ms = new MemoryStream(pfpRes.Data))
{ {
Bitmap bmp = new Bitmap(ms); pbUserPfp.Image = new Bitmap(ms);
if (bmp.Width != 128 && bmp.Height != 128)
bmp.SetResolution(128, 128);
pbUserPfp.Image = bmp;
} }
} }
@ -78,7 +75,7 @@ namespace qtc_net_client_2.Forms
break; break;
} }
if(_userInformationDto.ProfileCosmeticId != 0) if (_userInformationDto.ProfileCosmeticId != 0)
{ {
var res = await _apiService.GetStoreItem(_userInformationDto.ProfileCosmeticId); var res = await _apiService.GetStoreItem(_userInformationDto.ProfileCosmeticId);
if (res != null && res.Success && res.Data != null) if (res != null && res.Success && res.Data != null)
@ -87,7 +84,7 @@ namespace qtc_net_client_2.Forms
var response = await client.GetAsync(res.Data.AssetUrl); var response = await client.GetAsync(res.Data.AssetUrl);
if (response.IsSuccessStatusCode) if (response.IsSuccessStatusCode)
{ {
using(var stream = await response.Content.ReadAsStreamAsync()) using (var stream = await response.Content.ReadAsStreamAsync())
{ {
CombineProfileImageWithCosmetic(pbUserPfp.Image, new Bitmap(stream)); CombineProfileImageWithCosmetic(pbUserPfp.Image, new Bitmap(stream));
} }