Trouble Getting System.Drawing.Graphics to work in Form

前端 未结 2 1909
耶瑟儿~
耶瑟儿~ 2020-12-22 00:44

I am trying to make a C# Windows form in Visual Studio so I can draw on the form (like a basic version of Microsoft Paint). I am working through an example in a C# 2012 boo

相关标签:
2条回答
  • 2020-12-22 01:17

    Try the paint events for drawing. this will help you. The link is just an example. you need to implement as per the requirements

    0 讨论(0)
  • 2020-12-22 01:18
     private void Form1_Paint(object sender, EventArgs e)
        {
            if (shouldPaint)
            {
                using (Graphics graphics = CreateGraphics())
                {
                    graphics.FillEllipse(new SolidBrush(Color.BlueViolet), e.X, e.Y, 4, 4);
                }
            }
        }
    

    I am trying to make a C# Windows form in Visual Studio so I can draw on the form (like a basic version of Microsoft Paint). I am working through an example in a C# 2012 book.

    Alex Fr provided an excellent set of drawing tools in his DrawTools article and these tools serve as a basis for Draw Tool Redux.

    Here's a tool I recently wrote by adding to Draw Tool Redux, it creates Epilogs for Mathematica:

    enter image description here

    The EyeDropper Colour Picker I got from http://www.codeproject.com/Articles/36540/Adobe-Eyedropper-Control

    The Transparent Textbox I got from: http://www.codeproject.com/Articles/4390/AlphaBlendTextBox-A-transparent-translucent-textbo

    0 讨论(0)
提交回复
热议问题