Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8864879
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T16:21:50+00:00 2026-06-14T16:21:50+00:00

For this problem, I did comb through Stackoverflow similar questions for an answer. Although

  • 0

For this problem, I did comb through Stackoverflow similar questions for an answer. Although a lot of them were helpful, they didn’t solve my problem. My program draws polygon on a winform using graphics.DrawLines method as follows.

g.DrawLines(thepen,pts);

But that keeps raising, “Parameter is not valid”, error. So, I changed that line of code as follows to see if it makes any difference.

g.DrawLines(new pen(color.Black),pts);

Again, it is raising the same error. pts is an array of system.drawing.point and thepen is a system.drawing.pen.

If I completely comment it out, my program has no issue that it doesn’t raise any error. However, what’s weird is that the same code used to work just fine for the last 3 or 4 months. Since yesterday, I can’t seem to get it working again.

Is there a property setting for the winform that needs to be set?

UPDATE Here is the actual draw method

method TMakerPoly.Draw;
var
  pts: Array of point;
  i:integer;
  theBrush1:HatchBrush;
  theBrush2:SolidBrush;
begin
  if (theBrushStyle = HatchStyle.Wave) then
     theBrush1 := new HatchBrush(theBrushStyle,Color.Transparent,color.Transparent)
  else if (theBrushStyle = HatchStyle.ZigZag) then
     thebrush2 := new SolidBrush(FillColor)
  else
     theBrush1 := new HatchBrush(theBrushStyle,FillColor,color.Transparent);

  if (thePen.DashStyle = DashStyle.Custom) then
    thepen.Color := Color.Transparent;

  pts := new point[pcount];

  if pcount >= 2 then
  begin
    if Active then
    begin
      for i := 0 to pcount-1 do
        pts[i] := point(points[i]);
      Translate(var pts,pcount);

      thepen.Color := EdgeColor(thepen.Color);
      fillColor := self.BackColor(FillColor);
      if visible then
      begin
        if filled then
        begin
            if theBrushStyle = HatchStyle.ZigZag then
                g.FillPolygon(theBrush2,pts)
            else 
                g.FillPolygon(thebrush1,pts);

            g.DrawPolygon(thepen, pts);
        end
        else
            g.DrawLines(thePen, pts);
      end;
    end
    else
    begin
      for i := 0 to pcount-1 do
        pts[i] := point(points[i]);

      if filled then
      begin
            if theBrushStyle = HatchStyle.ZigZag then
                g.FillPolygon(theBrush2,pts)
            else 
                g.FillPolygon(thebrush1,pts);

            g.DrawPolygon(thepen,pts);        
      end
      else
        g.DrawLines(new Pen(color.Black),pts);
    end;
  end;
end;

Any help or hints or clues will be greatly appreciated.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T16:21:51+00:00Added an answer on June 14, 2026 at 4:21 pm

    If your pts array has less than 2 points, it will throw the parameter is not valid error.

    Make sure your array has more then enough points to draw the lines.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i find a lot of questions about this problem but i did not solve...
I did a search in this repository and I didn't find any similar questions
[Note: There is another thread about this problem but it did not answer the
I have checked this similar question, but the suggestions did not solve my problem:
I did notice a few related questions to this problem (I also did a
Sorry since this question is specific to my problem. While learning reflections i did
did someone else encounter this problem? I use the methods PopUpManager.createPopUp() and PopUpManager.centerPopUp() to
Update: Turns out that this problem was because half my mongrel did not restart.
I've built a few services in Delphi 7 and did not have this problem.
did anyone encounter this problem? here's the code in ViewController.m. I have a UIImageView

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.