C#, passing control ID

  • Thread starter Thread starter Mike
  • Start date Start date
M

Mike

Hi All,
I'm new to C# and would appreciate any help.
I am trying to put an X on specified controls (buttons, group boxes,
textboxes) on a form. How do I ID the myControl in putX?
Thanks.

private void button1_Click(object sender, System.EventArgs e)
{
string tstr;
putX(aControl);
}

private void putX(type myControl)
{
System.Drawing.Size mySize = myControl.Size;
System.Drawing.Graphics myGraphics = myControl.CreateGraphics();
System.Drawing.Pen myPen;
myPen = new System.Drawing.Pen(System.Drawing.Color.Black);
myGraphics.DrawLine(myPen,0,0,mySize.Width, mySize.Height);
myGraphics.DrawLine(myPen,0,mySize.Height,mySize.Width,0);
}
 
Hi Mike:

System.Drawing can be used server side to create an image for the
client. You'd send the image down to the browser as a jpg or png or
gif, for instance. What you can't do is draw on the client's screen
from server code with System.Drawing.

HTH,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top