比如说
//PerPixelAlphaForm 是个窗体
PerPixelAlphaForm alphaWindow = null;
private void btnShowAlphaWindow_Click(object sender, EventArgs e)
{
if (!OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
{
MessageBox.Show("Layered window is not supported in the current system");
return;
} if (alphaWindow == null)
{
alphaWindow = new PerPixelAlphaForm();
} alphaWindow.Show();
alphaWindow.SelectBitmap(Resources.Ring, this.trackBarOpacity.Value);
}
private void trackBarOpacity_ValueChanged(object sender, EventArgs e)
{
this.lbOpacity.Text = this.trackBarOpacity.Value.ToString(); if (alphaWindow != null)
{
alphaWindow.SelectBitmap(Resources.Ring, this.trackBarOpacity.Value);
}
}
本人认为null是空值,网上说是分配零的内存空间,还有N多。 大家认为在这个代码中是何解释!
//PerPixelAlphaForm 是个窗体
PerPixelAlphaForm alphaWindow = null;
private void btnShowAlphaWindow_Click(object sender, EventArgs e)
{
if (!OSFeature.Feature.IsPresent(OSFeature.LayeredWindows))
{
MessageBox.Show("Layered window is not supported in the current system");
return;
} if (alphaWindow == null)
{
alphaWindow = new PerPixelAlphaForm();
} alphaWindow.Show();
alphaWindow.SelectBitmap(Resources.Ring, this.trackBarOpacity.Value);
}
private void trackBarOpacity_ValueChanged(object sender, EventArgs e)
{
this.lbOpacity.Text = this.trackBarOpacity.Value.ToString(); if (alphaWindow != null)
{
alphaWindow.SelectBitmap(Resources.Ring, this.trackBarOpacity.Value);
}
}
本人认为null是空值,网上说是分配零的内存空间,还有N多。 大家认为在这个代码中是何解释!
当函数的返回类型是 对象或者数组之类的时候。如果预测可能得不到满意的结果,那么返回一个NULL。因为设置了函数的返回类型,就必须有返回的东西。而且也变相的当做BOOL来用,只要判断返回的对象值是否为NULL就可以判断函数是否执行成功并取得了满意的结果。