4 Replies - 574 Views - Last Post: 09 November 2016 - 08:50 AM

#1 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

VS: How Do I Make an Invisible Image Clickable?

Posted 08 November 2016 - 02:34 PM

Hey guys, quick question, so I'm trying to make an image in VS (Picturebox) be invisible and at the same time clickable (when it's clicked it will become visible). I tried searching google but there were no really good answers on this and since it's pretty simple I'm sure I can get a response pretty quick here. I saw some ways to do this in C# but I'm obviously using CLI/C++ so the C# answers won't do. I know I could do a transparent control in front of the image and use that but I don't want to do that as it's going to require more layout time and resources. There's got to be a way to do this so if anyone is familiar with VS let me know what your suggestions are. Have a great day.

Is This A Good Question/Topic? 0
  • +

Replies To: VS: How Do I Make an Invisible Image Clickable?

#2 modi123_1  Icon User is offline

  • Suitor #2
  • member icon



Reputation: 13485
  • View blog
  • Posts: 53,843
  • Joined: 12-June 08

Re: VS: How Do I Make an Invisible Image Clickable?

Posted 08 November 2016 - 03:22 PM

I am not certain if this is a visual studios issue as much as c++ gui.. Off hand you could make the image inside a panel and have the panel kick off click events.
Was This Post Helpful? 0
  • +
  • -

#3 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5889
  • View blog
  • Posts: 20,095
  • Joined: 05-May 12

Re: VS: How Do I Make an Invisible Image Clickable?

Posted 08 November 2016 - 05:32 PM

The answers for C# will work equally well for C++ CLI since any techniques will be dependent on WinForms, not the language. You simply have to translate the C# to C++ CLI.

Anyway, the general technique is simply not even have the picture box present in the first place. When a click happens on the panel, then make the picture box visible and in the same location as the panel.

In general though, you should really be learning how to use WPF or Xamarin. WinForms is at end of life.
Was This Post Helpful? 0
  • +
  • -

#4 hexagod  Icon User is offline

  • D.I.C Head

Reputation: 5
  • View blog
  • Posts: 242
  • Joined: 29-October 16

Re: VS: How Do I Make an Invisible Image Clickable?

Posted 09 November 2016 - 06:55 AM

Well eventually the idea here is I would like to program VSTs. I think WinForms will work for VSTs annd I'm not really looking to write mobile apps just yet. I tried coding android apps but the mixture of XML and Java was too much for me. I used to do some light html coding way back in the day and my only other experience is with programming trig apps for ti-83 back in 2004. Can you write apps in Xamarin using C++?

I'm checking out Xamarin VS Extension now, this is pretty cool! I really want to port my subwoofer wiring program to Android so I might try this today.
Was This Post Helpful? 0
  • +
  • -

#5 Skydiver  Icon User is offline

  • Code herder
  • member icon

Reputation: 5889
  • View blog
  • Posts: 20,095
  • Joined: 05-May 12

Re: VS: How Do I Make an Invisible Image Clickable?

Posted 09 November 2016 - 08:50 AM

My recommendation is to do most of the UI pieces in C#, then choose to do the program logic either in C# or C++ CLI. For any data access layers that need to interact with any unmanaged APIs, use C++ CLI and the IJW (It Just Works) support that it has.

Trying to do any UI with C++ CLI, and in particular WinForms, WPF, or Xamarin is like trying to do work in assembly when you have a C compiler handy. There are easier ways to do things. Use C# (or VB.NET if that floats your fancy) for this.
Was This Post Helpful? 1
  • +
  • -

Page 1 of 1