|
Exactly the same... don't forget to set the modifier of the picturebox to public... This is not a neat way by the way... You can better create a property on FormA
<br />
public bool PictureVisibility<br />
{<br />
get { return image.Visible; }<br />
set { image.Visible = value; }<br />
}<br />
|
|
|
|
|
You have to use delegates to communicate between forms. CP has an article explaining this. Search for it
|
|
|
|
|
cocoonwls wrote: I have a question which how could i call a control (example show image at formA.PictureBox) on from other form?In VB i can call like formA.image.visible = true...But how can i do in c# window form?
Simple answer. Don't. It's a bad design and a really dirty hack.
Consider using a pattern such as the Model View Controller pattern to handle this. Your code will end up being more robust, and won't be so intertwined with variable names.
|
|
|
|
|
hi, Pete O'Hanlon,
First of all, i would like to thanks to those who answer my qustion. I am interesting in "Model View Controller" pattern, could you please give me an example depend on my case and some simple explanitation? Off course, i will do a research on this pattern.
Thanks in advanced
regards
cocoon
|
|
|
|
|
Coccoon - I'm pleased to see you wanting to take a more indepth look. It's hard to break MVC down to a really simple pattern, but this[^] article is a highly in-depth overview of the process.
|
|
|
|
|
How to Bind Controls in GridView in VB.Net or C#.Net (Windows Application)
Can Any One help me to sort out this..
|
|
|
|
|
|
Hi Adams,
Thanks yaa...
I hve gone thru the link which u sent.It's working.But for Binding controls in datagrid is thier any necessity to write this much code.Correct me if im wrong
Regds
Krish Vignesh
|
|
|
|
|
I sort of have databinding working with a set of Radio buttons in a winforms group box.
I have implemented a class with that extends INotifyPropertyChanged with seperate properties for each radio button (Demo below).
On my form I have grouped the radio buttons into a group box so that only one button can be selected at a time. Then under DataBindings I have used the advanced option to set the "checked" value and the data source update mode to "OnPropertyChanged".
The problem that I am having is that each change in selection requires the user to click twice on the destination radio button to make a selection.
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
namespace PizzaOrder
{
class OrderData : INotifyPropertyChanged
{
public OrderData()
{
m_largePizza = true;
}
#region INotifyPropertyChanged Members
public event PropertyChangedEventHandler PropertyChanged;
protected virtual void OnPropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
#endregion
private bool m_smallPizza = false;
public bool SmallPizza
{
get { return m_smallPizza; }
set
{
if (m_smallPizza != value)
{
m_smallPizza = value;
OnPropertyChanged("SmallPizza");
}
}
}
private bool m_mediumPizza = false;
public bool MediumPizza
{
get { return m_mediumPizza; }
set
{
if (m_mediumPizza != value)
{
m_mediumPizza = value;
OnPropertyChanged("MediumPizza");
}
}
}
private bool m_largePizza = false;
public bool LargePizza
{
get { return m_largePizza; }
set
{
if (m_largePizza != value)
{
m_largePizza = value;
OnPropertyChanged("LargePizza");
}
}
}
}
}
|
|
|
|
|
Hi,
I have a strainge requirement.
I have a panel which has several sub panel controls.
Now I want a list of sub panes for that I wrote "For each ctrl as Control in pnlMain.Controls" loop which is working fine but it is fetching random control not in proper order.
Is there any was that will give me list of sub controls order by their location i.e. x,y. It should retrived from left to right like the one which is on left and top most should be retrived first after that the one which is right to first one and so on...
Help me out.
Thank you in advanced.
|
|
|
|
|
Erhm, 'For Each' loops do not guarantee to retrieve objects from a collection in 'the correct' order.. However, a 'for' loop does...
<br />
For (int iControlCount = 0; iControlCount < pnlMain.Controls.Count; iControlCount++)<br />
{<br />
Control childControl = pnlMain.Controls[iControlCount];<br />
}<br />
However, since you want to retrieve the controls depening on their location, this loop still doesn't work, because the For loop will retrieve all controls in order they were added to pnlMain...
You should loop through the controls and then compare the left & top properties and sort them accordingly..
|
|
|
|
|
Yes i have wrote a sequantial sort logic for getting them in order.
Thanks.
|
|
|
|
|
Hello
I am having a button
When we place a mouse Pointer on that button then a drop down list appear
When we remove the mouse button then disappear
Please post me the answer as early as possible its urgent
|
|
|
|
|
create the onmouseover() event
|
|
|
|
|
vvsprasad wrote: I am having a button
Wow. A lot of people I know are having boys or girls. You really want to get your story published in a medical journal.
vvsprasad wrote: Please post me the answer as early as possible its urgent
When is it never urgent. And no - I'm not going to.
Finally - have you looked at the name of the forum? Do you really think this is the most appropriate place to post this question?
|
|
|
|
|
This entire thread...priceless
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote: This entire thread...priceless
It is good isn't it?
|
|
|
|
|
Pete O'Hanlon wrote: vvsprasad wrote:
I am having a button
Wow. A lot of people I know are having boys or girls.
Best response ever!
|
|
|
|
|
Actually it reminds me of when I was learning Spanish. I was standing in line at a McDonalds and I was practicing with my (then) Spanish girlfriend and I said "Voy a tener un Big Mac" (Lit. I am going to have a big mac) and she burst into a fit of giggles. It seems that I said I was going to give birth to a big mac. What I should have said was "Voy a tomar un Big Mac" (Lit. I am going to take a big mac).
|
|
|
|
|
Colin Angus Mackay wrote: (Lit. I am going to take a big mac).
Is this what leads to :
Colin Angus Mackay wrote: It seems that I said I was going to give birth to a big mac
?
Man - what an image that brings to mind.
|
|
|
|
|
Hello Friend!
I've built a windows application.
now I want to show any gif image while system is busy to save data in data base. after completing save operation the image will be invisible. again it will be visible during saving data.
How can I do this?
Please, help me.
Thanks!!!!!!!!!!
|
|
|
|
|
create a backgroundworker for saving the data.
Before calling the RunWorkerAsync() method show your image.
In the BackGroundWorker_RunWorkerCompleted Method you can hide the image again.
You use the BGW (backGroundWorker) to prevent a freeze of the form
If you use a _RunWorkerCompleted-method (reporting the progress) you can even change the image into another image!
|
|
|
|
|
Hi,
Using SourceGrid, unable to use "CopyPasteSelection" from ContextMenuStyle enum....
I am using SourceGrid to display my records, with editable cell. I have a requirement to copy/paste existing row in new row. But here this grid has been little bit customized for some purpose. We are using another class file to doing this, and this class generates the object of Grid. Now this is the problem here, I am not getting the enum item to set the "ContextMenuStyle".
I can set SelectionMode like this :
this.Selection.SelectionMode = GridSelectionMode.Row;
but unable to set ContextMenuStyle :
this."ContextMenuStyle:NOT ABLE TO FIND THE ENUM IN THE LIST TO SET" = ????
Please someone help, or give some idea to resolve this Issues. I am not sure that this been affected by customization.
Thanks in advance.
Kind Regards: Madhusudan
modified on Tuesday, April 1, 2008 8:05 AM
|
|
|
|
|
i have a splitcontainer on my mdi-parent form,
i want to use the right panel (panel2) as the mdi client area
i tried the following code:
childform.MdiParent = this;
childform.Parent = this.splitContainer1.Panel2;
childform.Show();
I can now select the client window inside the panel and drag it.
but the border of the client window still appears like it is not active.
what am i doing wrong?
|
|
|
|
|
Apparently, the MdiClient control (which contains MDI children) is docked to fill the parent window. What I have done in the past is create a regular Splitter[^] (not a SplitContainer ) and dock it to one side of the main form (left in your case), next to the panel you want to resize. That way you get a resizable panel docked to the side, with the MdiClient control covering the rest of your window.
I hope this helps!
|
|
|
|