• 0

[VB.NET] Draw Line on Flow Control Panel


Question

Hey gang,

I'm in need of the ability to draw a box around a picture control (frame it) and my code works fine

Dim penGray As New System.Drawing.Pen(System.Drawing.Color.DarkGray)

Dim grpLine As System.Drawing.Graphics

grpLine = Me.CreateGraphics()

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX2, Me.FrameY1)

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX1, Me.FrameY2)

grpLine.DrawLine(penGray, Me.FrameX2, Me.FrameY1, Me.FrameX2, Me.FrameY2)

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY2, Me.FrameX2, Me.FrameY2)

'The me.FrameX... are properties... not a real issue.

The problem is, I want to draw these lines not on the Form but on a Flow Control Panel.

Any ideas?

Thanks,

James

2 answers to this question

Recommended Posts

  • 0
  jameswjrose said:
Hey gang,

I'm in need of the ability to draw a box around a picture control (frame it) and my code works fine

Dim penGray As New System.Drawing.Pen(System.Drawing.Color.DarkGray)

Dim grpLine As System.Drawing.Graphics

grpLine = Me.CreateGraphics()

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX2, Me.FrameY1)

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY1, Me.FrameX1, Me.FrameY2)

grpLine.DrawLine(penGray, Me.FrameX2, Me.FrameY1, Me.FrameX2, Me.FrameY2)

grpLine.DrawLine(penGray, Me.FrameX1, Me.FrameY2, Me.FrameX2, Me.FrameY2)

'The me.FrameX... are properties... not a real issue.

The problem is, I want to draw these lines not on the Form but on a Flow Control Panel.

Any ideas?

Thanks,

James

Create a Graphics object from the handle of the Flow Control Panel.

			Graphics g = Graphics.FromHwnd(flowLayoutPanel1.Handle);
			g.DrawLine(Pens.Black, 25f, 25f, 75f, 25f);

Or handle the flow control panel's Paint event. Am I missing what it is you want to do?

  • 0
  azcodemonkey said:
Create a Graphics object from the handle of the Flow Control Panel.

			Graphics g = Graphics.FromHwnd(flowLayoutPanel1.Handle);
			g.DrawLine(Pens.Black, 25f, 25f, 75f, 25f);

Or handle the flow control panel's Paint event. Am I missing what it is you want to do?

You got it. Thank you so VERY much. I owe you one.

Thanks,

James

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Posts

    • The Start menu is a defining UI element that made Windows, well, Windows. naturally people will be worked up to any changes it receives.
    • I believe voice assistants have reached a dead end in terms of usability. You can only do so much with voice. Even Google is sidelining Google Assistant for Gemini. Once you can no longer shoehorn "AI" everywhere, the industry will move on to the next fancy trend try to push voice assistants to use that tech.
    • Gemini in Google Sheets can now generate fully editable charts by David Uzondu Back in January, Google introduced a feature in Google Sheets powered by Gemini that lets you ask the AI to create charts from your data. The problem was, these charts were just static pictures, slapped on top of your cells. You could not edit them, and they would not update if your data changed. Now, the company has upgraded the feature so you can edit the charts however you want, plus they stay synced with your data as it changes. The process is quite straightforward. You use the Gemini side panel and just type what you want, like "create a bar chart showing campaign performance by market." Gemini then builds the chart, and when you insert it, the chart appears in a completely new tab within your spreadsheet. From that new home, you have total control. You can change the title, tweak the colors, and adjust all the little details just like any normal chart you would build yourself. It is not a completely perfect system, however. The biggest catch is that the editable chart is linked to the data in that new tab, not your original data source. So if you want the chart to reflect new numbers, you have to update the data in the chart’s dedicated tab. This is a bit of a weird detour from how standard Sheets charts have always worked, where they update directly from the source cells. For certain, more complex chart types, Google also notes that Gemini might still fall back to spitting out a static image, so your mileage may vary. The full rollout began recently, with Google expecting it to reach everyone within one to three days. This update is available for a bunch of Google Workspace accounts, including Business Standard, Business Plus, Enterprise Standard, and Enterprise Plus. It is also included for anyone with a Google One AI Premium plan, which the company has since renamed to Google AI Pro and Ultra. If you are on one of the old Gemini Business or Enterprise add-ons that Google stopped selling back on January 15, 2025, you get this feature too. Just make sure your admin has the "Smart features and personalization" setting turned on, or none of this will work.
    • iOS feature updates are lacklustre. I know it’s difficult with a mature OS, but imagine the announcements without Liquid Glass. Pretty thin.
  • Recent Achievements

    • Week One Done
      IAMFLUXX earned a badge
      Week One Done
    • One Month Later
      Æhund earned a badge
      One Month Later
    • One Month Later
      CoolRaoul earned a badge
      One Month Later
    • First Post
      Kurotama earned a badge
      First Post
    • Collaborator
      Carltonbar earned a badge
      Collaborator
  • Popular Contributors

    1. 1
      +primortal
      506
    2. 2
      ATLien_0
      268
    3. 3
      +FloatingFatMan
      237
    4. 4
      +Edouard
      201
    5. 5
      snowy owl
      162
  • Tell a friend

    Love Neowin? Tell a friend!