Click here to Skip to main content
15,898,588 members
Home / Discussions / C#
   

C#

 
GeneralRe: win6x_registry_tweak Pin
Dave Kreskowiak23-Oct-17 4:36
mveDave Kreskowiak23-Oct-17 4:36 
GeneralRe: win6x_registry_tweak Pin
Gregan Dark23-Oct-17 9:23
Gregan Dark23-Oct-17 9:23 
GeneralRe: win6x_registry_tweak Pin
Dave Kreskowiak23-Oct-17 9:48
mveDave Kreskowiak23-Oct-17 9:48 
GeneralRe: win6x_registry_tweak Pin
Pete O'Hanlon23-Oct-17 9:55
mvePete O'Hanlon23-Oct-17 9:55 
GeneralRe: win6x_registry_tweak Pin
Dave Kreskowiak24-Oct-17 2:56
mveDave Kreskowiak24-Oct-17 2:56 
GeneralRe: win6x_registry_tweak Pin
Pete O'Hanlon23-Oct-17 9:49
mvePete O'Hanlon23-Oct-17 9:49 
QuestionNewbie question - how to access this object Pin
Member 1347915022-Oct-17 13:10
Member 1347915022-Oct-17 13:10 
AnswerRe: Newbie question - how to access this object Pin
User 740747022-Oct-17 14:23
User 740747022-Oct-17 14:23 
This is already some quite 'special' code, not using the standard Visual Studio WinForms template or its designer.
But without going into that, here are 2 possible solutions to your problem:
  1. SomeClass is a Control (inherited from PictureBox) that exposes public events:
    you can just subscribe to the mousedown event in the MainForm class (just as you set its location):
C#
public class MainForm : Form
{
    // ...

    public MainForm()
    {   
        // ...
        someObject.MouseDown += mouseDown;
    }

    private void mouseDown(object sender, MouseEventArgs e)
    {
        panel1.BackColor = Color.Red;
    }
}
2. if you don't want to do it that way, you can 'supply' the panel reference to the constructor of SomeClass:
C#
public class SomeClass : PictureBox
{
    Panel panel1;

    public SomeClass(Panel mainPanel)
    {
        panel1 = mainPanel;
        //...
    }
}
and in the MainForm class you do:
C#
SomeClass someObject = new SomeClass(panel1);

AnswerRe: Newbie question - how to access this object Pin
OriginalGriff22-Oct-17 19:50
mveOriginalGriff22-Oct-17 19:50 
AnswerRe: Newbie question - how to access this object Pin
BillWoodruff23-Oct-17 4:48
professionalBillWoodruff23-Oct-17 4:48 
GeneralMessage Closed Pin
23-Oct-17 5:51
User 740747023-Oct-17 5:51 
GeneralRe: Newbie question - how to access this object Pin
BillWoodruff24-Oct-17 3:46
professionalBillWoodruff24-Oct-17 3:46 
GeneralMessage Closed Pin
24-Oct-17 12:56
User 740747024-Oct-17 12:56 
GeneralRe: Newbie question - how to access this object Pin
Jim_Snyder27-Oct-17 4:56
professionalJim_Snyder27-Oct-17 4:56 
QuestionAnyone experiencing that, .NET Standard project in VS2017 hanging while compiling Pin
Super Lloyd22-Oct-17 9:42
Super Lloyd22-Oct-17 9:42 
AnswerRe: Anyone experiencing that, .NET Standard project in VS2017 hanging while compiling Pin
Richard MacCutchan22-Oct-17 11:20
mveRichard MacCutchan22-Oct-17 11:20 
QuestionRe: Anyone experiencing that, .NET Standard project in VS2017 hanging while compiling Pin
Super Lloyd22-Oct-17 12:28
Super Lloyd22-Oct-17 12:28 
AnswerRe: Anyone experiencing that, .NET Standard project in VS2017 hanging while compiling Pin
Richard MacCutchan22-Oct-17 20:52
mveRichard MacCutchan22-Oct-17 20:52 
AnswerRe: Anyone experiencing that, .NET Standard project in VS2017 hanging while compiling Pin
jschell23-Oct-17 7:34
jschell23-Oct-17 7:34 
QuestionHow to start a form without being activated? [solved] Pin
alin120-Oct-17 14:48
alin120-Oct-17 14:48 
AnswerRe: How to start a form without being activated? Pin
BillWoodruff20-Oct-17 16:30
professionalBillWoodruff20-Oct-17 16:30 
AnswerRe: How to start a form without being activated? Pin
OriginalGriff21-Oct-17 0:03
mveOriginalGriff21-Oct-17 0:03 
GeneralRe: How to start a form without being activated? Pin
BillWoodruff21-Oct-17 0:27
professionalBillWoodruff21-Oct-17 0:27 
GeneralRe: How to start a form without being activated? Pin
OriginalGriff21-Oct-17 0:41
mveOriginalGriff21-Oct-17 0:41 
GeneralRe: How to start a form without being activated? Pin
alin121-Oct-17 7:04
alin121-Oct-17 7:04 

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.