Profile Picture

Center Picture for background

Posted By Daniel Csimszi 10 Years Ago
Author
Message
Daniel Csimszi
Posted 10 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
sorry I got the answer:
source: http://stackoverflow.com/questions/87753/resizing-an-image-without-losing-any-quality

//resize picture
//keeping quality
Bitmap bm = new Bitmap("something.png");
Bitmap newImage = new Bitmap(100, 100);
using (Graphics gr = Graphics.FromImage(newImage))
{
gr.SmoothingMode = SmoothingMode.HighQuality;
gr.InterpolationMode = InterpolationMode.HighQualityBicubic;
gr.PixelOffsetMode = PixelOffsetMode.HighQuality;
gr.DrawImage(bm, new Rectangle(0, 0, 100, 100));
}

//set picture for backgournd
NImageFillStyle imageFill = new NImageFillStyle(newImage);

imageFill.TextureMappingStyle.MapLayout = MapLayout.Centered;
m_Chart.Wall(ChartWallType.Back).FillStyle = imageFill;

nChartControl1.Refresh();

Daniel Csimszi
Posted 10 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Thank you, It works as a charm.
I just have one more question. Is it possible to resize the picture as well?

Thank you,
Daniel

Nevron Support
Posted 10 Years Ago
View Quick Profile
Supreme Being

Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)Supreme Being (4,435 reputation)

Group: Forum Members
Last Active: Yesterday @ 1:54 AM
Posts: 3,054, Visits: 4,009
Hi Daniel,

Yes - you can use the following code:

NImageFillStyle imageFill = new NImageFillStyle("c:\\temp\\maplayout.png");
imageFill.TextureMappingStyle.MapLayout = MapLayout.Centered;
chart.Wall(ChartWallType.Back).FillStyle = imageFill;

More information on texture mapping can be found here:
http://helpdotnetvision.nevron.com/Presentation_Graphics_AppearanceStyles_FillStyles_Texture_Mapping_Style.html

Best Regards,
Nevron Support Team



Daniel Csimszi
questionmark Posted 10 Years Ago
View Quick Profile
Forum Guru

Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)Forum Guru (50 reputation)

Group: Forum Members
Last Active: 8 Years Ago
Posts: 61, Visits: 35
Hi,

I am just wondering if it is possible to center an image for graph background instead of setting it to stretch?

I know I can set the background the way like that:

NImageFillStyle imageFillStyle = new NImageFillStyle("image path");

m_Chart.Wall(ChartWallType.Back).FillStyle = imageFillStyle;
m_Chart.Wall(ChartWallType.Left).FillStyle = imageFillStyle;
m_Chart.Wall(ChartWallType.Floor).FillStyle = imageFillStyle;

But that always re-sizes the picture.

Thank you,
Daniel



Similar Topics


Reading This Topic