Click here to Skip to main content
15,897,371 members
Home / Discussions / C#
   

C#

 
QuestionWebservices (RPC+SOAP) Pin
mpuerto8-Mar-06 4:20
mpuerto8-Mar-06 4:20 
QuestionTableLayoutPanel question Pin
Drew McGhie8-Mar-06 4:10
Drew McGhie8-Mar-06 4:10 
QuestionGraphics in C# Pin
Jeea20068-Mar-06 3:42
Jeea20068-Mar-06 3:42 
AnswerRe: Graphics in C# Pin
Judah Gabriel Himango8-Mar-06 3:55
sponsorJudah Gabriel Himango8-Mar-06 3:55 
GeneralRe: Graphics in C# Pin
Jeea200618-Mar-06 22:49
Jeea200618-Mar-06 22:49 
AnswerRe: Graphics in C# Pin
_awatts8-Mar-06 9:05
_awatts8-Mar-06 9:05 
GeneralRe: Graphics in C# Pin
Jeea200618-Mar-06 23:01
Jeea200618-Mar-06 23:01 
AnswerRe: Graphics in C# Pin
_awatts20-Mar-06 9:53
_awatts20-Mar-06 9:53 
Wajeeha,

My following answer assumes you're drawing to a form.

Basically you want to perform your drawing within the Form's Paint event or override the Form's OnPaint method? not to draw directly to the form when a button is pressed. The Paint event will receive the PaintEventArgs referenced by 'e'. It's by using e.Graphics you will perform the necessary drawing. Based on your original request of altering the angle/rotation or a box when the user presses a button, I would have done something like this (although very basic)

<br />
int _x = 10;<br />
int _y = 10;<br />
int _width = 100;<br />
int _height = 100;<br />
int _angle = 45;<br />
...<br />
...<br />
...<br />
private void buttonclicked( object sender System.EventArgs e )<br />
{<br />
  _angle = ( _angle == 360 ) ? 0 ? _angle + 1;<br />
  this.Refresh();<br />
}<br />
<br />
<br />
private void FormPaint( object sender, PaintEventArgs e )<br />
{<br />
  Graphics g = e.Graphics;<br />
  Matrix matrix = new Matrix();<br />
  matrix.Rotate( _angle );<br />
  g.Transform = matrix;<br />
  g.DrawRectangle( Pens.Black, _x, _y, _width, _height );<br />
}<br />


Everytime the button is pressed, we update the rotation angle and force a redraw of the box.

Regards,

Andy
QuestionAlternatives to DataTable Searches? Pin
Paul Gates8-Mar-06 2:30
Paul Gates8-Mar-06 2:30 
AnswerRe: Alternatives to DataTable Searches? Pin
Wjousts8-Mar-06 3:30
Wjousts8-Mar-06 3:30 
GeneralRe: Alternatives to DataTable Searches? Pin
Paul Gates8-Mar-06 5:07
Paul Gates8-Mar-06 5:07 
QuestionAbout mainFrame communicate with thread Pin
breakhearts8-Mar-06 2:18
breakhearts8-Mar-06 2:18 
AnswerRe: About mainFrame communicate with thread Pin
mav.northwind8-Mar-06 2:54
mav.northwind8-Mar-06 2:54 
QuestionDeclaring a arrays of objects dynamically Pin
winpoorni8-Mar-06 1:12
winpoorni8-Mar-06 1:12 
AnswerRe: Declaring a arrays of objects dynamically Pin
Stefan Troschuetz8-Mar-06 1:32
Stefan Troschuetz8-Mar-06 1:32 
AnswerRe: Declaring a arrays of objects dynamically Pin
Divyang Mithaiwala8-Mar-06 1:51
Divyang Mithaiwala8-Mar-06 1:51 
QuestionRe: Declaring a arrays of objects dynamically Pin
winpoorni8-Mar-06 17:32
winpoorni8-Mar-06 17:32 
AnswerRe: Declaring a arrays of objects dynamically Pin
Divyang Mithaiwala8-Mar-06 17:42
Divyang Mithaiwala8-Mar-06 17:42 
JokeDeclaring a arrays of objects dynamically Pin
winpoorni8-Mar-06 18:25
winpoorni8-Mar-06 18:25 
AnswerRe: Declaring a arrays of objects dynamically Pin
Wjousts8-Mar-06 3:33
Wjousts8-Mar-06 3:33 
AnswerRe: Declaring a arrays of objects dynamically Pin
Judah Gabriel Himango8-Mar-06 4:01
sponsorJudah Gabriel Himango8-Mar-06 4:01 
JokeThanks Pin
winpoorni8-Mar-06 17:41
winpoorni8-Mar-06 17:41 
Questionmanually running class library in cmd Pin
sasire188-Mar-06 0:27
sasire188-Mar-06 0:27 
AnswerRe: manually running class library in cmd Pin
Steve Hansen8-Mar-06 0:52
Steve Hansen8-Mar-06 0:52 
QuestionConvert struct to byte[] Pin
Divyang Mithaiwala8-Mar-06 0:26
Divyang Mithaiwala8-Mar-06 0:26 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.