15,891,184 members
Sign in
Sign in
Email
Password
Forgot your password?
Sign in with
home
articles
Browse Topics
>
Latest Articles
Top Articles
Posting/Update Guidelines
Article Help Forum
Submit an article or tip
Import GitHub Project
Import your Blog
quick answers
Q&A
Ask a Question
View Unanswered Questions
View All Questions
View C# questions
View C++ questions
View Javascript questions
View Visual Basic questions
View Python questions
discussions
forums
CodeProject.AI Server
All Message Boards...
Application Lifecycle
>
Running a Business
Sales / Marketing
Collaboration / Beta Testing
Work Issues
Design and Architecture
Artificial Intelligence
ASP.NET
JavaScript
Internet of Things
C / C++ / MFC
>
ATL / WTL / STL
Managed C++/CLI
C#
Free Tools
Objective-C and Swift
Database
Hardware & Devices
>
System Admin
Hosting and Servers
Java
Linux Programming
Python
.NET (Core and Framework)
Android
iOS
Mobile
WPF
Visual Basic
Web Development
Site Bugs / Suggestions
Spam and Abuse Watch
features
features
Competitions
News
The Insider Newsletter
The Daily Build Newsletter
Newsletter archive
Surveys
CodeProject Stuff
community
lounge
Who's Who
Most Valuable Professionals
The Lounge
The CodeProject Blog
Where I Am: Member Photos
The Insider News
The Weird & The Wonderful
help
?
What is 'CodeProject'?
General FAQ
Ask a Question
Bugs and Suggestions
Article Help Forum
About Us
Search within:
Articles
Quick Answers
Messages
Comments by Jibrohni (Top 39 by date)
Jibrohni
3-Dec-13 12:14pm
View
Ok, so really the client should be prevented from killing the client process via access rights and proper privileges. And not the way I'm proposing. Thanks for the advice.
Jibrohni
3-Dec-13 10:58am
View
Thanks for the response, but the idea is to prevent people from killing the client process - therefore stopping reports going to the service. So if the client process is killed, I can have it auto-restart.
Jibrohni
14-Aug-12 3:24am
View
Kenneth,
But the combobox shows the System.Windows.Media.Color selection as its itemssource, but manually changing to one of those colours in code doesn't change the selectedvalue properly.
Jibrohni
13-Aug-12 4:36am
View
Yes, I would ideally like the user to be able to select any colour. The combobox shows all System.Windows.Media.Colors, but I can't set that in code and see it work like I can with KnownColors or ConsoleColors
Jibrohni
24-Jan-12 5:13am
View
Ignore that! Thank you very much for your help, that's great!
Jibrohni
24-Jan-12 4:55am
View
That's great - it's working just as I'd hoped although it seems to replace the original datagrid with the second, rather than display both concurrently. Any ideas? They should display in different row of my grid but it doesn't seem to be working that way.
Jibrohni
12-Sep-11 5:44am
View
UPDATE: Ok, using borders on the two usercontrols it seems that one doesn't actually stretch to fill the mainGrid. So when the animation takes place it's forcing the "out" rectangle to have the dimensions of the "in" rectangle. Any easy way of preventing this? I could perhaps keep track of the dimensions in a helper class?
Jibrohni
23-Aug-11 11:17am
View
It seems to report e.originalsource as the scrollviewer. Maybe because the images are added at runtime in code behind.
Jibrohni
20-Aug-11 6:13am
View
No, I've done that already within my form, but I then wish to save that resultant image as on jpg.
Jibrohni
18-Aug-11 12:59pm
View
I've got the following code that I thought would overlay the .jpg and .png, but it's just outputting a black image. Can anyone tell me how to fix this?
public static void Overlay(Image first, Image second)
{
DrawingVisual dVis1 = new DrawingVisual();
DrawingContext drawingContext1 = dVis1.RenderOpen();
drawingContext1.DrawImage(first.Source, new Rect(0, 0, first.Width, second.Height));
RenderTargetBitmap rtb1 = new RenderTargetBitmap((int)first.ActualWidth, (int)first.ActualHeight, 96, 96, PixelFormats.Pbgra32);
rtb1.Render(dVis1);
BitmapFrame frame1 = BitmapFrame.Create(rtb1);
DrawingVisual dVis2 = new DrawingVisual();
DrawingContext drawingContext2 = dVis2.RenderOpen();
drawingContext2.DrawImage(second.Source, new Rect(0, 0, first.Width, second.Height));
RenderTargetBitmap rtb2 = new RenderTargetBitmap((int)first.ActualWidth, (int)first.ActualHeight, 96, 96, PixelFormats.Pbgra32);
rtb2.Render(dVis2);
BitmapFrame frame2 = BitmapFrame.Create(rtb2);
BitmapEncoder encoder = new PngBitmapEncoder();
encoder.Frames.Add(frame1);
encoder.Frames.Add(frame2);
//Image newImage = new Image();
//newImage.Source = rtb;
using (var stream = File.Create(@"C:\Users\Jibrohni\Documents\Visual Studio 2010\Projects\LayerImages\Images\newImage.png"))
{
encoder.Save(stream);
}
}
Jibrohni
12-Aug-11 9:28am
View
Sorry, I did specify screen width, when I meant MainWindow width.
Jibrohni
12-Aug-11 9:03am
View
I'm not looking to use resolution - I'm looking to use the current width of the MainWindow.xaml - is that not different? I thought I'd be able to bind an integer variable to the ActualWidth property of the Window and use that in the ThicknessAnimation definitions.
Jibrohni
12-Jul-11 6:41am
View
I received this on another forum, which has really helped me:
"Hi Jib,
You can name the CheckBox in the control template and use FrameworkTemplate.FindName method to retrieve the CheckBox.
I would prefer bind the CheckBox to a custom attached property on the TreeViewItem. Then we can just manupilate the TreeViewItem instead.
Retrieving TreeViewItem is not that convenient, so I would probably also bind that custom attached property to the underlying data. Then we only need to process the data.
I suggest you to check out Josh Smith's Article about CheckBoxes in a WPF TreeView. It's a very good sample.
Best regards,
" ~ courtesy of Min Zhu
Jibrohni
6-Jul-11 17:14pm
View
We're a global company with 50,000+ users world-wide. In the ideal world I agree with you, but sadly I suspect not even 1% of the users are capable of managing all of their data perfectly (or at all). They keep their main work files in their "Documents" folder, however many of them use bespoke applications that will write necessary files elsewhere. We have a huge file exclusion list, along with folder exclusions. We handle .pst files very differently to regular user files and re-attach them after the data migration. It's effectively written so that the users don't have to be torn away from their day jobs to deal with this task.
Jibrohni
6-Jul-11 4:04am
View
Mark, great response! That's given me some good routes to check-out. I thought estimating the completion time would be hit or miss, but so far it's just been miss or miss!
Many thanks,
Jib
Jibrohni
6-Jul-11 4:02am
View
We considered using the Windows utility, but this allows us to perform customisation specifically catering for our business needs. (It handles our specific file structures and files differently). Also allows us to change it further down the line where it might be necessary.
Jibrohni
28-Apr-11 4:37am
View
Nishant, I think you've better undertood my problem. But for more clarity I shall explain again.
Let's say I have 3 applications open, the topmost is Internet Explorer, second is my application, and thirdly is an Explorer window. So I wish to view my application by minimizing the IE window. For some reason this drops my application behind the Explorer window that was at the back to start with. I haven't even interacted with my application, but it's affected?
I agree that the icon issue is most likely something different. Now my application uses WindowStyle - SingleBorderWindow and implements a Glass Effect:
public static bool ExtendGlassFrame(Window window, Thickness margin)
{
if (IsGlassEnabled())
{
if (!DwmIsCompositionEnabled())
return false;
IntPtr hwnd = new WindowInteropHelper(window).Handle;
if (hwnd == IntPtr.Zero)
throw new InvalidOperationException("The Window must be shown before extending glass.");
// Set the background to transparent from both the WPF and Win32 perspectives
window.Background = Brushes.Transparent;
HwndSource.FromHwnd(hwnd).CompositionTarget.BackgroundColor = Colors.Transparent;
MARGINS margins = new MARGINS(margin);
DwmExtendFrameIntoClientArea(hwnd, ref margins);
return true;
}
else
return false;
}
Jibrohni
27-Apr-11 11:40am
View
It's a WCF/WPF application that transfers files from one pc to another. If I minimize an external window such as IE to see my applications UI then it doesn't minimize my applications window, but puts it to the back of all other open desktop windows? Sometimes it loses the start-bar icon too?
Jibrohni
27-Apr-11 10:42am
View
Thanks again John - although I think I can deal with a black check rather than the hoped for dark blue one...
Jibrohni
28-Mar-11 9:43am
View
thanks, that looks useful.
Jibrohni
10-Mar-11 9:56am
View
Thanks John. I wondered if there was some simpler attribute or keyword. May as well comment it out!
Jibrohni
10-Mar-11 9:45am
View
I found this? :
During program development, programmers often find it helpful to comment out large portions of code to prevent it from being compiled but if the code contains comments, /* and */ or //, they cannot be used to accomplish this task.
Instead, the programmer can use the following preprocessor construct:
#if 0
code prevented from compiling...
#endif
To enable the code to be compiled, the 0 in the preceding construct is replaced by 1.
Conditional compilation is commonly used as a debugging aid.
Jibrohni
8-Mar-11 10:30am
View
Thanks. C++ looks so scary compared to C#!
So in my dll would I just want to copy the example you provided but change WM_KILLFOCUS for WM_PAINT?
Jibrohni
21-Jan-11 5:27am
View
thanks, the Windows Hook part looks ideal. Plenty of other interesting stuff too - Bonus!
All the best!
Jibrohni
30-Dec-10 17:22pm
View
Deleted
The file is getting updated very frequently so I had to implement a timer that checked it with a tick frequency of 1. I copy the original file and just deal with the copied file so I don't interrupt the original.
Jibrohni
30-Dec-10 13:04pm
View
Ok thanks, I'll try that. I guess I can keep a line count so that I know if I've missed a line if necessary. I'll let you know how I get on. Thanks again.
Jibrohni
30-Dec-10 12:51pm
View
Thanks Dave,
Might it help if I make sure it's open for reading only? Then perhaps it won't be locked.
Jibrohni
22-Dec-10 6:46am
View
Ok, I'll look into that. Thanks John.
I also read that keybd_event has been deprecated by SendInput. Would you recommend switching over to this method instead?
Jibrohni
16-Dec-10 7:38am
View
Thank you very much. Although I couldn't actually find .GetPixelInformation I simply changed the line:
BitmapData data = NewBitmap.LockBits(new Rectangle(0, 0, NewBitmap.Width, NewBitmap.Height), ImageLockMode.ReadWrite, NewBitmap.PixelFormat);
to:
BitmapData data = NewBitmap.LockBits(new Rectangle(0, 0, NewBitmap.Width, NewBitmap.Height), ImageLockMode.ReadWrite, PixelFormat.Format32bppRgb);
So this keeps a standard bitdepth value.
And I agree with the error catch - I'd just put it there to see if I could handle the error (which I couldn't).
But yeah, GetPixelFormatSize didn't seem available to me???
Thanks again.
Jibrohni
25-Oct-10 4:51am
View
Here's my user control:
<usercontrol x:class="BT_Control_Panel_1._1___User_Control.User_Controls.OptionControl"
="" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" mc:ignorable="d" d:designheight="300" d:designwidth="300" width="300">
<grid name="mainOptionGrid">
<grid.rowdefinitions>
<rowdefinition name="row1">
<grid.columndefinitions>
<columndefinition name="iconCol" width="100">
<columndefinition name="textCol" width="200">
<Image Name="iconImage" Width="50" Height="50" VerticalAlignment="Top" HorizontalAlignment="Center" Margin="25,6,25,0" Panel.ZIndex="1">
<!--Icon to be inserted here-->
</Image>
<stackpanel name="textStackPanel" grid.column="1" width="200" panel.zindex="1">
<!--Add in custom textblocks here. First addition should be the header-->
<border name="bdrEdge" grid.columnspan="2" padding="20" borderthickness="1" borderbrush="Black" visibility="Hidden" panel.zindex="2">
Basically I require the border highlight event to trigger when the mouse enters the Grid's domain. This border needs to stay visible whilst also allowing for the mouseenter/mouseleave events to fire for the textblocks that I programmatically add to the textstackpanel.
But as the textblocks are the upper most entities, the grid loses it's mouseenter/mouseleave capabilities, hence no longer does the border show. And as the textblocks aren't always added in the same numbers per user control, there is quite often whitespace at the bottom of the usercontrol where the border doesn't fire if I try firing the event from the textblocks' mouseenter events.
Jibrohni
6-Jun-10 6:48am
View
I do understand that - thank you so much for your time. It works wonderfully now.
It's sometimes the simple things that frustrate me the most - although I shall probably take that comment back, as my next port of call is Delegates and Events...
Thanks again!
Jibrohni
5-Jun-10 7:53am
View
Anyone?
Jibrohni
4-Jun-10 15:44pm
View
code now included - thanks
Jibrohni
4-Jun-10 11:32am
View
exactly the same - I added 4 on formload event and it shows the same problem
Jibrohni
4-Jun-10 11:26am
View
private void btnAddPump_Click(object sender, EventArgs e)
{
//creates a petrolpump control instance and assigns a pump identifier
//works without parameters
//tlpPumpControlHolder.Controls.Add(new PetrolPump());
PetrolPump pumpInstance = new PetrolPump(_pumpIndex);
tlpPumpControlHolder.Controls.Add(pumpInstance);
//increment unique identifier
_pumpIndex++;
//needs calling to update fuel list for new pumps
UpdatePumpsWithFuels();
}
Jibrohni
4-Jun-10 11:25am
View
dynamically
Jibrohni
4-Jun-10 11:22am
View
I haven't changed anything - When I create a new Pump control I add it to a tablelayoutpanel control list. But it's as though the controls are all one and the same??
Jibrohni
28-May-10 5:54am
View
Thanks to both. I managed to get it runnning on 8 seperate threads (seemed to give the quickest results). What started at 1 min 40 is now down to 26 seconds. I'm going to start again as I'm still perfecting my use of encapsulation amongst other concepts.
I had a quick look at the parallel For but it's still a little above my station. I'll repost when I get back to this point, hopefully I'll have streamlined my code as I want it ideally down to no more than 10 seconds.
Jibrohni
25-May-10 8:39am
View
Ok, great, so how do I then draw a new user control for each of them in my usercontrol List?
PumpControlList
I.e, say I want to draw them at a width of 240 pixels each time, how would I code the following?
foreach (PumpControl p in PumpControlList)
{
}
Show More