I want to show Components in a tabs , so first of all create few components. In this project we have three components, First View Component public class AllViewComponent : ViewComponent { private readonly UserManager<ApplicationUser> _userManager; public AllViewComponent(UserManager<ApplicationUser> userManager) { _userManager = userManager; } public async Task<IViewComponentResult> InvokeAsync() { List<StudentViewModel> allUsers = new List<StudentViewModel>(); var items = await _userManager.Users.ToListAsync(); foreach (var item in items) { allUsers.Add(new StudentViewModel {Id=item.Id, EnrollmentNo = item.EnrollmentNo, FatherName = item.FatherName, Name = item.Name, Age = item.Age, Birthdate = item.Birthdate, Address = item.Address, Gender = item.Gender, Email = item.Email }); }
Using Graphics class we can write something on image. Graphics class object invoke drawing objects, like String, Rectangle, oval etc. For DrawString( ) method, we need some parameter like string text, font, point where you want to display string on image. Now copy this code
Image img = new Bitmap(this.pictureBox1.Width, this.pictureBox1.Height);
var font = new Font("TimesNewRoman", 25, FontStyle.Bold, GraphicsUnit.Pixel);
var graphics = Graphics.FromImage(img);
graphics.DrawString("Hello World! " , font, Brushes.Red, new Point(0, 0));
this.pictureBox1.Image = img;
Here
Here
- First to add the picture box in the form.
- Now, using the Bitmap class we can pick the resolution parameter of picture box then assign these parameter to Image class instance.
- Take Font class for making highly visualize text in the image.
- Use graphics class to Draw the string on the image.
- Before Drawing must to assign the image to the Graphics class.
The following mentioned video contain full implementation guide:
Comments
Post a Comment