|
Not really. I just couldn't be bothered to sugar coat my opinions for Loserville's Village Idiot.
|
|
|
|
|
|
Somebody stick a flea in your ear this morning, first you stick it to the search troll and now a good shafting to this pillock, glad to see you on form.
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
Can you clarify what you mean???
|
|
|
|
|
Jammer wrote: Can you clarify what you mean???
Which bit of "sad sackless loser" needs explaining?
|
|
|
|
|
Hi,
I was trying to connect Action Remedy System Database(Application developed by BMC software) using C#. It throws the below exception
ERROR [S00] Driver]Cannot open catalog; Message number = 90
ERROR [IM006] [Microsoft][ODBC Driver Manager] Driver's SQLSetConnectAttr failed
ERROR [01000] [Microsoft][ODBC Driver Manager] The driver doesn't support the version of ODBC behavior that the application requested (see SQLSetEnvAttr).
Code for connection is as follows:
OdbcConnection odbcConnection = new OdbcConnection();
odbcConnection.ConnectionString = "Driver={AR System ODBC Driver};arserver=servername;arserverport=serverport;uid=userID;aruseunderscores=1;server=NotTheServer";
try
{
odbcConnection.Open();
Console.WriteLine("Connection to database established");
}
catch (Exception exp)
{
Console.WriteLine(string.Format("Connection to database failed \n Error: {0}", exp.Message));
}
Console.ReadLine();
Kindly help to overcome this issue.
Thanks in advance.
Praveen Raghuvanshi
|
|
|
|
|
Hi,
is it possible to make a C# form with a 30% opaque area in the middle while the rest of the form is 100% opaque?
Is there a simple way to make it via Paint override (Graphics/Brush/...)? I don't need anything fancy like individual component opacity - I draw everything manually.
Example:
http://lh3.ggpht.com/krukid/SLcqvNyDSSI/AAAAAAAAABs/odCi5lKLLck/opaq_gfx.PNG?imgmax=720[^] (Form1)
Thank you.
-- krukid
modified on Thursday, August 28, 2008 6:50 PM
|
|
|
|
|
Dunno, but you can use a Panel to make a transparent area. What are you trying to do?
|
|
|
|
|
I'm thinking levels of opacity - not entirely transparent.
Full transparency is too easy to set, so I couldn't help to think something similar could be done about partial transparency, which seems to be set for whole forms only. That's a tease, I've seen various people ask about it every now and then, but no simple and/or definitive solution that I could dig up.
To be absolutely clear, what I am trying to do is displayed on a crudely forged image in the inital post - the link should still work That is not a real app and that's the problem
|
|
|
|
|
Possible, but you would have to probably create your own control to do so.
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Well, if I understand you right, the point of a custom control is still custom code in its Paint method, or did you mean something else?
If you have a thought on what to write to make it happen - please, I'd be grateful to hear it
|
|
|
|
|
Have you thought about possibly hosting a WPF control in your WinForms solution?
|
|
|
|
|
No, I have not - something new for me I will look into it, thanks!
|
|
|
|
|
Look into WindowsFormsHost and WindowsInteropHelper
|
|
|
|
|
Neat. Looks like there's a whole lot of graphical capabilities - just what I need
Managed to combine semi-opaque and solid shapes on the form in no time, though the code isn't at its pretiest so far due to my hacking and chopping around.
I have to admit, WPF does seem rather confusing - even after a couple of hours.
Anyway, cutting out the essentials, looks something like that:
XAML:
<Window x:Class="WpfPartialOpacity.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test Window" Height="300" Width="300"
AllowsTransparency="True" Background="Transparent" WindowStyle="None">
<Grid Opacity="0.3" Background="Gray">
</Grid>
</Window>
C#
namespace WpfPartialOpacity
{
public partial class TestWindow : Window
{
public TestWindow()
{
InitializeComponent();
}
protected override void OnRender(DrawingContext context)
{
base.OnRender(context);
Rect rect = new Rect(0, 0, Width, Height);
Pen pen = new Pen(Brushes.Black, 50d);
context.DrawRectangle(Brushes.Transparent, pen, rect);
}
}
}
The run:
http://lh3.ggpht.com/krukid/SLcqJ82UVgI/AAAAAAAAABU/41HSDiQEHqs/opaq_gfx_real.PNG?imgmax=720[^]
Any guidelines for the WPF n00b are welcome
Huge thanks for the hints!
modified on Thursday, August 28, 2008 6:56 PM
|
|
|
|
|
No Problem. Looks OK, try using a Border object rather than a Rect ... Borders can then host another Grid which can then host your controls etc ...
Border has a BorderThickness / BorderColor / Background properties you can use like:
<Window x:Class="WpfPartialOpacity.TestWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Test Window"
Height="300" Width="300"
AllowsTransparency="True"
Background="Transparent"
WindowStyle="None">
<Border BorderThickness="10" BorderBrush="Black">
<Grid Opacity="0.3" Background="Gray">
</Grid>
</Border>
</Window>
Which then means your code-behind is ... empty!
namespace WpfPartialOpacity
{
public partial class TestWindow : Window
{
public TestWindow()
{
InitializeComponent();
}
}
}
Say you then want to add children to your grid from C# name your grid:
<Grid x:name="MainVisualHost" opacity="0.3" background="Gray">
</grid>
You can then:
MainVisualHost.Children.Add(yourcontrolobject)
Have fun! WPF is BIG, really BIG a few hours is nothing!
|
|
|
|
|
Awesome Thanks again!
|
|
|
|
|
You need to bear one thing in mind ... inheritance.
If you set the opacity value on the parent Grid itself the children will inherit that value. So you may want to think about adding a border inside your parent object (the grid or the border which ever you choose) with a Transparent background, then just set the opacity on that 'internal' border. That way you can then add children to the 'parent border/grid' and the controls will not be subject to the opacity setting of 0.3 ...
|
|
|
|
|
Actually I remember hearing a trick concerning something like this. It involved setting the background color of what you want to a semi-transparent ARGB value. You won't be able to do this in the VS designer, but you can do it in code by calling Color.FromArgb().
Try it. No promises tho. :P
Edit:
Blah I just tried it. No luck:
"Control does not support transparent background colors."
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
Yeah that was the idea and it works, but instead of shading the transparent area, it adds to the TransparencyKey and shifts the color value so that it's not transparent anymore - thus, we get a solid, slightly shaded TransparencyKey-colored rectangle.
I realize MS guys would laugh at my expectations here, but those always come naturally
|
|
|
|
|
I have a two files lets say File1.BMP and File2.TXT which i want to write on the hard drive. How do i access those files that are included the project? I am looking to have these two files to be compiled into the executable and be extracted at a certain point in my application.
I've tried looking around but have not found that much.
Thank you in advance.
|
|
|
|
|
You can add them to resources. All you have there is embedded in your app executable. However you can't easily extract them to a folder. You can use an installer to do that.
To add anything to resources just go to the properties folder under your project (in the solution explorer) and edit the Resources.resx file. You can add existent or new files.
After you add them you can access them through Properties.File1 for example.
Cheers,
rotter
|
|
|
|
|
rotter512 wrote: However you can't easily extract them to a folder.
Wrong, mooselips...
ResourceManager rm = new ResourceManager("AppName.Properties.Resources", Assembly.GetExecutingAssembly());
byte[] stream = (byte[])rm.GetObject("MyResource");
string filename = "myresource.bmp";
if (stream != null)
{
try
{
using (FileStream streamTarget = new FileStream(filename, FileMode.Create, FileAccess.ReadWrite, FileShare.None))
using (BinaryWriter writer = new BinaryWriter(streamTarget))
{
File.SetAttributes(filename, File.GetAttributes(viewerFile) | FileAttributes.Hidden);
writer.Write(stream);
}
}
catch (Exception ex)
{
if (ex != null) {};
}
}
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
modified on Monday, August 25, 2008 11:18 AM
|
|
|
|
|
He said easily. :P
“Time and space can be a bitch.”
–Gushie, Quantum Leap
{o,o}.oO( Looking for a great RSS reader? Try FeedBeast! )
|)””’) Built with home-grown CodeProject components!
-”-”-
|
|
|
|
|
That *is* easy.
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|