|
Hi,
I'm struggling with some code:
Dim ico As New Icon("c:\copy.ico")
Dim bmp As Bitmap()
bmp = ico.ToBitmap
bmp.MakeTransparent(bmp.GetPixel(0, 15))
bmp.Save("c:\copy.gif", Imaging.ImageFormat.Gif)
the copy.ico is the standard icon from office with on the lower left (in vs.net) the color rgb: 0 128 128. I'm trying to set this color as transparent before converting it to a gif image. Unfortunately it always turns out to be a black backgroundcolor instead of transparent. When I leave the Imaging.ImageFormat.Gif the image has a color of grey (still not transparent) and it can't be opened with photoshop (it opens when I put the ImageFormat back to gif).
Does anyone have any experience with solving this problem?
Thx, Kris.
|
|
|
|
|
We have an application that is running under .net. Most of the code is in VB.net, however, we have several cobol programs that are compiled for .net using fujitsu cobol. We are using cobol because we have several sites that we support and most sites are mainframe, so we use a case probduct that generates these core translate programs for the various platforms. When we run these programs that have been compiled for .net via Fujitsu cobol, we are getting a SQLState error of 9999B with SQLCODE error of 999999800 on an insert when we send alot of data through these programs. When we get this error, we loose the record. We are using ODBC and using a microsoft ODBC driver for SQL Server. I haven't been able to find anything on what these error codes mean. I've tried displaying the SQLMSG but there is nothing in that field when this error occurs. Has anyone seen this, and if so, do you know what it means?
|
|
|
|
|
I am trying to figure out mimic this code in the visual C++ .net anyone know how to attach this?
void GoFullScreen( HWND hwnd,int FullScreen, RECT *sizerect, int x, int y )
{
int cx, cy;
HDC DC = GetDC( NULL );
if( x == 0 || y == 0 )
{
cx = GetDeviceCaps( DC,HORZRES ) + GetSystemMetrics( SM_CXBORDER ) + 1;
cy = GetDeviceCaps( DC,VERTRES ) + GetSystemMetrics( SM_CYBORDER ) + 1;
}
else
cx = x; cy = y;
ReleaseDC( 0, DC );
if( FullScreen )
{
// Remove caption and border
SetWindowLong(hwnd, GWL_STYLE,
GetWindowLong(hwnd, GWL_STYLE) & ((~WS_CAPTION | WS_BORDER )));
// Put window on top and expand it to full screen
SetWindowPos( hwnd, HWND_TOPMOST, -(GetSystemMetrics( SM_CXBORDER ) - 1 ),
-( GetSystemMetrics( SM_CYBORDER ) - 1 ), cx+2,cy+2, SWP_NOZORDER );
}
else
{
SetWindowLong( hwnd, GWL_STYLE,
GetWindowLong( hwnd, GWL_STYLE ) | WS_CAPTION | WS_BORDER );
SetWindowPos( hwnd, HWND_NOTOPMOST, sizerect->left, sizerect->top,
sizerect->right-sizerect->left, sizerect->bottom-sizerect->top, SWP_SHOWWINDOW );
SetWindowLong( hwnd, GWL_STYLE, GetWindowLong( hwnd, GWL_STYLE ) | WS_CAPTION |
WS_BORDER | WS_SYSMENU | WS_GROUP | WS_DLGFRAME );
SetWindowPos( hwnd, HWND_TOPMOST, -GetSystemMetrics( SM_CXBORDER ) - 1,
-GetSystemMetrics( SM_CYBORDER ) - 1, cx+1+5,cy+1+30, SWP_NOZORDER );
}
}
Thanks,
Steve
|
|
|
|
|
I have found the following code here at the code project and it works fine. But, instead of displaying a MessageBox saying Already running I would like to bring the application that is already running back as the active application. I can't figure out how to do it.
CSingleInstance *si= new CSingleInstance("{6F21ABB2-9866-4b8e-8336-E6D96C300965}");
Form * MainForm = new Form1();
if(si->IsRunning())
{
MessageBox::Show(S"Already running");
MainForm->Show(); // does not work
}
else
{
Application::Run(MainForm);
}
Any ideas would be appreicated
Steve
|
|
|
|
|
Is there a better way of getting a Image 's format name (e.g., "Jpeg") than doing something like the following?
protected string GetImageFormatString (System.Drawing.Imaging.ImageFormat inFormat)
{
if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Bmp))
return "BMP";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Emf))
return "EMF";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Exif))
return "EXIF";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Gif))
return "GIF";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Icon))
return "ICON";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Jpeg))
return "JPEG";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.MemoryBmp))
return "MEMORYBMP";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Png))
return "PNG";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Tiff))
return "TIFF";
else if (inFormat.Equals (System.Drawing.Imaging.ImageFormat.Wmf))
return "WMF";
else
return "DUNNO!";
}
|
|
|
|
|
How about:
protected string GetFormatString(System.Drawing.Imaging.ImageFormat inFormat)
{
System.Drawing.ImageFormatConverter converter = new System.Drawing.ImageFormatConverter();
return converter.ConvertToString(inFormat);
}
I don't know whether it's just the light but I swear the database server gives me dirty looks everytime I wander past.
-Chris Maunder
|
|
|
|
|
That's beautiful. Thanks!
|
|
|
|
|
That's harsh David
|
|
|
|
|
Hi,
I am developing a Windows.Forms app. I am using a multi tier architecture with databinded strongly typed datasets . I am using a data access component called Facade where I have a method:
public Sub LoadCompany(ByVal companyID as Integer, ByRef ds as CompaniesDataSet)
ds.Clear()
...code to set the parameter in the select command
DACompanies.Fill(ds)
End Sub
It seems that ds.Clear() takes more and more time to complete , from a few miliseconds at start to 4-5 seconds after 100 method invokes.
Anyone has an answer to this?
Thank you,
Dan Bunea
|
|
|
|
|
I have seen other people complain about the same performance issue, namely here.[^]
|
|
|
|
|
Yes, I saw that too.
Unfortunately, I cannot use that simple solution, because I have very numerous bindings made to my DataSet.
Any other solution?
Thank you for your reply,
Dan
|
|
|
|
|
Since this seems to be a .NET Framework issue, I do not see how you can alter this behaviour without changing the structure of your code. Also, I do not know if this issue only arises on .NET v1.0 or not. You should check that, because .NET v1.1 had many perfomance and bug related improvements
|
|
|
|
|
Hi,
Thanks for your answer. I will test it on 1.1 tomorrow to see.
Dan
|
|
|
|
|
I need help folks,me and a couple of my friends spent the better part of 14 hours trying to figure out this code.The object of the code is to find a person's socioeconomic class based on their income.We are using functions for this but the problem is that when i run the program,the console prompts me for income after it has displayed the other information.Below is the code attached please if a good samaritan can look at this code and tell me what i can do to fix it.Thank you.
include "stdafx.h"
#using <mscorlib.dll>
#include <tchar.h>
using namespace System;
// Prototype for Functions
String *GetFirstName(void);
String *GetLastName(void);
String *GetSocSecNum(void);
String *GetGender(void);
int GetAge(void);
double GetIncome(void);
void DisplayOutput(String*, String*, String*, String*, int);
//This is the entry point for this application
int _tmain(void)
{
//Declaration of Variables
String *FName;
String *LName;
String *SSN;
String *Gender;
double Income;
int Age;
wchar_t Next;
do
{
FName = GetFirstName();
LName = GetLastName();
SSN = GetSocSecNum();
Gender = GetGender();
Age =GetAge();
DisplayOutput(FName, LName, SSN, Gender, Age);
Income = GetIncome();
//Request to do another individual
Console::Write(S"\n\nWould you like to process another
Individual(y/n): ");
Next=Char::Parse(Console::ReadLine());
}while (Next=='y' || Next=='Y');
if (Next=='n' || Next=='N')
//Printout of Information
Console::WriteLine(S"\nGood Bye");
return 0;
}
//Functions:
//Prompt User for First Name
String *GetFirstName(void)
{ Console::Write(S"\nEnter the Individual's First Name: ");
String *FName=Console::ReadLine();
return FName;
}
//Prompt User for Last Name
String *GetLastName(void)
{ Console::Write(S"\nEnter the Individual's Last Name: ");
String *LName=Console::ReadLine();
return LName;
}
//Prompt user for SSN
String *GetSocSecNum(void)
{ Console::Write(S"\nEnter Social Security Number: ");
String *SSN=(Console::ReadLine());
return SSN;
}
//Prompt User for Gender
String *GetGender(void)
{ Console::Write(S"\nEnter the Gender: ");
String *Gender=Console::ReadLine();
return Gender;
}
//Prompt user for Age
int GetAge(void)
{
Console::Write(S"\nEnter Individual's Age: ");
const int Age=Int32::Parse(Console::ReadLine());
return Age;
}
//Display Information
void DisplayOutput(String *FName, String *LName, String *SSN, String
*Gender, int Age)
{
Console::WriteLine(S"\n\t US Census Bureau");
Console::WriteLine(S"\tPersonal Information");
Console::Write(S"\n\tName:\t {0}", FName);
Console::Write(S"\n\tSSN:\t {0}", SSN);
Console::Write(S"\n\tGender:\t {0}", Gender);
Console::Write(S"\n\tAge:\t {0}", Age.ToString());
}
//Prompt User for Income
double GetIncome(void)
{
Console::Write(S"\nEnter Individual's Income: ");
double Income=Double::Parse(Console::ReadLine());
if
(Income>=250000){
Console::Write(S"\n\tSocioeconomic Class: Upper Income");
}
else if
(Income<250000 && Income>=100000){
Console::Write(S"\n\tSocioeconomic Class: Upper Middle Income");
}
else if
(Income<100000&&Income>=50000){
Console::Write(S"\n\tSocioeconomic Class: Middle Income");
}
else if
(Income<50000&&Income>=250000){
Console::Write(S"\n\tSocioeconomic Class: Upper Lower Income");
}
else {
(Income<25000);
Console::Write(S"\n\tSocioeconomic Class: Lower Income");}
return Income;
}
//End Function
|
|
|
|
|
It is a matter od simply changing the order on which you call your functions. In your main method, GetIncome() should appear before DisplayOutput() , not after.
|
|
|
|
|
I tried to do that but the thing is that the GetIncome() function that gets called reads a -1E and that is wromg because i want it to read the income in my IF statement.
|
|
|
|
|
Hi all,
I've been using C++ for almost everything I've done in software development, Windows or otherwise. It is only recently I've looked into .NET and C# in depth. I have a few questions that someone can hopefully shed some light on.
The main question really, is if .NET can be used somewhat like a script engine for an (unmanaged) application. For example, most games embed a scripting engine such as Lua, Tcl, or even Java in the application to allow themselves and the end users to modify the game itself, extending its replay value.
While perusing through the .NET docs, I noticed that you can dynamically load assemblies during runtime. This is where I got the idea.
Also, is there a way to have a piece of code compiled into bytecode and executed during runtime, similar to an eval() function?
-Maki
|
|
|
|
|
|
Also, JScript.NET is a .NET language, and still included the .eval method. But yeah, C# or any other .NET language should be able to dynamically execute code.
---------------------------
He who knows that enough is enough will always
have enough.
-Lao Tsu
|
|
|
|
|
Hello,
is there a way to derive C# classes form C++ classes. The C++ classes are within a MFC or standard DLL.
Thanks Maxim
|
|
|
|
|
I would have thought not. But you should be able to do it if you create a Managed C++ DLL.
Kevin
|
|
|
|
|
What would be the best place to start to implement registration for an application I have written in .Net. I would like for the application to be disabled a year after registration until a new license has been arranged.
Mike
|
|
|
|
|
Hi,
I am working on VB.NET. And used treeView and RichTextBox to dispaly the details. When I clicked the treeView node, the details of the node are displayed in the RichTextBox and some other controls. Now I selected some text in the RichTextBox and made bold and underline. Now I want to save and retrive the same. When I used RichTextBox.Rtf, then the text is converted to rtf format, but when I retrive the same and want to display in the RichTextBox again, I need to convert back to text with Bold or Underline as I set earlier.
I could set Bold and Underline to the selected text in RichTextBox using Font dialog box.
Can any one help me in doing this.
Thanks,
Sree
Sreepathi Rao
|
|
|
|
|
Your question is not very clear, how do you exactly you want to store your rtf? You can save it as file with RichTextBox.SaveFile() method.
Mazy
"A bank is a place that will lend you money if you can prove that you don't need it." - Bob Hope
|
|
|
|
|
Hi Mazdak,
Thanks for your reply. Actually I have some nodes in a TreeView, and RichTextBox control on a frame. Now as I navigate through the records in the treeview, the details of the node text are displayed in the RichTextBox. I selected the text in the RichTextBox and made Bold and some text to Underline. Then when I tabOut of the RichTextBox, the details are updated to the respective TreeView node. When I select the same TreeView node I would like to see the same text with Bold or Underline(what ever I set for the text).
For this I have written that
TreeView.SelectedNode.Text = RichTextBox.Rtf, but when I tabbed out of the RichTextBox then the TreeView node text is changed to Rtf format I think. And it is not readable and having all {.../b.../u...} etc. When I click the TreeView node again the RichTextBox also displays the same in the Rtf format and which can not be readable.
I hope you got my problem. Can you help me in this please.
|
|
|
|
|