|
Heath Stewart wrote:
Either make a couple of images and use them on a couple of Button objects, or set the Font for the Button objects to Wingdings or something and choose the appropriate character for an up or down button (there are several). Use the Character Map application in Windows to help find which one is appropriate (Start->Programs->Accessories->System Tools->Character Map).
doh...
Thanks, I didn't think that far.
Rickard Andersson
Here is my card, contact me later!
UIN: 50302279
Sonork: 37318
|
|
|
|
|
In my app I want to create some tool windows, which can be auto-hide and docking like that tool windows of VS.net, with VC++.net. But I looked the MSDN and some samples, the tool window is like only to be created as addin to be used by other app. Please tell me how to do, thank you very much.
If you have some samples , could you send to me?
|
|
|
|
|
There's plenty of samples in this site, though most are in C#. If you truly understand .NET, however, you won't have any trouble translating this code to VC++.NET, because they all have equal access to the .NET base class library (BCL), or any other assembly for that matter.
Also, this is the C# forum. This question would've been more appropriate in the Managed C++ forum.
There are also existing libraries that do this, including a decently-priced commercial one developed by one of CodeProject's members, Phil Wright, at http://www.dotnetmagic.com[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
you can go to http://www.csdn.net and to search it that you want
|
|
|
|
|
Hi out there!
Anyone having a suggestion why this code doesn't work?
The transformer doesn't seem to interpret xsl.
<br />
XslTransform xslt = new XslTransform();<br />
xslt.Load(this.xslFile);<br />
<br />
XPathDocument mydata = new XPathDocument(this.xmlfile);<br />
<br />
StreamWriter sw = new StreamWriter(this.outFile);<br />
XmlWriter writer = new XmlTextWriter(sw);<br />
<br />
xslt.Transform(mydata, null, writer, null);<br />
<br />
<br />
writer.Close();<br />
Help appreciated a lot.
|
|
|
|
|
The code looks fine - your XSLT is probably wrong. Make sure you use XPath expressions in your XSLT document that use a namespace prefix assigned to the same namespace as the namespace-qualified elements and attributes in your XML document.
You can test to make sure it is correct by adding <?xml-stylesheet href="yourxsltfile.xslt" type="text/xsl"> to the top of your XML document, where "yourxsltfile.xslt" is an absolute or relative path to your XSLT document. Then open the XML document in Internet Explorer and see if you get what you want.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
how we can use winapi methods in c#
regards' Amir Jalaly
|
|
|
|
|
Nick Seng already gave you a helpful link below. P/Invoke uses the DllImportAttribute on external function declarations. You should read the SDK documentation for the System.Runtime.InteropServices namespace elements, include the MarshalAsAttribute which helps the framework marshal parameters (when necessary) for native functions and COM interop.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How we can shut down the computer programically?
or Log off?
Regards' Amir Jalaly
|
|
|
|
|
ExitWindowsEx WinAPI function
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
I can not find this method and when i write method name in code i recieved compile error
Regards' Amir JAlaly
|
|
|
|
|
It's a function in the User32.lib API. Use P/Invoke to call this function from a C# Application.
Read more about P/Invoke here[^]
and ExitWindowsEx here[^]
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
Hi, All.
I have a question about comparing the contents of ArrayList.
I use an arraylist to store up some strings, and the that arraylist is stored inside a new arraylist.
e.g.
ArrayList final= new ArrayList();
//--- loop ---//
ArrayList str = new ArrayList();
str.Add("xxx"); // storing string
str.Add("yyy");
.....
final.Add(str);
//-------------//
The "final" arraylist collects all "str" arraylist, and now I want to check whether the "final" contains one arrayList. It seems doesn't work, am I do it worng??
I use :
if(final.Contains(newstr)) // newstr is a new created arraylist
{
// do something here....
}
Please help~~
|
|
|
|
|
Have you added newStr into final yet? If not, your expression will return false.
ArrayList.Contains function will only return true if you pass in the reference of an object that is within the arraylist. For example, if your code had been written like so:
....
ArrayList tempRef = str;
final.Add(str);
....
the expression final.Contains(tempRef) would return true.
HTH.
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
I don't know why still does work ?
in my program:
I store create an arraylist to store up the some string of ListView item data, and I assign that arraylist as ListViewItem.Tag
Finally, when I multiple selected the ListViewItem, I use a new ArrayList called "Final" to collect selected Item.Tag:
for(int i=0; i< List.Items.Count; i++)
{
Final.Add( (ArrayList) List.Items[i].Tag );
}
I want to check if "Final" contains any Tags new ListView;
ArrayList selectedItems = Final;
if(selectedItems.Contains(Items[i].Tag))
Items[i].BackColor = Color.Orange;
I have used debug window to check, they contains same data inside actually, but seems wrong data type; the selectedItems only shows that it contains "system.object", however, Items[i].Tag contains "System.Collections.ArrayList"??
Is it a mistake that I made?
Please help ~~ Thank you
|
|
|
|
|
First of all, some suggestions.
this line:
Final.Add( (ArrayList) List.Items[i].Tag );
Don't bother casting the Tag object to arraylist as ArrayList Items are of the System.Object Class. What you are doing is casting from Object to Arraylist, and then back to object.
azusakt wrote:
I want to check if "Final" contains any Tags new ListView;
I'm not sure I understand this sentence. Do you mean that the you now have a different ListView? If so, you should remember that ArrayList.Contains checks for reference, not values. For example:
a.Add("123");
b.Add("123");
c.Add(a);
The expression c.Contains(b) would return false even thought a and b contains the same value, just because a and b not the same reference.
I hope I'm not confusing you
"if you vote me down, I shall become more powerful than you can possibly imagine" - Michael P. Butler.
Support Bone
|
|
|
|
|
Hello,
I want to focus a perticular cell in a datagrid control. Its not a difficult task, but i don't want to surf my time, so if anyone knows this thing, please reply soon.
Thanks.
|
|
|
|
|
So you think posting a simple question to the forums is faster than looking at the properties and methods for the DataGrid class? DataGrid.CurrentCell should stick out like a sore thumb.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hello,
Infact, i already tried it. But, its not focusing on a perticular cell when i do this,
DataGrid.CurrentCell.RowNumber = RowNumber;
DataGrid.CurrentCell.ColumnNumber = ColumnNumber;
It gives me an exception. I want to focus a perticular cell during runtime.
|
|
|
|
|
The property type (DataGridCell ) is a struct, not a reference type, so you just can't change the properties/fields of it because you actually are changing the values for a copy of the DataGridCell . Instead, you must do the following:
DataGridCell cell = new DataGridCell(row, column);
dataGrid1.CurrentCell = cell; This was also done in a similar way in the example code for the SDK documentation of the DataGrid.CurrentCell property.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hay,
Thank u for your reply to my simple questions. Now, let me tell u my exact problem.
I have four columns in a datagrid. When i finishes my entries in a a perticular row and press Enter. By default the DataGrid creates a new empty row. I want to focus the second column cell of that new row whenever i press Enter.
I have already tested this,
DataGridCell cell = new DataGridCell(int rownum, int colnum);
DataGrid.CurrentCell = cell;
I tried this thing in a 'RowChanged' event of the dataset binded with that DataGrid.
Dataset.Table.RowChanged += new EventHandler(DataSet_RowChanged);
It creates Two or Three empty rows and then focus the last new line cell.
Try this thing, if you have understood my problem and reply soon.
Thanks.
|
|
|
|
|
Because the new row isn't actually a row. Especially, the event handler you created on the DataSet won't work because a row hasn't been added until you actually start entering data for the new row (or edit an existing row) and commit it.
You might be interested in getting a spreadsheet-type control, such as the one from FarPoint Technologies[^].
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Does anyone know an easy way to Print a form with controls in C# ?
Paul
|
|
|
|
|
There's no easy way to do it. You'll have to P/Invoke many different native methods from the Gdi32.dll library, such as BitBlt , GetDeviceCaps , CreateCompatibleDC , CreateCompatibleBitmap , and SelectObject . Some others might be necessary, too. Just google for keywords like HDC, screen, printer, and bitblt. Most examples are in C++ but - with the power of P/Invoking - you should be able to do what you want.
Here's a few hints: you can get the HDC for a Graphics object by calling Graphics.GetHdc() . Both the Form.Paint and PrintDocument.PrintPage events pass a Graphics object in the second parameter (as a property). In the PrintDocument.PrintPage event, you can call Form.CreateGraphics() (actually inherited from the Control class) to get a Graphics object at that point.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
/****
Here is a sample form with a Print button and couple of controls. When you hit print button, it prints the form with the controls and the contents if any on the control.
To check it, start a new C# windows aplication project and replace Form1.cs with following contents.
Things to be noted are :-
Functions:
btnPrint_Click
CaptureScreen
printDocument1_PrintPage
Objects and declaration
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern long BitBlt (IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
private Bitmap memoryImage;
private System.Drawing.Printing.PrintDocument printDocument1;
If u have any questions, let me know.
Ruchi
****/
using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
namespace WindowsApplication2
{
/// <summary>
/// Summary description for Form1.
/// </summary>
public class Form1 : System.Windows.Forms.Form
{
[System.Runtime.InteropServices.DllImport("gdi32.dll")]
public static extern long BitBlt (IntPtr hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, IntPtr hdcSrc, int nXSrc, int nYSrc, int dwRop);
private Bitmap memoryImage;
private System.Windows.Forms.DateTimePicker dateTimePicker1;
private System.Windows.Forms.TextBox textBox1;
private System.Windows.Forms.Button btnPrint;
private System.Drawing.Printing.PrintDocument printDocument1;
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.Container components = null;
public Form1()
{
//
// Required for Windows Form Designer support
//
InitializeComponent();
//
// TODO: Add any constructor code after InitializeComponent call
//
}
/// <summary>
/// Clean up any resources being used.
/// </summary>
protected override void Dispose( bool disposing )
{
if( disposing )
{
if (components != null)
{
components.Dispose();
}
}
base.Dispose( disposing );
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.dateTimePicker1 = new System.Windows.Forms.DateTimePicker();
this.textBox1 = new System.Windows.Forms.TextBox();
this.btnPrint = new System.Windows.Forms.Button();
this.printDocument1 = new System.Drawing.Printing.PrintDocument();
this.SuspendLayout();
//
// dateTimePicker1
//
this.dateTimePicker1.Location = new System.Drawing.Point(48, 72);
this.dateTimePicker1.Name = "dateTimePicker1";
this.dateTimePicker1.TabIndex = 0;
this.dateTimePicker1.ValueChanged += new System.EventHandler(this.dateTimePicker1_ValueChanged);
//
// textBox1
//
this.textBox1.BackColor = System.Drawing.SystemColors.Info;
this.textBox1.Location = new System.Drawing.Point(32, 128);
this.textBox1.Name = "textBox1";
this.textBox1.Size = new System.Drawing.Size(160, 20);
this.textBox1.TabIndex = 1;
this.textBox1.Text = "textBox1";
//
// btnPrint
//
this.btnPrint.Location = new System.Drawing.Point(192, 216);
this.btnPrint.Name = "btnPrint";
this.btnPrint.TabIndex = 2;
this.btnPrint.Text = "Print";
this.btnPrint.Click += new System.EventHandler(this.btnPrint_Click);
//
// printDocument1
//
this.printDocument1.PrintPage += new System.Drawing.Printing.PrintPageEventHandler(this.printDocument1_PrintPage);
//
// Form1
//
this.AutoScaleBaseSize = new System.Drawing.Size(5, 13);
this.ClientSize = new System.Drawing.Size(292, 273);
this.Controls.AddRange(new System.Windows.Forms.Control[] {
this.btnPrint,
this.textBox1,
this.dateTimePicker1});
this.Name = "Form1";
this.Text = "Form1";
this.ResumeLayout(false);
}
#endregion
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.Run(new Form1());
}
private void showmessage()
{
MessageBox.Show("Testing 123");
}
private void dateTimePicker1_ValueChanged(object sender, System.EventArgs e)
{
//MessageBox.Show("Testing 123");
showmessage();
//System.Console.WriteLine("Testing 123");
}
private void CaptureScreen()
{
Graphics mygraphics = this.CreateGraphics();
Size s = this.Size;
memoryImage = new Bitmap(s.Width, s.Height, mygraphics);
Graphics memoryGraphics = Graphics.FromImage(memoryImage);
IntPtr dc1 = mygraphics.GetHdc();
IntPtr dc2 = memoryGraphics.GetHdc();
BitBlt(dc2, 0, 0, this.ClientRectangle.Width, this.ClientRectangle.Height, dc1, 0, 0, 13369376);
mygraphics.ReleaseHdc(dc1);
memoryGraphics.ReleaseHdc(dc2);
}
private void printDocument1_PrintPage(System.Object sender, System.Drawing.Printing.PrintPageEventArgs e)
{
Font f = new Font("Arial",12);
e.Graphics.DrawString("Opetion Message if I want to be printed", f, Brushes.Black, 300, 50);
e.Graphics.DrawImage(memoryImage,75, 75);
}
private void btnPrint_Click(System.Object sender, System.EventArgs e)
{
CaptureScreen();
PrintDialog printDialog1 = new PrintDialog();
printDialog1.Document = printDocument1;
DialogResult result = printDialog1.ShowDialog();
if (result == DialogResult.OK)
{
printDocument1.Print();
}
//printDocument1.Print();
}
}
}
|
|
|
|
|