I'm working with ActiViz .NET (VTK) and have a small problem.
When I register a event (for ex. the LeftButtonReleaseEvt), I can't find out where on the RenderWindowControl I clicked. The event is called.
...
rwcVtk.RenderWindow.GetInteractor().LeftButtonPressEvt += new vtkObject.vtkObjectEventHandler(RenderWindow_LeftButtonReleaseEvt);
}
void RenderWindow_LeftButtonReleaseEvt(vtkObject sender, vtkObjectEventArgs e)
{
//TODO: Where did i click?
}
Can somebody help me?
There isn't much documentation on that out there I think.
I didn't try out this, but maybe your are looking for this property:
this.Interactor.GetLastEventPosition();
To see this working go to your Activiz Examples folder "Examples\VolumeRendering\CS" and see that example.
Related
So recently i have been trying to get into C# programming after spending alot of time in C.
Naturally i jumped right into learning a few new things, in this case i wanted to try some forms, classes and events - simple right?
Well apparently not, i am rather dumbfounded, i have been running the program, analyzing step by step, the tick event triggers as its supposed to, but the picture in the picturebox is not updated.
And here is the kicker, i made a button that runs almost identical code, and that works, what gives? i can barely get my head around it as it is.
http://pastebin.com/psYzQSLE - here is the code i am running currently.
And here is the specific segment of code i cant get to behave.
private void timer1_Tick(object sender, EventArgs e)
{
if(swapper)
{
swapper = false;
pictureBox1.Image = ima1;
pictureBox1.Refresh();
}
else
{
swapper = true;
pictureBox1.Image = ima2;
pictureBox1.Refresh();
}
}
Your code looks fine, and is working for me. I suspect the Form1_Load method is not hooked up to the form's Loaded event; you can check that in the designer.
Okay, i figured it out!
Being unfamilar with the design document, the timer was added to the tick in there and i also added it myself in my code, the result being a timer that triggers twice immediately, and thus i saw no result.
Problem is solved now, thanks for the warm welcome :)
I have a question regarding the ThemeManager class of MahApps.Metro.
I created a simple wpf application that has a MetroWindow as root element, and its working perfectly.
Now I am trying to change the theme/style of the application with a click on a button.
This is my code:
private void Button_OnClick (object sender,RoutedEventArgs e)
{
ThemeManager.ChangeAppStyle (Application.Current,ThemeManager.Accents.First(acc=>acc.Name=="Red"),ThemeManager.AppThemes.Last());
}
I know its a bad practice to do it like that but its just a concept for what i am trying to do.
I put a breakpoint on that line and the debugger does reach it, but it does nothing :(
Con someone please help me?
Thanks a lot!
So what I want to do is allow AutoSorting that's built into GridView, but whenever autosort happens, for it to call a method (recolor();) to recolor the results appropriately. Probably an easy question, but I don't see any easy way to do it.
It is a .net form (a .dll I'm using with another application), I have not attempted any code yet, as I don't want to break what I already have set up.
EDIT ANSWER
So, I figured it out in the designer I should have put:
this.dataGridView1.ColumnHeaderMouseClick += new System.Windows.Forms.DataGridViewCellMouseEventHandler(this.dataGridView1_ColumnHeaderMouseClick);
And then in the form this will work :
private void dataGridView1_ColumnHeaderMouseClick(object sender, DataGridViewCellMouseEventArgs e)
{
recolor();
}
Call recolor() in the event GridView.OnSorting. See: this article on MSDN.
I want to implement a silverlight based component for Co-Browsing.
Can you please help me get started?
Thanks
Okay, first things first. I'm going to assume that you already figured out how to get commands from the "admin" to the "client". If this is not true, just let me know.
Second: this is an outrageously difficult thing to build
Third: here's a start ;-)
To use the default SL4 webbrowser component, you need to run your application out-of-browser with elevated trust. So you should set that up first.
In my test app, I added a webbrowser component and subscribed to the LoadCompleted event.
In your eventhandler you can use something like:
void webBrowser1_LoadCompleted(object sender, System.Windows.Navigation.NavigationEventArgs e)
{
//Pseudo code event to update clients
OnAdminNavigated(e.Uri);
}
Clientside you would use something like:
void adminNavigated(MyCustomNavigationEventArgs e)
{
clientBrowser.Navigate(e.Uri);
}
Hope this helps.
I am working with a WinForm application that was designed by the previous, now unreachable, develeper. In this app farms are embedded in TabControls through some custom code. My question is, Can anyone help to try and explain why there is a custom _Paint() function in each form that is called from the Load event for that form.
This Paint() method is not actually tied to the form outside of the previously stated daisy chaining. What purpose could this serve? In the code below you will notice That I created a Paint() event and moved part of the code there and everything still seems "Peachy."
Can anyone help me to understand this? Is it simply because of the Public declaration on the custom one?
private void frmWWCModuleHost_Load(object sender, EventArgs e)
{
FormPaint();
}
public void FormPaint()
{
WinFormCustomHandling.ShowFormInContainerControl(tpgCaseNotes, new FrmCaseNotes());
WinFormCustomHandling.ShowFormInContainerControl(tpgMCP, _frmWWCMCPHost);
WinFormCustomHandling.ShowFormInContainerControl(tpgMember, _frmWWCMemberHost);
WinFormCustomHandling.ShowFormInContainerControl(tpgEnrollment, _frmWWCEnrollmentHost);
WinFormCustomHandling.ShowFormInContainerControl(tpgWWCSearch,_frmWWCSearch);
WinFormCustomHandling.ShowFormInContainerControl(tpgAudit, FrmAudit);
// Call each top-Level (visible) tabpage's form FormPaint()
_frmWWCMCPHost.FormPaint();
}
private void FrmModuleHost_Paint(object sender, PaintEventArgs e)
{
new psTabRenderer(tclWWCModuleHost, Color.LightSteelBlue, Color.Tomato, Color.Black, Color.Black);
}
The code looks weird, for sure, but I think you are reading more into the name of the "FormPaint" method than you should. To me, it appears to be just an "initialization" routine, having essentially nothing to do with the Paint event (other than the name).
Also, it appears that any code inside FormPaint is called one time per form, versus any code inside the Paint event handler being called...a lot.
I'm not sure you posted enough code for it to be understandable. But in general, if you feel the code is unnatural, go ahead and refactor it... one step at the time.