Click here to Skip to main content
15,896,726 members
Home / Discussions / C#
   

C#

 
GeneralRe: Ho do I suppress the Tab key, or control tabbing to a nested user control? Pin
dan!sh 26-Sep-08 18:40
professional dan!sh 26-Sep-08 18:40 
GeneralRe: Ho do I suppress the Tab key, or control tabbing to a nested user control? Pin
Poolee2-Oct-08 6:51
Poolee2-Oct-08 6:51 
QuestionParse XML file and connect to a DSN Pin
Planker25-Sep-08 13:47
Planker25-Sep-08 13:47 
AnswerRe: Parse XML file and connect to a DSN Pin
Planker25-Sep-08 16:53
Planker25-Sep-08 16:53 
AnswerRe: Parse XML file and connect to a DSN Pin
PIEBALDconsult25-Sep-08 18:45
mvePIEBALDconsult25-Sep-08 18:45 
GeneralRe: Parse XML file and connect to a DSN Pin
Planker26-Sep-08 2:41
Planker26-Sep-08 2:41 
QuestionA good tutorial tu use graphics on form ? Pin
baranils25-Sep-08 11:40
baranils25-Sep-08 11:40 
AnswerRe: A good tutorial tu use graphics on form ? Pin
Anthony Mushrow25-Sep-08 12:27
professionalAnthony Mushrow25-Sep-08 12:27 
I doesn't matter too much where you draw, so long as you do it right. Basically, you either want to override the OnPaint method for a control (requires you to make a custom control, which is really easy), or simply use the OnPaint event. In either case you will get a Graphics object in the PaintEventArgs which is what you should use.

Now double buffering, try whatever it is you want without it (ie. Just draw your stuff using the aforementioned Graphics object). Then if you find that your form flickers, you may want to use double buffering. If you can it would be easier to use the DoubleBuffered property, if you can't then you can make up your own. Setting up your own double buffering is easy, simply create a bitmap with the same dimensions as your form/control and do all of your drawing to that, then you just draw the image to the screen in one go, like this:

Bitmap myBuffer = new Bitmap(200,200);

void OnPaint(object sender, PaintEventArgs e)
{
  Graphics buffer = Graphics.FromImage(myBuffer);
  //do all drawing using the 'buffer' object
  buffer.Dispose();
  //Draw your buffer to the screen
  e.Graphics.DrawImageUnscaled(myBuffer, 0, 0);
}


And if you want to go all out then check my articles here[^] (which one day I WILL get round to finishing dammit!)

My current favourite word is: Nipple!
-SK Genius

Game Programming articles start -here[^]-

GeneralRe: A good tutorial tu use graphics on form ? Pin
baranils25-Sep-08 20:02
baranils25-Sep-08 20:02 
GeneralRe: A good tutorial tu use graphics on form ? Pin
Anthony Mushrow25-Sep-08 22:21
professionalAnthony Mushrow25-Sep-08 22:21 
AnswerRe: A good tutorial tu use graphics on form ? Pin
V.25-Sep-08 20:33
professionalV.25-Sep-08 20:33 
GeneralRe: A good tutorial tu use graphics on form ? Pin
baranils25-Sep-08 21:04
baranils25-Sep-08 21:04 
GeneralRe: A good tutorial tu use graphics on form ? Pin
Anthony Mushrow25-Sep-08 22:28
professionalAnthony Mushrow25-Sep-08 22:28 
GeneralRe: A good tutorial tu use graphics on form ? Pin
baranils25-Sep-08 22:59
baranils25-Sep-08 22:59 
QuestionHow does one indirectly use user controls on a Winform. Pin
ingersod25-Sep-08 9:42
ingersod25-Sep-08 9:42 
AnswerRe: How does one indirectly use user controls on a Winform. Pin
DaveyM6925-Sep-08 11:55
professionalDaveyM6925-Sep-08 11:55 
QuestionExporting to Excel / PDF file from the Reportviewer using my own button Pin
Yeates25-Sep-08 6:20
Yeates25-Sep-08 6:20 
AnswerRe: Exporting to Excel / PDF file from the Reportviewer using my own button Pin
Ennis Ray Lynch, Jr.25-Sep-08 7:11
Ennis Ray Lynch, Jr.25-Sep-08 7:11 
GeneralRe: Exporting to Excel / PDF file from the Reportviewer using my own button Pin
Yeates25-Sep-08 21:14
Yeates25-Sep-08 21:14 
QuestionValue Member Property for DataGridViewComboboxColumn Pin
Uma Dilip25-Sep-08 5:25
Uma Dilip25-Sep-08 5:25 
QuestionRe: Value Member Property for DataGridViewComboboxColumn Pin
nelsonpaixao25-Sep-08 12:09
nelsonpaixao25-Sep-08 12:09 
QuestionInterface Inheritance Q? Pin
Ware@Work25-Sep-08 4:40
Ware@Work25-Sep-08 4:40 
AnswerRe: Interface Inheritance Q? Pin
mark_w_25-Sep-08 4:47
mark_w_25-Sep-08 4:47 
AnswerRe: Interface Inheritance Q? Pin
led mike25-Sep-08 5:03
led mike25-Sep-08 5:03 
QuestionRe: Interface Inheritance Q? Pin
Ware@Work25-Sep-08 5:32
Ware@Work25-Sep-08 5:32 

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.