Zdrav?m, m?m jeden probl?m. Pot?ebuji v programu nastavit ?um pomoc? trackbaru. P?eklada? mi to v pohod? p?elo??, ale kdy? zm?n?m hodnotu trackbaru, program se sekne..
Uk?zka k?du:
private void pridatSum(object sender,EventArgs e){
trackbar = new TrackBar();
trackbar.ValueChanged += new EventHandler(velikostSumu);
}
private void velikostSumu(object sender,EventArgs e){
rackBar tb = (TrackBar) sender;
int v = tb.Value;
Random rand = new Random();
for (int i = 0; i < image.Width; i++){
for (int j = 0; j < image.Height; j++){
Color clr = image.GetPixel(i, j);
Color clr1 = Color.FromArgb(
Math.Min(rand.Next(v) + clr.R, 255),
Math.Min(rand.Next(v) + clr.G, 255),
Math.Min(rand.Next(v) + clr.B, 255));
image.SetPixel(i, j, clr1);
}
}
Invalidate();
}
Dod?m je?t? ?e prom?nn? image j e typu bitmap. Kdybyste na n?co p?i?li, ur?it? napi?te, d?ky! :ok: