Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 2.28 KB | None | 0 0
  1. using System;
  2. using System.Windows.Forms;
  3. using System.Windows.Forms.VisualStyles;
  4. using System.Drawing;
  5. using System.Drawing.Text;
  6.  
  7. //Goal, make a balloon tip that uses passed strings to display text from a console. No real reason behind this other than educating my sorry ass, cause I suck
  8.  
  9.     class ToolBalloon
  10.     {
  11.             public static void Main()
  12.             {
  13.                 string nText = "";
  14.                 Console.WriteLine("Hi there! May I have your name?");
  15.                 nText = Console.ReadLine(); //nText is now going to have data saved for later use, and will stay at what was entered until changed. Is there a way to call it from this change after giving it the second change?
  16.                 Console.WriteLine("Ah, I see, your name is " + nText);  
  17.                 Console.WriteLine("and you seem to be new to C#. Welcome!!");
  18.                 Console.WriteLine("Now please enter your Mothers name");
  19.                 nText = Console.ReadLine();
  20.                 Console.WriteLine("Ah I see, your mother is named " + nText);
  21.                 NameDisplay(nText, null);
  22.             }
  23.  
  24.             public static void NameDisplay(string fsauce, PaintEventArgs pnt)
  25.             {
  26.                 //Variables                                              V <--What the fuck do I put down here for family name?? I made a string to improvise, and it seemed to work...lucky me
  27.                 Font eek = new Font(familyName: "Times New Roman" , emSize: 10);
  28.                 VisualStyleRenderer render = new VisualStyleRenderer(VisualStyleElement.ToolTip.Balloon.Normal);
  29.                 Rectangle rec1 = new Rectangle(10, 50, 50, 50);
  30.  
  31.                 if (VisualStyleRenderer.IsElementDefined(VisualStyleElement.ToolTip.Balloon.Normal))
  32.                 {
  33.                     render.DrawBackground(pnt.Graphics, rec1);                   //NullRefrenceException occurs here for this...I am lost at where to go..It wants me to create a new object, but I already HAVE a new one.
  34.                     pnt.Graphics.DrawString(fsauce, eek, Brushes.Black, new Point(10, 10));                    
  35.                 }
  36.                 else
  37.                     pnt.Graphics.DrawString("Nothing to say to your bitch ass.", eek, Brushes.Black, new Point(10, 10));
  38.             }
  39.  
  40.                                                      
  41.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement