[Solved] Making and drawing an image C#? [closed]

You could use GDI+ (and more specifically the Graphics class): // Load an existing image into a Graphics object using (var image = Image.FromFile(@”c:\work\input.png”)) using (var gfx = Graphics.FromImage(image)) { // Draw a line on this image from (0x0) to (50×50) gfx.DrawLine(new Pen(Color.Red), 0, 0, 50, 50); // save the resulting Graphics object to a … Read more

[Solved] How can i disable moving between Tab Control tabs by mouse in c# [closed]

This doesn’t really make a lot of sense. Short of disabling the mouse cursor entirely, I don’t know how you would possibly achieve this. Even if there were a way of “ignoring” mouse clicks on the tab control tabs, that would be incredibly bad UI. As far as the user would be concerned, your application … Read more

[Solved] ForEach loop counter [duplicate]

Rather than having two separate counters, I recommend starting by taking the length of the array and using a counter to print a comma while the counter is less than the number of total items in the array. That way, when you finish you’ll have one less comma than array item, and you won’t have … Read more

[Solved] Still Learning ‘System.StackOverflowException’ was thrown.’

The problem is in TeamLeader::getData() getTBonus() is calling getTPay() which is calling getTBonus() again causing an infinite loop, which will throw the StackOverflowException. You might try using if…else if in those methods instead of just if. public decimal getTBonus() { decimal tBonus = 0; if (TrainHours <= 0 && Hours <= 0) { tBonus = … Read more

[Solved] vb.net reading text file ,split to random range

Here’s a simple example: Dim R As New Random Dim Count As Integer Dim RangeLength As Integer Dim DataFileName As String = System.IO.Path.Combine(My.Computer.FileSystem.SpecialDirectories.MyDocuments, “test.txt”) Dim Links As New List(Of List(Of String)) Using SR As New System.IO.StreamReader(DataFileName) While Not SR.EndOfStream Count = 0 RangeLength = R.Next(2, 6) Dim curLinkSet As New List(Of String) Links.Add(curLinkSet) While Not … Read more

[Solved] List of classes in an assembly C#

Here’s a little class I whipped up some weeks back when I was bored, this does what you’re asking of – if I understand the question correctly. Your applications must implement IPlugin, and must be dropped in a “Plugins” folder in the executing directory. public interface IPlugin { void Initialize(); } public class PluginLoader { … Read more

[Solved] Why does assignment to parameter not change object?

The observed behavior has nothing to do with Value types vs Reference types – it has to do with the Evaluation of Strategy (or “calling conventions”) when invoking a method. Without ref/out, C# is always Call by Value1, which means re-assignments to parameters do not affect the caller bindings. As such, the re-assignment to the … Read more

[Solved] How to assign enum to variable

It’s of type FontStyle i.e. Enums are first class types. public enum FontStyle { Regular = 0; Bold =1; Italic = 2 } // No need to cast it FontStyle fontstyle = FontStyle.Bold; Edit: Perhaps you have code like this: if(1 == 1) FontStyle fontstyle = FontStyle.Bold; for your error (Embedded statement cannot be a … Read more