view没有设置android:minWidth的属性,那么view的宽度应该等于0,而实际getwidth不等于0,为什么会呢? 1C

view onMeasure的源码如下:
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
setMeasuredDimension(getDefaultSize(getSuggestedMinimumWidth(), widthMeasureSpec),
getDefaultSize(getSuggestedMinimumHeight(), heightMeasureSpec));
}
getDefaultSize(int size, int measureSpec)的源码如下:
public static int getDefaultSize(int size, int measureSpec) {
int result = size;
int specMode = MeasureSpec.getMode(measureSpec);
int specSize = MeasureSpec.getSize(measureSpec);

    switch (specMode) {
    case MeasureSpec.UNSPECIFIED:
        result = size;
        break;
    case MeasureSpec.AT_MOST:
    case MeasureSpec.EXACTLY:
        result = specSize;
        break;
    }
    return result;
}

getSuggestedMinimumWidth的源码如下:
protected int getSuggestedMinimumWidth() {
return (mBackground == null) ? mMinWidth : max(mMinWidth, mBackground.getMinimumWidth());
}
mMinWidth 是android:minWidth的属性,mBackground.getMinimumWidth()是background的width。
按照上述的源码进行测量,在MeasureSpec.AT_MOST和MeasureSpec.AT_MOST 两种模式测量下,view的宽度都应该等于getSuggestedMinimumWidth。如果view没有设置background和android:minWidth的属性,那么view的宽度应该等于0;而实际getwidth的宽度等于viewgroup的宽度。为什么会这样呢?

1个回答

Bill_xiao
Bill_xiao 我的view没有设置background和android:minWidth的属性,测量模式match_parent。getSuggestedMinimumWidth应该为0,那么view的宽度也就为0了,实际测量view的宽度为viewgroup的宽度。能说说为什么?
接近 3 年之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
RelativeLayout布局单击子布局没反应,父布局已经绑定了单击控件,也做了穿透
![图片说明](https://img-ask.csdn.net/upload/201907/19/1563526073_971954.png) <?xml version="1.0" encoding="utf-8"?> <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@color/black" android:focusableInTouchMode="true" android:id="@+id/relativeLayout1"> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="match_parent" android:background="@android:color/transparent" android:id="@+id/rL1" android:clickable="false" android:focusable="false" > <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="欢迎您" android:textSize="18dp" android:textColor="@color/red" android:id="@+id/text_rl1" android:layout_centerHorizontal="true" android:layout_centerVertical="true" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:background="#00000000" android:visibility="gone" android:id="@+id/fl_1_1_rl1" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_1_2_rl1" /> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="100dp" android:background="@android:color/transparent" android:layout_height="100dp" android:visibility="gone" android:id="@+id/qrcode_rl1" android:descendantFocusability="beforeDescendants"> <ImageView android:id="@+id/img_qrcode_rl1" android:layout_width="96dp" android:layout_height="96dp" android:layout_marginLeft="3dp" android:layout_marginTop="3dp" android:layout_marginBottom="3dp" android:layout_marginRight="3dp" android:background="@android:color/transparent" android:scaleType="fitCenter" /> </RelativeLayout> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/transparent" android:id="@+id/rL2" android:clickable="false" android:focusable="false"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="欢迎您" android:textSize="18dp" android:textColor="@color/red" android:id="@+id/text_rl2" android:layout_centerHorizontal="true" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_2_1_rl2" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_2_2_rl2" /> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="wrap_content" android:background="@android:color/transparent" android:layout_height="64dp" android:visibility="gone" android:id="@+id/qrcode_rl2" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/transparent" android:id="@+id/rL3" android:clickable="false" android:focusable="false"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="欢迎您" android:textSize="18dp" android:textColor="@color/red" android:id="@+id/text_rl3" android:layout_centerHorizontal="true" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_3_1_rl3" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_3_2_rl3" /> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="wrap_content" android:background="@android:color/transparent" android:layout_height="64dp" android:visibility="gone" android:id="@+id/qrcode_rl3" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="match_parent" android:visibility="gone" android:background="@android:color/transparent" android:id="@+id/rL4" android:clickable="false" android:focusable="false"> <TextView android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="欢迎您" android:textSize="18dp" android:textColor="@color/red" android:id="@+id/text_rl4" android:layout_centerHorizontal="true" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_4_1_rl4" /> <FrameLayout android:layout_width="5dp" android:layout_height="5dp" android:visibility="gone" android:background="#00000000" android:id="@+id/fl_4_2_rl4" /> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="wrap_content" android:background="@android:color/transparent" android:layout_height="64dp" android:visibility="gone" android:id="@+id/qrcode_rl4" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="wrap_content" android:visibility="gone" android:id="@+id/rLTextMove" android:clickable="false" android:focusable="false"> <zclhPlay.FiveTextView android:id="@+id/Textmove" android:layout_width="match_parent" android:layout_height="wrap_content" android:text=" " android:textColor="#fff" android:textSize="12dp" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="match_parent" android:layout_height="64dp" android:visibility="gone" android:id="@+id/rLTopBanners" android:clickable="false" android:focusable="false"> <ImageView android:layout_width="match_parent" android:layout_height="64dp" android:adjustViewBounds="true" android:scaleType="fitXY" android:visibility="visible" android:id="@+id/imgTopBanners" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="wrap_content" android:background="@android:color/transparent" android:visibility="gone" android:layout_height="64dp" android:id="@+id/rLClock" android:clickable="false" android:focusable="false"> <TextView android:id="@+id/text_clock" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" android:textColor="#ffffffff" android:shadowColor="#ff000000" android:text="" android:layout_marginLeft="5dp" android:shadowRadius="1" android:shadowDx="2" android:shadowDy="2" /> <TextView android:id="@+id/text_clock_date" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dp" android:textColor="#ffffffff" android:shadowColor="#ff000000" android:text="" android:layout_marginLeft="0dp" android:layout_marginTop="22dp" android:shadowRadius="1" android:shadowDx="2" android:shadowDy="2" /> </RelativeLayout> <RelativeLayout android:minWidth="25px" android:minHeight="25px" android:layout_width="wrap_content" android:background="@android:color/transparent" android:layout_height="64dp" android:visibility="gone" android:id="@+id/rLWeather" android:clickable="false" android:focusable="false"> <ImageView android:id="@+id/imageviewCond" android:layout_width="32dp" android:layout_height="32dp" android:layout_marginLeft="0dp" android:layout_marginTop="3dp" android:background="@android:color/transparent" android:scaleType="fitCenter" /> <TextView android:id="@+id/text_temperature" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="20dp" android:textColor="#ffffffff" android:shadowColor="#ff000000" android:text="" android:layout_marginLeft="40dp" android:shadowRadius="1" android:shadowDx="2" android:shadowDy="2" /> <TextView android:id="@+id/text_wind" android:layout_width="wrap_content" android:layout_height="wrap_content" android:textSize="12dp" android:textColor="#ffffffff" android:shadowColor="#ff000000" android:text="" android:layout_marginLeft="34dp" android:layout_marginTop="22dp" android:shadowRadius="1" android:shadowDx="2" android:shadowDy="2" /> </RelativeLayout> </RelativeLayout> 如上图,单击第一个父布局RelativeLayout有反应,单击中间八个没有反应,父布局已经绑定了单击控件,也做了穿透,八个子布局是全屏的,轮流播放图片,如果单击中图片切换中间的间隔时单击就有反应,图片上没有反应
Android layout下的xml文件 无法添加或者删除控件
<RelativeLayout android:id="@+id/benefit_share_percent_layout" style="@style/activity_content_table_relativelayout_attrs" > <EditText android:id="@+id/benefit_share_percent" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_centerVertical="true" android:layout_marginRight="5dip" android:background="@null" android:gravity="right" android:inputType="numberDecimal" android:minWidth="20dp" android:text="100" android:textColor="@color/gray" android:textSize="@dimen/text_size" /> </RelativeLayout> 我可以修改 android:id的值,但是如果删除android:id,或者添加一个带android:id的控件,就会闪退。如果添加的控件不带android:id,就不会闪退。
Android Linearlayout异常
代码如下: android.view.InflateException: Binary XML file line #1: Error inflating class Linearlayout <Linearlayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="fill_parent" android:layout_height="fill_parent" android:orientation="horizontal" > <Linearlayout android:id="@+id/left" android:layout_width="0dp" android:layout_height="match_parent" android:background="#CCCCCC" android:orientation="vertical"> <Button android:id="@+id/button" android:layout_width="match_parent" android:layout_height="match_parent" android:text="show" android:minHeight="20dp" android:minWidth="20dp" > </Button> <Linearlayout android:id="@+id/center" android:layout_width="0dp" android:layout_height="match_parent" android:background="#CCDDFF" android:orientation="vertical"> </Linearlayout> <Linearlayout android:id="@+id/right" android:layout_width="0dp" android:layout_height="match_parent" android:background="#CCFFDD" android:orientation="vertical"> </Linearlayout> </Linearlayout> </Linearlayout>
AndroidStudio提示找不到该类
<appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="294dp" android:minHeight="72dp" android:initialLayout="@layout/appwidget" > </appwidget-provider>
android程序运行的时候出现unfortunately,imageView has stopped.
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:id="@+id/container" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" tools:context="com.android.imageview.MainActivity" tools:ignore="MergeRootFrame" > <ImageView android:id="@+id/imageView" android:layout_width="250dp" android:layout_height="300dp" android:src="@drawable/image" android:contentDescription="@string/description" android:scaleType="fitCenter"></ImageView> <TextView android:id="@+id/textView1" android:layout_width="fill_parent" android:layout_height="wrap_content" android:layout_marginTop="10dp" android:text="@string/text_one"/> <SeekBar android:id="@+id/seekBar1" android:layout_width="300dp" android:layout_height="wrap_content" android:max="300" android:progress="100" android:layout_marginTop="10dp"/> <TextView android:id="@+id/textView2" android:layout_width="fill_parent" android:layout_height="wrap_content" android:text="@string/text_two" android:layout_marginTop="10dp"></TextView> <SeekBar android:id="@+id/seekBar2" android:layout_width="300dp" android:layout_height="wrap_content" android:max="360" android:layout_marginTop="10dp"/> </LinearLayout> package com.android.imageview; import android.support.v7.app.ActionBarActivity; import android.support.v7.app.ActionBar; import android.support.v4.app.Fragment; import android.graphics.Bitmap; import android.graphics.Matrix; import android.graphics.drawable.BitmapDrawable; import android.os.Bundle; import android.util.DisplayMetrics; import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.view.ViewGroup; import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.SeekBar; import android.widget.SeekBar.OnSeekBarChangeListener; import android.widget.TextView; import android.os.Build; public class MainActivity extends ActionBarActivity implements OnSeekBarChangeListener{ private int minWidth = 40; private TextView textView1,TextView2; private ImageView imageView; private Matrix matrix; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_main); imageView = (ImageView)this.findViewById(R.id.imageView); SeekBar seekBar1 = (SeekBar)this.findViewById(R.id.seekBar1); SeekBar seekBar2 = (SeekBar)this.findViewById(R.id.seekBar2); seekBar1.setOnSeekBarChangeListener(this); seekBar2.setOnSeekBarChangeListener(this); DisplayMetrics dm = new DisplayMetrics(); getWindowManager().getDefaultDisplay().getMetrics(dm); seekBar1.setMax(dm.widthPixels-minWidth); if (savedInstanceState == null) { getSupportFragmentManager().beginTransaction() .add(R.id.container, new PlaceholderFragment()).commit(); } } @Override public void onProgressChanged(SeekBar seekBar, int progress, boolean fromUser) { // TODO Auto-generated method stub if (seekBar.getId()==R.id.seekBar1){ int newWidth = progress + minWidth; int newHeight = (int)(newWidth*6/5); imageView.setLayoutParams(new LinearLayout.LayoutParams(newWidth, newHeight)); textView1.setText("图像宽度:"+newWidth+" 图像高度:"+newHeight); }else if(seekBar.getId()==R.id.seekBar2){ Bitmap bitmap = ((BitmapDrawable)getResources().getDrawable(R.drawable.image)).getBitmap(); matrix.setRotate(progress); bitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), matrix, true); imageView.setImageBitmap(bitmap); TextView2.setText(progress+"度"); } } ​
桌面小插件 在手机桌面显示大小的问题
[img]http://dl.iteye.com/upload/attachment/595443/7e8d2682-e968-37e6-82fd-a984e85f0b3e.png[/img] 试着做了一个Wedget小插件 也能成功运行了。发现小插件的大小和对齐方式还有点问题 请教各位大牛们. <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="210dip" android:minHeight="60dip" android:updatePeriodMillis="10000" android:initialLayout="@layout/widget"> </appwidget-provider> 对于android:minWidth 和android:minHeight的设置不是很理解。 上图其中图片作为小插件的背景直接引用。android:background="@drawable/icon" 不知道我的方式是否妥当。 我的机器HTC G12 分辨率 400*480 图片大小 不清楚在做一个桌面上的Wedget的时候 显示的大小需要考虑那些因素。图片大小?还是不是用背景引入用其他方式更为妥当。 还有就是这个小插件不能居中对齐。 我研究了我机器上的其他小插件都能够居中对齐.并且相对于边都有一点空隙。 希望各位朋友知道的能不胜赐教。 如果不能理解我的表述.请看图片 或者我贴上的源码.我想达到的效果是.下图所示。插件相对于边能有点距离 [img]http://dl.iteye.com/upload/attachment/595440/ae94221f-7405-3437-ad69-ec5a2d36b840.jpg[/img]
以程序化的形式查看自定义 gridview 的所有的 items
我使用下面的代码在Multi-choice GridView 中创建了一个自定义的gridview,包括 checkbox和 image控件。我想点击按钮来检查自定义的gridview的所有的items。如何实现呢? public class GridView_Activity extends Activity { private int count; private Bitmap[] thumbnails; private boolean[] thumbnailsselection; private String[] arrPath; private ImageAdapter imageAdapter; /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); final String[] columns = { MediaStore.Images.Media.DATA, MediaStore.Images.Media._ID }; final String orderBy = MediaStore.Images.Media._ID; Cursor imagecursor = managedQuery( MediaStore.Images.Media.EXTERNAL_CONTENT_URI, columns, null, null, orderBy); int image_column_index = imagecursor .getColumnIndex(MediaStore.Images.Media._ID); this.count = imagecursor.getCount(); this.thumbnails = new Bitmap[this.count]; this.arrPath = new String[this.count]; this.thumbnailsselection = new boolean[this.count]; for (int i = 0; i < this.count; i++) { imagecursor.moveToPosition(i); int id = imagecursor.getInt(image_column_index); int dataColumnIndex = imagecursor .getColumnIndex(MediaStore.Images.Media.DATA); thumbnails[i] = MediaStore.Images.Thumbnails.getThumbnail( getApplicationContext().getContentResolver(), id, MediaStore.Images.Thumbnails.MICRO_KIND, null); arrPath[i] = imagecursor.getString(dataColumnIndex); } GridView imagegrid = (GridView) findViewById(R.id.PhoneImageGrid); imageAdapter = new ImageAdapter(); imagegrid.setAdapter(imageAdapter); imagecursor.close(); final Button selectBtn = (Button) findViewById(R.id.selectBtn); selectBtn.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub final int len = thumbnailsselection.length; int cnt = 0; String selectImages = ""; for (int i = 0; i < len; i++) { if (thumbnailsselection[i]) { cnt++; selectImages = selectImages + arrPath[i] + "|"; } } if (cnt == 0) { Toast.makeText(getApplicationContext(), "Please select at least one image", Toast.LENGTH_LONG).show(); } else { Toast.makeText(getApplicationContext(), "You've selected Total " + cnt + " image(s).", Toast.LENGTH_LONG).show(); Log.d("SelectedImages", selectImages); } } }); } public class ImageAdapter extends BaseAdapter { private LayoutInflater mInflater; public ImageAdapter() { mInflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE); } public int getCount() { return count; } public Object getItem(int position) { return position; } public long getItemId(int position) { return position; } public View getView(int position, View convertView, ViewGroup parent) { ViewHolder holder; if (convertView == null) { holder = new ViewHolder(); convertView = mInflater.inflate(R.layout.galleryitem, null); holder.imageview = (ImageView) convertView .findViewById(R.id.thumbImage); holder.checkbox = (CheckBox) convertView .findViewById(R.id.itemCheckBox); convertView.setTag(holder); } else { holder = (ViewHolder) convertView.getTag(); } holder.checkbox.setId(position); holder.imageview.setId(position); holder.checkbox.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub CheckBox cb = (CheckBox) v; int id = cb.getId(); if (thumbnailsselection[id]) { cb.setChecked(false); thumbnailsselection[id] = false; } else { cb.setChecked(true); thumbnailsselection[id] = true; } } }); holder.imageview.setOnClickListener(new OnClickListener() { public void onClick(View v) { // TODO Auto-generated method stub int id = v.getId(); Intent intent = new Intent(); intent.setAction(Intent.ACTION_VIEW); intent.setDataAndType(Uri.parse("file://" + arrPath[id]), "image/*"); startActivity(intent); } }); holder.imageview.setImageBitmap(thumbnails[position]); holder.checkbox.setChecked(thumbnailsselection[position]); holder.id = position; return convertView; } } class ViewHolder { ImageView imageview; CheckBox checkbox; int id; } } Main.xml <Button android:id="@+id/selectBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_alignParentBottom="true" android:layout_centerHorizontal="true" android:minWidth="200dip" android:text="@string/mBtnSelect" /> <GridView android:id="@+id/PhoneImageGrid" android:layout_width="fill_parent" android:layout_height="fill_parent" android:layout_above="@id/selectBtn" android:columnWidth="90dp" android:gravity="center" android:horizontalSpacing="10dp" android:numColumns="auto_fit" android:stretchMode="columnWidth" android:verticalSpacing="10dp" /> </RelativeLayout>
Andoird中,AppWidget如何定时更新?
按照网上的例子做的, 没有什么特殊的地方, ProviderInfo文件的设置如下 : [code="xml"] <?xml version="1.0" encoding="utf-8"?> <appwidget-provider xmlns:android="http://schemas.android.com/apk/res/android" android:minWidth="294dip" android:updatePeriodMillis="1000" android:initialLayout="@layout/demo_appwidget_layout" android:minHeight="72dip"> </appwidget-provider> [/code] 其中android:updatePeriodMillis="1000", AppWidgetProvider类内容如下: [code="java"] @Override public void onUpdate(Context context, AppWidgetManager appWidgetManager, int[] appWidgetIds) { final int N = appWidgetIds.length; for (int i = 0; i < N; i++) { int appWidgetId = appWidgetIds[i]; RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.demo_appwidget_layout); java.text.DateFormat df = new java.text.SimpleDateFormat("hh:mm:ss"); views.setTextViewText(R.id.item_title, df.format(new Date())); appWidgetManager.updateAppWidget(appWidgetId, views); Log.v("AppWidget", "onUpdate()"); } } [/code] 看文档上介绍说android:updatePeriodMillis是更新频率,可是我执行后,发现只有在添加AppWidget时,才会打印一次onUpdate,如何 才能做到每秒更新一次呢? [b]问题补充:[/b] to wwb1942: 不是要访问网络,现在只是想让AppWidget每隔一秒钟更新一下显示的时间。 [b]问题补充:[/b] to cqllang: 已经加了android:updatePeriodMillis="1000",可还是没有反应。 [b]问题补充:[/b] to cqllang: 现在是第一次可以显示,但我想让它每一秒更新一下时间,却不行。 onUpdate被调用了一次。 to omett: 这个action也已经加了。 但还是不会定时执行onUpdate方法。 [b]问题补充:[/b] To All: 忘记说一个最重要的前提了。 我用的是Android1.6,刚在网上查到了。 是因为SDK的原因。 在1.6下有这个Bug 怎么能把分平分啊? [b]问题补充:[/b] to omett: 没解决啊。 我改变1.5就好用了。。。。 其也想知道在1.6下怎么样能好用。
【小白提问】.net core 2.2 发布到IIS后 webapi 404错误
环境 .net core 2.2,ef core, 前台页面lay-ui 本机测试都正常,发布到IIS后,MVC 绑定数据都正常访问正常,Layui table ajax调用的都报404错误。 ![图片说明](https://img-ask.csdn.net/upload/201912/03/1575366379_942361.png) ![图片说明](https://img-ask.csdn.net/upload/201912/03/1575366361_646674.png) 接口代码: ``` [HttpPost] public IActionResult List() { _logger.LogInformation("==================={path}", HttpContext.Request.Path); Logger.Info(HttpContext.Request.Path); var result = new Object(); var success = new object(); var msg = new object(); var data = new object(); var code = 0; try { data = _context.ItemsLending.ToList(); Logger.Info(JsonConvert.SerializeObject(data));//此处调用日志记录函数记录日志 } catch (Exception e) { _logger.LogError("==================={path},{err}", HttpContext.Request.Path,e.Message); Logger.Info(e.Message);//此处调用日志记录函数记录日志 } result = (new { code, msg, data }); return Json(result); } ``` 尝试加了Log,发现完全没有调用这个接口,只有打开页面的log js ``` table.render({ elem: '#LendingList' , url: '/Lending/List/' , cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 , method: 'post' , cols: [[ { field: 'id', title: 'Id', sort: true, templet: '#detail' } , { field: 'staffId', title: 'Staff ID' } , { field: 'item', title: 'Item' } , { field: 'lendingDate', title: 'Lending date', sort: true } , { field: 'preReturnDate', title: 'Pre return date' } , { field: 'returnDate', title: 'Return date' } , { field: 'status', title: 'Status' } , { field: 'remarks', title: 'Remarks', width: '20%', minWidth: 100 } //minWidth:局部定义当前单元格的最小宽度,layui 2.2.1 新增 ]] }); ```
怎么设置Jquery 多选下拉列表插件jquery multiselect 的高度?
企业的代码是 .multiselect(); 库有用到jquery、jqueryui、jquery multiselect 试过在方法中,加height,minheight,但这个高度改变的是下拉列表的高度,不是控件的高度。 要怎么改变控件本身的高度呢? 控件的源码是 $.widget("ech.multiselect", { // default options options: { header: true, height: 175, minWidth: 225, classes: '', checkAllText: '全选', uncheckAllText: '全不选', noneSelectedText: '请选择', selectedText: '# 项被选中', selectedList: 0, show: null, hide: null, autoOpen: false, multiple: true, position: {}, appendTo: "body" }, 没有设置控件本身高度的属性。 浏览器用的是IE8.
Layui框架的table的选中行功能,获取选中行数据为空!!有没有大佬帮忙看看啊,查了各种资料都不行!!!
``` <table class="layui-hide" id="user-index" lay-filter="user-index"></table> ``` ``` <script> layui.use(['layer', 'table'], function () { var $ = layui.$ , layer = layui.layer , form = layui.form , table = layui.table; //独立版的layer无需执行这一句 var tableId = 'user-index'; var tableToolbar = 'user-index-toolbar'; var tableSearchForm = 'user-index-search'; var minWidth = 768; // 表格渲染 table.render({ elem: '#' + tableId , toolbar: '#' + tableToolbar , defaultToolbar: ['filter'] // ['filter', 'print', 'exports'] , url: '/User/list' ,where:{'username':'','realname':'','tel':'','city':'','isdelete':0} , method: 'get' , cellMinWidth: 80 //全局定义常规单元格的最小宽度,layui 2.2.1 新增 , cols: [[ {type: 'checkbox', id:'cb',fixed: 'left'} , {field: 'id', width: 80, title: 'ID', sort: true} , {field: 'username', width: 212, title: '用户名', sort: true} , {field: 'realname', width: 100, title: '姓名'} , {field: 'sex', width: 105, title: '性别'} , {field: 'tel', width: 180, title: '手机号'} , {field: 'city', width: 120, title: '城市', sort: true} , {field: 'role', width: 100, title: '角色ID', sort: true} , { title: '状态', width: 150, templet: function (res) { if (res.status == '1') { return '已激活(使用中)'; } else { return '<span style="color: #F581B1;">冻结(过期请续费)</span>'; } } } ]] , page: true ,limit:7 , height: 'full-60' // 100 }); ``` 头工具栏的监听 ``` table.on('toolbar(' + tableId + ')', function (obj) { var checkStatus = table.checkStatus(obj.config.id) , data = checkStatus.data; console.log(data) //获取选中行的数据 ``` 结果我选中一条或者是多条数据之后都获取不到数据,table的id我也检查过了没问题。 前端控制台输出是这样的: ``` Object data: Array(0) length: 0 __proto__: Array(0) isAll: false __proto__: Object ``` 但是我又试了全选,神奇的发现全选能选择,有没有大佬能帮忙解释下这是什么问题啊,怎么才能解决
WPF的Webbrowser浏览本地html中的echart图,鼠标悬浮不出数据。
公司WPF项目要看各种折线统计图,然后我用webbroswer打开本地html交互做好了,但是鼠标悬浮在图上到交点的时候不会显示点的数据,我又做了个小demo,单独拉了一个wpf项目这么做是成功的,鼠标悬浮以后是出点数据的,但是公司的项目就是不行,可惜我不是很精通wpf,总感觉鼠标下有一层这招挡着,导致根本没法触发鼠标的各种事件,求解决。 这个是Echart.xaml那个子页面 ``` <Page x:Class="HontyeNMR.UserControls.Echart" 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" xmlns:local="clr-namespace:HontyeNMR.UserControls" mc:Ignorable="d" d:DesignHeight="375" d:DesignWidth="1000"> <Grid> <WebBrowser x:Name="webBrowser1"/> </Grid> </Page> ``` 后台只有一句 webBrowser1.Navigate("https://echarts.baidu.com/examples/editor.html?c=line-stack"); 这个是App.xaml ``` <Application x:Class="HontyeNMR.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" StartupUri="UserControls/Page1.xaml" Startup="Application_Startup"> <Application.Resources> <!--空按钮--> <Style x:Key="EmptyButton" TargetType="Button"> <Setter Property="Padding" Value="0"/> <Setter Property="FocusVisualStyle" Value="{x:Null}"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="Button"> <ContentPresenter Content="{TemplateBinding Content}"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--定义按钮样式--> <Style x:Key="ButtonBlue" TargetType="Button"> <Setter Property="Foreground" Value="Black"/> <!--修改模板属性--> <Setter Property="Template"> <Setter.Value> <!--控件模板--> <ControlTemplate TargetType="Button"> <!--背景色--> <Border x:Name="back" Opacity="0.8" CornerRadius="3"> <Border.BitmapEffect> <OuterGlowBitmapEffect Opacity="0.7" GlowSize="0" GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" /> </Border.BitmapEffect> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0"/> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0.4"/> <GradientStop Color="#FFF" Offset="1"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--前景色及边框--> <Border x:Name="fore" CornerRadius="3" > <!--BorderThickness="0" BorderBrush="#2388BE"--> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#00A5DB" Offset="0.5"/> <GradientStop Color="#00A5DB" Offset="0.51"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--按钮内容--> <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}"> <!--<ContentPresenter.BitmapEffect> <DropShadowBitmapEffect Color="#000" Direction="-90" ShadowDepth="0" Softness="0.1" Opacity="1" /> </ContentPresenter.BitmapEffect>--> </ContentPresenter> </Border> </Border> <!--触发器--> <ControlTemplate.Triggers> <!--鼠标移入移出--> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="6" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#0095DB" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#0095DB" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮按下弹起--> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="3" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#0085DB" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#0085DB" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮失效--> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="#B444"/> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="0" Duration="0:0:0.3" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation To="-135" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation To="#FFF" Duration="0:0:0.3" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation To="#D555" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation To="#CEEE" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#CDDD" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--定义按钮样式--> <Style x:Key="ButtonYellow" TargetType="Button"> <Setter Property="Foreground" Value="Black"/> <!--修改模板属性--> <Setter Property="Template"> <Setter.Value> <!--控件模板--> <ControlTemplate TargetType="Button"> <!--背景色--> <Border x:Name="back" Opacity="0.8" CornerRadius="3"> <Border.BitmapEffect> <OuterGlowBitmapEffect Opacity="0.7" GlowSize="0" GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" /> </Border.BitmapEffect> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0"/> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0.4"/> <GradientStop Color="#FFF" Offset="1"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--前景色及边框--> <Border x:Name="fore" CornerRadius="3" > <!--BorderThickness="0" BorderBrush="#2388BE"--> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#FF8800" Offset="0.5"/> <GradientStop Color="#FF8800" Offset="0.51"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--按钮内容--> <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}"> <!--<ContentPresenter.BitmapEffect> <DropShadowBitmapEffect Color="#000" Direction="-90" ShadowDepth="0" Softness="0.1" Opacity="1" /> </ContentPresenter.BitmapEffect>--> </ContentPresenter> </Border> </Border> <!--触发器--> <ControlTemplate.Triggers> <!--鼠标移入移出--> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="6" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#FF7700" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#FF7700" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮按下弹起--> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="3" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#FF6600" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#FF6600" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮失效--> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="#B444"/> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="0" Duration="0:0:0.3" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation To="-135" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation To="#FFF" Duration="0:0:0.3" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation To="#D555" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation To="#CEEE" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#CDDD" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--定义按钮样式--> <Style x:Key="ButtonRed" TargetType="Button"> <Setter Property="Foreground" Value="Black"/> <!--修改模板属性--> <Setter Property="Template"> <Setter.Value> <!--控件模板--> <ControlTemplate TargetType="Button"> <!--背景色--> <Border x:Name="back" Opacity="0.8" CornerRadius="3"> <Border.BitmapEffect> <OuterGlowBitmapEffect Opacity="0.7" GlowSize="0" GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" /> </Border.BitmapEffect> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0"/> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0.4"/> <GradientStop Color="#FFF" Offset="1"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--前景色及边框--> <Border x:Name="fore" CornerRadius="3" > <!--BorderThickness="0" BorderBrush="#2388BE"--> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#EC4040" Offset="0.5"/> <GradientStop Color="#EC4040" Offset="0.51"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--按钮内容--> <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}"> <!--<ContentPresenter.BitmapEffect> <DropShadowBitmapEffect Color="#000" Direction="-90" ShadowDepth="0" Softness="0.1" Opacity="1" /> </ContentPresenter.BitmapEffect>--> </ContentPresenter> </Border> </Border> <!--触发器--> <ControlTemplate.Triggers> <!--鼠标移入移出--> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="6" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#EC5050" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#EC5050" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮按下弹起--> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="3" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#EC6060" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#EC6060" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮失效--> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="#B444"/> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="0" Duration="0:0:0.3" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation To="-135" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation To="#FFF" Duration="0:0:0.3" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation To="#D555" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation To="#CEEE" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#CDDD" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--定义按钮样式--> <Style x:Key="ButtonGray" TargetType="Button"> <Setter Property="Foreground" Value="Black"/> <!--修改模板属性--> <Setter Property="Template"> <Setter.Value> <!--控件模板--> <ControlTemplate TargetType="Button"> <!--背景色--> <Border x:Name="back" Opacity="0.8" CornerRadius="3"> <Border.BitmapEffect> <OuterGlowBitmapEffect Opacity="0.7" GlowSize="0" GlowColor="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" /> </Border.BitmapEffect> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1.5"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0"/> <GradientStop Color="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=(Button.Background).(SolidColorBrush.Color)}" Offset="0.4"/> <GradientStop Color="#FFF" Offset="1"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--前景色及边框--> <Border x:Name="fore" CornerRadius="3" > <!--BorderThickness="0" BorderBrush="#2388BE"--> <Border.Background> <LinearGradientBrush StartPoint="0,0" EndPoint="0,1"> <GradientBrush.GradientStops> <GradientStopCollection> <GradientStop Color="#C8C8C8" Offset="0.5"/> <GradientStop Color="#C8C8C8" Offset="0.51"/> </GradientStopCollection> </GradientBrush.GradientStops> </LinearGradientBrush> </Border.Background> <!--按钮内容--> <ContentPresenter x:Name="content" HorizontalAlignment="Center" VerticalAlignment="Center" Content="{TemplateBinding Content}"> <!--<ContentPresenter.BitmapEffect> <DropShadowBitmapEffect Color="#000" Direction="-90" ShadowDepth="0" Softness="0.1" Opacity="1" /> </ContentPresenter.BitmapEffect>--> </ContentPresenter> </Border> </Border> <!--触发器--> <ControlTemplate.Triggers> <!--鼠标移入移出--> <Trigger Property="IsMouseOver" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="6" Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#B8B8B8" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#B8B8B8" BeginTime="0:0:0.2" Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.2" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.2" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮按下弹起--> <Trigger Property="IsPressed" Value="True"> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="3" Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation To="#A8A8A8" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#A8A8A8" Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> <!--按钮失效--> <Trigger Property="IsEnabled" Value="False"> <Setter Property="Foreground" Value="#B444"/> <Trigger.EnterActions> <BeginStoryboard> <Storyboard> <DoubleAnimation To="0" Duration="0:0:0.3" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation To="1" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation To="-135" Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation To="#FFF" Duration="0:0:0.3" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation To="#D555" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation To="#CEEE" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation To="#CDDD" Duration="0:0:0.3" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.EnterActions> <Trigger.ExitActions> <BeginStoryboard> <Storyboard> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="back" Storyboard.TargetProperty="(Border.BitmapEffect).(OuterGlowBitmapEffect.GlowSize)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Opacity)" /> <DoubleAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Direction)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="content" Storyboard.TargetProperty="(ContentPresenter.BitmapEffect).(DropShadowBitmapEffect.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.BorderBrush).(SolidColorBrush.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[0].(GradientStop.Color)" /> <ColorAnimation Duration="0:0:0.1" Storyboard.TargetName="fore" Storyboard.TargetProperty="(Border.Background).(LinearGradientBrush.GradientStops)[1].(GradientStop.Color)" /> </Storyboard> </BeginStoryboard> </Trigger.ExitActions> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <!--滚动条样式Start--> <ControlTemplate x:Key="ScrollViewerControlTemplate" TargetType="{x:Type ScrollViewer}"> <Grid x:Name="Grid" Background="{TemplateBinding Background}"> <Grid.ColumnDefinitions> <ColumnDefinition Width="*"/> <ColumnDefinition Width="Auto"/> </Grid.ColumnDefinitions> <Grid.RowDefinitions> <RowDefinition Height="*"/> <RowDefinition Height="Auto"/> </Grid.RowDefinitions> <Rectangle x:Name="Corner" Grid.Column="1" Fill="White" Grid.Row="1"/> <ScrollContentPresenter x:Name="PART_ScrollContentPresenter" CanContentScroll="{TemplateBinding CanContentScroll}" CanHorizontallyScroll="False" CanVerticallyScroll="False" ContentTemplate="{TemplateBinding ContentTemplate}" Content="{TemplateBinding Content}" Grid.Column="0" Margin="{TemplateBinding Padding}" Grid.Row="0"/> <ScrollBar x:Name="PART_VerticalScrollBar" AutomationProperties.AutomationId="VerticalScrollBar" Cursor="Arrow" Grid.Column="1" Maximum="{TemplateBinding ScrollableHeight}" Minimum="0" Grid.Row="0" Visibility="{TemplateBinding ComputedVerticalScrollBarVisibility}" Value="{Binding VerticalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportHeight}" Style="{DynamicResource MyScrollBarStyle}"/> <ScrollBar x:Name="PART_HorizontalScrollBar" AutomationProperties.AutomationId="HorizontalScrollBar" Cursor="Arrow" Grid.Column="0" Maximum="{TemplateBinding ScrollableWidth}" Minimum="0" Orientation="Horizontal" Grid.Row="1" Visibility="{TemplateBinding ComputedHorizontalScrollBarVisibility}" Value="{Binding HorizontalOffset, Mode=OneWay, RelativeSource={RelativeSource TemplatedParent}}" ViewportSize="{TemplateBinding ViewportWidth}" Style="{DynamicResource MyScrollBarStyle}"/> </Grid> </ControlTemplate> <!-- 应该在此定义资源字典条目。--> <SolidColorBrush x:Key="ScrollBarDisabledBackground" Color="#F4F4F4"/> <Style x:Key="VerticalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="Focusable" Value="false"/> <Setter Property="IsTabStop" Value="false"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RepeatButton}"> <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="ScrollBarThumb" TargetType="{x:Type Thumb}"> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="IsTabStop" Value="false"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type Thumb}"> <Rectangle Name="thumbRect" Fill="LightGray" RadiusX="3" RadiusY="3"/> <!--滚动条颜色--> <ControlTemplate.Triggers> <Trigger Property="IsMouseOver" Value="True"> <Setter Property="Fill" Value="Gray" TargetName="thumbRect" /> <!--滚动条选中颜色--> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="HorizontalScrollBarPageButton" TargetType="{x:Type RepeatButton}"> <Setter Property="OverridesDefaultStyle" Value="true"/> <Setter Property="Background" Value="Transparent"/> <Setter Property="Focusable" Value="false"/> <Setter Property="IsTabStop" Value="false"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type RepeatButton}"> <Rectangle Fill="{TemplateBinding Background}" Height="{TemplateBinding Height}" Width="{TemplateBinding Width}"/> </ControlTemplate> </Setter.Value> </Setter> </Style> <Style x:Key="MyScrollBarStyle" TargetType="{x:Type ScrollBar}"> <Setter Property="Background" Value="AliceBlue"/> <Setter Property="Stylus.IsPressAndHoldEnabled" Value="false"/> <Setter Property="Stylus.IsFlicksEnabled" Value="false"/> <Setter Property="Width" Value="6"/> <Setter Property="MinWidth" Value="6"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ScrollBar}"> <Grid x:Name="Bg" Background="AliceBlue" SnapsToDevicePixels="true" Width="6"> <Grid.RowDefinitions> <RowDefinition /> </Grid.RowDefinitions> <Track x:Name="PART_Track" IsDirectionReversed="true" IsEnabled="{TemplateBinding IsMouseOver}"> <Track.DecreaseRepeatButton> <RepeatButton Command="{x:Static ScrollBar.PageUpCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/> </Track.DecreaseRepeatButton> <Track.IncreaseRepeatButton> <RepeatButton Command="{x:Static ScrollBar.PageDownCommand}" Style="{StaticResource VerticalScrollBarPageButton}"/> </Track.IncreaseRepeatButton> <Track.Thumb> <Thumb Style="{StaticResource ScrollBarThumb}"/> </Track.Thumb> </Track> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> <Style.Triggers> <Trigger Property="Orientation" Value="Horizontal"> <Setter Property="Width" Value="Auto"/> <Setter Property="MinWidth" Value="0"/> <Setter Property="Height" Value="6"/> <Setter Property="MinHeight" Value="6"/> <Setter Property="Background" Value="AliceBlue"/> <Setter Property="Template"> <Setter.Value> <ControlTemplate TargetType="{x:Type ScrollBar}"> <Grid x:Name="Bg" Background="AliceBlue" SnapsToDevicePixels="true"> <Grid.ColumnDefinitions> <ColumnDefinition /> </Grid.ColumnDefinitions> <Track x:Name="PART_Track" IsEnabled="{TemplateBinding IsMouseOver}"> <Track.DecreaseRepeatButton> <RepeatButton Command="{x:Static ScrollBar.PageLeftCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/> </Track.DecreaseRepeatButton> <Track.IncreaseRepeatButton> <RepeatButton Command="{x:Static ScrollBar.PageRightCommand}" Style="{StaticResource HorizontalScrollBarPageButton}"/> </Track.IncreaseRepeatButton> <Track.Thumb> <Thumb Style="{StaticResource ScrollBarThumb}" /> </Track.Thumb> </Track> </Grid> <ControlTemplate.Triggers> <Trigger Property="IsEnabled" Value="false"> <Setter Property="Background" TargetName="Bg" Value="{StaticResource ScrollBarDisabledBackground}"/> </Trigger> </ControlTemplate.Triggers> </ControlTemplate> </Setter.Value> </Setter> </Trigger> </Style.Triggers> </Style> <!--滚动条样式End--> </Application.Resources> </Application> ``` 下面是MainWindow ``` <Window x:Class="MR.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:MR" mc:Ignorable="d" Title="MainWindow" Height="800" Width="1000"> <Grid> <StackPanel x:Name="asd"></StackPanel> </Grid> </Window> Page1 page1 = new Page1(); this.Content = page1; ```
Ext 分页,高手帮我看看,grid已经可以显示数据了,可是分页就是没有数据,急死我了
Ext.onReady(function() { var itemsPerPage=30;//指定分页大小 Ext.regModel('Node', { fields:[{name:'UI_id'}, {name:'UI_Time'}, {name:'UI_Level'}, {name:'UI_Sys'}, {name:'UI_FlowID'}, {name:'UI_UserName'}, {name:'UI_Message'}, {name:'UI_Result'} ] } ); function showColor(value){ if (value == '成功') { return '<span style="color:green;">' + value + '</span>'; } else if (value == '失败') { return '<span style="color:red;">' + value + '</span>'; } return value; } var store = Ext.create('Ext.data.JsonStore',{ //storeId:'gridStore', autoload:true, model:'Node', pageSize:itemsPerPage, remoteSort:true, //data:[], proxy:{ type:'memory', reader:{ type:'json', totalProperty:50 } } }); store.loadPage(1); //store.loadPage(1); var sysData =[['ALL','全部'], ['GATEWAY','接入网关'], ['NJGL','农机管理'], ['NQJC','农情监测'], ['GIS','GIS'], ['DSE','数据服务引擎'], ['YG','运管'], ['TERMINAL','仿真终端']]; var sysStore = new Ext.data.SimpleStore({ fields:['sysID','sysName'], data:sysData }); var logLevel = [['ALL','全部'], ['INFO','INFO'], ['WARN','WARN'], ['ERROR','ERROR'], ['FATAL','FATAL'], ['DEBUG','DEBUG']]; var levelStore = new Ext.data.SimpleStore({ fields:['levelID','levelName'], data:logLevel }); var accordion = Ext.create("Ext.form.FormPanel", { title: "日志查询", layout: "form", //设置为手风琴布局 layoutConfig: { animate: true }, width: 250, minWidth: 90, height:50, region: "west", //设置方位 split: true, collapsible: true, items: [ {xtype: 'datefield',fieldLabel: '开始时间',name: 'starttime',format:'Y-m-d',allowBlank: true,height:25}, {xtype: 'datefield',fieldLabel: '结束时间',name: 'endtime',format:'Y-m-d',allowBlank: true,width:30,height:25}, {xtype:'combo',fieldLabel: '子系统标示',name:'sysID',store:sysStore,displayField:'sysName',valueField:'sysID',queryMode:'local',forceSelection:true,typeAhead:true,value:'ALL',height:25}, {xtype:'combo',fieldLabel:'日志级别',name:'levelID',store:levelStore,displayField:'levelName',valueField:'levelID',queryMode:'local',forceSelection:true,typeAhead:true,value:'ALL',height:25 }, {xtype:'textfield',fieldLabel:'查找内容',name:'contentID',emptyText:'用户名或者消息关键字',height:25} ], // 重置 和 保存 按钮. buttons: [{ text: '重置', width:'120', heigth:'80', style:'baseCls-18px', handler: function() { this.up('form').getForm().reset(); } }, { text: '查询', formBind: false, //only enabled once the form is valid disabled: false, width:'120', handler: function(){ var form = this.up('form').getForm().getValues(); //alert("开始时间为:" + form.starttime + ",结束时间为:" + form.endtime); var logParam = []; logParam.push(form.starttime); logParam.push(form.endtime); logParam.push(form.sysID); logParam.push(form.levelID); logParam.push(form.contentID); Ext.Ajax.request({ url:'selectLog.do', //timeout:2000, params:{'logParam':logParam.join(",")}, success:function(response,opts){ var strData= response.responseText; var tableData = eval(strData); store.loadData(tableData,false); }, failure:function(response,opts) { alert('提示:保存数据失败!!!'); } }) } }], renderTo: Ext.getBody() }); var pagingToolbar = new Ext.PagingToolbar({ pageSize:30, store:store, displayInfo:true, displayMsg: '第{0}-共{1}条,一共{2}条', emptyMsg:'没有数据', items: [ '-', { pressed: true, enableToggle: true, text: '预览', cls: 'x-btn-text-icon details', toggleHandler: function(btn, pressed) { var view = grid.getView(); view.showPreview = pressed; view.refresh(); } }] }); var accordion1 = Ext.create("Ext.Panel", { renderTo:Ext.getBody(), layout:'fit', frame:true, region: "center", width:1000, height:500, items:[{ xtype:'grid', title: '日志内容', stripeRows:true, loadMask:true, height:200, store: store, columnLines: true, columns: [ new Ext.grid.RowNumberer(), // { header: '编号', dataIndex: 'UI_id' }, { header: '日志时间', flex:1,dataIndex: 'UI_Time'}, { header: '日志级别', flex:1,dataIndex: 'UI_Level' }, { header: '子系统标示', flex:1,dataIndex: 'UI_Sys' }, { header: '业务流水号', flex:1,dataIndex: 'UI_FlowID' }, { header: '用户名', flex:1,dataIndex: 'UI_UserName' }, { header: '日志详情', flex:2,dataIndex: 'UI_Message' }, { header: '处理结果', flex:1,dataIndex: 'UI_Result',renderer:showColor} ], bbar:pagingToolbar, height: 800, width: 2000 } ] }); new Ext.Viewport({ title: "Viewport", layout: "border", //这里是(border)边界布局 defaults: { bodyStyle: "background-color: #FFFFFF;", frame: true }, items: [ accordion1, accordion, //这里是(accordion)手风琴布局 { region: "north", height: 150, title: '日志管理系统', html:'<br></br><font size=6><center><b>日志管理系统</font>' }, // { region: "center", // title: '日志内容' // }, { region: "south", height: 30, html:'<font size=2><center></font>'} ] }); })
EXT树子节点设置disabled为true后为什么还可以点击触发click事件
<pre name="code" class="js">items:[{ region:'west',//西面放入面板 xtype:'treepanel', split:true,//设置分隔条 collapsible:true,//可以进行缩进 collapseMode:'mini',//设置左右缩减 minWidth:150, maxWidth:300, width:200, root:new Ext.tree.AsyncTreeNode({ text:'权限管理', iconCls:'purviewManagerIcon', expanded:true,//子节点展开 children:[{ text:'用户管理', disabled:true, leaf:true,//true设置此节点为叶子节点 qtip:'用户管理',//提示信息 listeners:{ 'click':function(){ alert(); } } },{ text:'权限管理', iconCls:'purviewManagerIcon', leaf:true,//true设置此节点为叶子节点 qtip:'权限管理',//提示信息 listeners:{ click:function(){ alert(); } } }]</pre> <p> 为什么效果是下边图片的结果 用户管理子节点是灰的 还可以进行点击弹出对话框,怎样达到子节点是灰的 不可以点击(注click事件保留的情况下,因为以后要写的代码会用到click事件)</p>
artdialog.alert()的弹出框如何修改文字?(“消息”,“确定”)
artdialog.alert()的弹出框如何修改文字?(“消息”,“确定”) 尝试修改了一下js文件也没能成功。。求大神指教了!~ 相关配置文件: artdialog.source.js (okVal已改,但是依然是中文) ``` /** * 默认配置 */ artDialog.defaults = { // 消息内容 content: '<div class="aui_loading"><span>loading..</span></div>', title: 'Message', // 标题. 默认'消息' button: null, // 自定义按钮 ok: null, // 确定按钮回调函数 cancel: null, // 取消按钮回调函数 init: null, // 对话框初始化后执行的函数 close: null, // 对话框关闭前执行的函数 okVal: 'sure', // 确定按钮文本. 默认'确定' cancelVal: 'cancel', // 取消按钮文本. 默认'取消' width: 'auto', // 内容宽度 height: 'auto', // 内容高度 minWidth: 96, // 最小宽度限制 minHeight: 32, // 最小高度限制 padding: '20px 25px', // 内容与边界填充距离 skin: '', // 皮肤名(预留接口,尚未实现) icon: null, // 消息图标名称 time: null, // 自动关闭时间 esc: true, // 是否支持Esc键关闭 focus: true, // 是否支持对话框按钮自动聚焦 show: true, // 初始化后是否显示对话框 follow: null, // 跟随某元素(即让对话框在元素附近弹出) path: _path, // artDialog路径 lock: false, // 是否锁屏 background: '#000', // 遮罩颜色 opacity: .7, // 遮罩透明度 duration: 300, // 遮罩透明度渐变动画速度 fixed: false, // 是否静止定位 left: '50%', // X轴坐标 top: '38.2%', // Y轴坐标 zIndex: 1987, // 对话框叠加高度值(重要:此值不能超过浏览器最大限制) resize: true, // 是否允许用户调节尺寸 drag: true // 是否允许用户拖动位置 }; ``` iframeTools.source.js ``` /** * 警告 * @param {String} 消息内容 */ artDialog.alert = function (content, callback) { return _proxyDialog({ id: 'Alert', zIndex: _zIndex(), icon: 'warning', fixed: true, lock: true, content: content, ok: true, close: callback }); }; ``` 是这两部分代码控制的吗?应该怎么修改?
MFC 父窗口向子窗口传递参数并在子窗口编辑框显示!!
我需要在父窗口点击【加载工程】按钮以后读取TXT文本文档以后将读取到的数据传递给主窗口的2个TEXT 文本框和子窗口6个Edit编辑框 !以便于我在打开子窗口(通过其他按钮打开!)以后能看到父窗口传递过来的数据! case语句里的注释语句都有问题!运行时会报 “遇到不适当参数”! void CThreeCamProjectDlg::OnBnClickedLoadprojectbn() { CDlg_SIZESET *dlg = new CDlg_SIZESET(); CStdioFile file; CString filePathName, strTemp, strLine; CFileDialog lpszOpenFile(TRUE, "", "", OFN_FILEMUSTEXIST | OFN_HIDEREADONLY, _T("文件类型(*.txt)|*.txt|所有文件(*.*)|*.*|")); lpszOpenFile.m_ofn.lpstrInitialDir = _T(".\\sizestandard\\"); //指定文件夹 int row; if (lpszOpenFile.DoModal() == IDOK)//假如点击对话框确定按钮 { filePathName = lpszOpenFile.GetPathName();//得到打开文件的路径 } if (filePathName == "") return; if (!file.Open(filePathName, CFile::modeRead)) { MessageBox(TEXT("can not open file!")); return; } row = 0; while (file.ReadString(strLine)) { char* str = (char *)strLine.GetBufferSetLength(strLine.GetLength()); char* p; if (row > 1) { MessageBox(TEXT("尺寸规格仅第一行有效!")); break; } if (strLine != "") { short tempsizecount = 0; for (p = strtok(str, ";"); p != NULL; p = strtok(NULL, ";")) { tempsizecount++; strTemp = p; switch (tempsizecount) { case 1: mSTWidth = atof(strTemp); //加载工程标准 宽 显示到主界面 GetDlgItem(IDC_LoadStdWidth_WND)->SetWindowTextA(strTemp); //dlg->GetDlgItem(IDC_EDIT_STD_WIDTH)->SetWindowTextA(strTemp); break; case 2: mSTHeight = atof(strTemp); //加载工程标准 高 显示到主界面 GetDlgItem(IDC_LoadStdHeight_WND)->SetWindowTextA(strTemp); //dlg->GetDlgItem(IDC_EDIT_STD_HEIGHT)->SetWindowTextA(strTemp); break; case 3: maxWidth = atof(strTemp); // 加载工程Max 高 //GetDlgItem(IDC_EDIT_MAXWIDTH)->SetWindowTextA(strTemp); break; case 4: minWidth = atof(strTemp); // 加载工程Min 高 //GetDlgItem(IDC_EDIT_MINWIDTH)->SetWindowTextA(strTemp); break; case 5: maxHeight = atof(strTemp); // 加载工程Max 宽 //GetDlgItem(IDC_EDIT_MAXHEIGHT)->SetWindowTextA(strTemp); break; case 6: minHeight = atof(strTemp); // 加载工程Min 高 //GetDlgItem(IDC_EDIT_MINHEIGHT)->SetWindowTextA(strTemp); break; default: break; } } if (tempsizecount != 6) { MessageBox(TEXT("尺寸规格输入不正确!")); break; } row++; } else { MessageBox(TEXT("错误,尺寸规格为空!")); break; } } delete lpszOpenFile;//释放分配的对话框 }
extjs如何控制左侧菜单默认不打开,现在项目进去后默认打开第一个,下面是我的js代码
``` Ext.namespace('Ext.app.frame'); Ext.app.frame.LeftPanel = Ext.extend(Ext.Panel, { //初始化加载的菜单ID welcomeMenuId : customInfo['defaultTopMenuId'], //项目路径 context : customInfo['context'], //构造方法 constructor : function(_cfg) { Ext.apply(this, _cfg); }, wizCount :0, readyCount :0, //初始化 initialize:function(_cfg){ //生成左侧面板 Ext.app.frame.LeftPanel.superclass.constructor.call(this, { id : 'accordion-panel', iconCls : 'icon-nav', layout : 'accordion', region : 'west', margins : '10 10 2 2', width : 220, bodyStyle : 'background-color:#DFE8F6', collapsible : true, split : false, layoutConfig : { animate : true } }); //左侧面板首次设置内容 var welcomeMenu = {menuId:this.welcomeMenuId, text:customInfo['defaultTopMenuName']}; this.setContent(welcomeMenu); }, //设置面板内容(主要方法) setContent:function(currMenu){ var aim = Ext.getCmp('accordion-panel'); var currScope = this; aim.removeAll(true); if(currMenu!=undefined && currMenu.menuId!=undefined){ var _temptitle = currMenu.text || ""; aim.setTitle(_temptitle); //添加扩展,如果菜单配置URL为IFM:开头的话, 表示为做菜单是扩展的菜单,嵌入IFRAME显示URL var _tempURL = currMenu.menuURL|| ""; if(_tempURL!=""){ aim.body.update(""); } if(_tempURL.indexOf("IFM:")>-1){ _tempURL = _tempURL.substring(4); aim.body.update("<IFRAME width=\"100%\" height=\"100%\" FRAMEBORDER=0 SCROLLING=auto SRC='"+_tempURL+"'></IFRAME>"); if(currScope.ownerCt.menuBar){ currScope.ownerCt.menuBar.enableAllButtons(); } return; } var requesturl = this.context+'/menu!topLeft.lxd?menuId='+currMenu.menuId; Ext.Ajax.request({ url: requesturl, success: function(response) { //获取响应的json字符 json = Ext.decode(response.responseText); if(json!=undefined && json.length!=undefined){ currScope.wizCount = json.length; currScope.readyCount = 0; for(var i=0;i<json.length;i++){ var left = json[i]; var title = left.text; var id = left.id; var url; if(left.menuUrl!=undefined){ url=left.menuUrl.substring(0,4)=="IFM:"?left.menuUrl.substring(4):left.menuUrl; } var target = left.urltarget; var panel; if(url && target=="leftFrame"){ if(url.substring(0,4)!="http"){ url = customInfo['context']+"/"+url; } panel = new Ext.Panel({ id : id, title : title, layout: 'fit', border: false, iconCls : 'icon-nav', items : [ new Ext.ux.IFrameComponent({ id: 'menu_iframe_'+id, url: url }) ] }); }else{ panel = new Ext.app.frame.WizardPanel({ id : id, title : title, group : 'group', checked : 'checked', dataUrl : '/menu!downLeft.lxd?menuId=' + id }); } aim.add(panel); aim.doLayout(); currScope.readyCount++; if(currScope.readyCount == currScope.wizCount){ if(currScope.ownerCt.menuBar){ currScope.ownerCt.menuBar.enableAllButtons(); } } } }else{ Ext.Msg.alert('错误','读取菜单错误!'); if(currScope.ownerCt.menuBar){ currScope.ownerCt.menuBar.enableAllButtons(); } } }, failure: function(){ Ext.Msg.alert('错误','连接服务器超时!'); if(currScope.ownerCt.menuBar){ currScope.ownerCt.menuBar.enableAllButtons(); } } }); } } }); Ext.app.frame.WizardPanel = Ext.extend(Ext.Panel, { context : customInfo['context'], iconCls : 'icon-nav', border : false, rootVisible : false, autoScroll : true, dataUrl : null, //buttons : {}, tree : null, constructor : function(_cfg) { Ext.apply(this, _cfg); var _tree = new Ext.tree.TreePanel({ iconCls : 'icon-nav', border : false, rootVisible : false, loader : new Ext.tree.TreeLoader({ // dataUrl : context + // '/jsonTree!wizardJson.lxd' dataUrl : this.context + this.dataUrl }), style : { padding : 3 }, root : new Ext.tree.AsyncTreeNode({ text : _cfg.title || this.title, // , // children : _cfg.childrens || null expanded : false }), listeners : { 'click' : function(n) { try { if (n.leaf) { if(n.attributes.urltarget=='_blank'){ var openURL = n.attributes.menuUrl; if(openURL.substring(0,4)!="http"){ openURL = customInfo['context']+"/"+openURL; } window.open(openURL); }else{ this.onNodeClick(n.id, n.text,n.attributes.menuUrl); } }else{ if(n.attributes.menuUrl){ if(n.attributes.urltarget=='_blank'){ var openURL = n.attributes.menuUrl; if(openURL.substring(0,4)!="http"){ openURL = encodeURI(customInfo['context']+"/"+openURL); } window.open(openURL); }else{ this.onNodeClick(n.id, n.text,n.attributes.menuUrl); } } } } catch (e) { } }, scope : this } }); this.tree = _tree; Ext.app.frame.WizardPanel.superclass.constructor.call(this, { margins : '2 0 5 5', layout : 'anchor', items : [this.tree] }); }, afterRender : function(){ Ext.app.frame.WizardPanel.superclass.afterRender.call(this); }, // 树图刷新 tree_refresh : function(menuId) { this.refresh(menuId); }, ReturnValue : function(title, value) { Ext.Msg.show({ title : title, msg : value, icon : Ext.Msg.INFO, minWidth : 210, buttons : Ext.Msg.OK }); }, // 为叶子菜单增加对应点击事件,调用链接对应的页面 onNodeClick : function(id,name,menuUrl) { var tabPanel = Ext.getCmp("content-panel"); var allItems = tabPanel.items.items; var tabPage; var b = true; var delegateArray = {'id':id,'name':name,'menuUrl':menuUrl}; if(menuUrl.substring(0,4)!="http"){ menuUrl = encodeURI(customInfo['context']+"/"+menuUrl); } for (var i = 0; i < allItems.length; i++) { var _text = allItems[i].title; if (_text == name) { tabPage = allItems[i]; // 设置当前tab页 tabPanel.setActiveTab(tabPage); b = false; // 重新刷新当前活动tab Ext.get('f_'+name).dom.src=menuUrl; break; } } if (b) { Ext.Ajax.request({ url : menuUrl,// 增加传递参数,处理暂停流程 success : this.showNodeTabPanel.createDelegate(this, delegateArray, true),// 调用异步函数,传递对应参数 failure : this.menuError, scope : this }); } }, // 为叶子菜单增加对应点击事件,调用链接对应的页面 showNodeTabPanel : function(result, thisObj, delegateArray) { var text = result.responseText; var tabPanel = Ext.getCmp("content-panel"); var _url = delegateArray['menuUrl']; if(_url.substring(0,4)!="http"){ _url = encodeURI(customInfo['context']+"/"+_url); } tabPage = tabPanel.add({ title : delegateArray['name'], html : "<iframe id='f_" + delegateArray['name'] + "' scrolling='auto' frameborder='0' width='100%' height='100%' src='" + _url + "'></iframe>", closable : true }); tabPanel.setActiveTab(tabPage); // 设置当前tab页 }, refresh : function(topMenuId) { var loader = new Ext.tree.TreeLoader({ dataUrl : this.context + '/menu!left.lxd?menuId=' +topMenuId }); loader.load(this.tree.root); this.tree.root.expand(true);//不起作用? }, expandTreeNodes: function(){ var tree = this.tree; tree.root.expand(true); } }); //根据组件ID获得相应的组件 function getComponent(id){ return Ext.getCmp(id); } //tab数量大于6个时,显示的提示信息 function alarmMessage(){ Ext.Msg.alert("提示信息","最多打开6个tab,请关闭无用页面"); } ```
节点的增删改。可以一直加下去。图标也会改变
//新增页面 var PanelFormWin = new Ext.Window({ title: "新增节点", width: 360, height: 150, plain: true, icon: 'Image/Img/searchlistimg.png', resizable: false, collapsible: true, closeAction: "hide", closable: true, modal: 'true', buttonAlign: "center", bodyStyle: "padding:10px", items: [PanelForm], buttons: [{ text: "确定", minWidth: 70, handler: function () { if (PanelForm.getForm().isValid()) { Ext.Ajax.request({ url: 'SaveNode.ashx', params: { pNode: Ext.getDom('hid_NodeNow').value, //读取根节点 ptype: 'Add', NodeName: Ext.getDom('S_NodeName').value, Num: Ext.getDom('S_Num').value = Ext.getDom('S_Num').value == null ? 0 : Ext.getDom('S_Num').value, NodeType: Ext.getDom('hid_ModelName').value, NodeTypeCode: Ext.getDom('hid_ModelTypeCode').value }, method: 'POST', success: function (response, options) { if (currentNode.leaf) { //currentNode.leaf = false; if (currentNode.parentNode != null) { currentNode.parentNode.reload(); } else { currentNode.reload(); } currentNode.expandChildNodes(true); } else { currentNode.reload(); } }, failure: function (response, options) { Ext.MessageBox.alert('失败', '请求超时或网络故障,错误编号:' + response.status); } }); } PanelFormWin.hide(); } }, { text: "重置", minWidth: 70, handler: function () { PanelForm.getForm().reset(); } }, { text: "关闭", minWidth: 70, handler: function () { PanelFormWin.hide(); } }] }) //新增容器 var PanelForm = new Ext.FormPanel({ labelAlign: 'right', buttonAlign: 'right', bodyStyle: 'padding:5px;', frame: true, labelWidth: 65, monitorValid: true, items: [ { layout: 'column', border: false, labelSeparator: ':', defaults: { layout: 'form', border: false, columnWidth: 1 }, items: [ { items: [{ xtype: 'textfield', fieldLabel: '节点名称', id: 'S_NodeName', name: 'S_NodeName', anchor: '90%', allowBlank: false, blankText: '请输入节点名称!' }] }, { items: [{ xtype: 'textfield', fieldLabel: '排&nbsp;&nbsp;序', id: 'S_Num', name: 'S_Num', anchor: '90%', blankText: '', allowBlank: false, regex: /^\d+$/, regexText: '请输入正确的数据类型', vtype: 'alphanum' }] } ] }] }); 急。不会改。就告知。新手入学!!
appwidget 如何实现全屏?
appwidget 实现全屏。minwidth和minheight都取了屏幕宽高,还是没有实现,到底要怎么做呢?
Java学习的正确打开方式
在博主认为,对于入门级学习java的最佳学习方法莫过于视频+博客+书籍+总结,前三者博主将淋漓尽致地挥毫于这篇博客文章中,至于总结在于个人,实际上越到后面你会发现学习的最好方式就是阅读参考官方文档其次就是国内的书籍,博客次之,这又是一个层次了,这里暂时不提后面再谈。博主将为各位入门java保驾护航,各位只管冲鸭!!!上天是公平的,只要不辜负时间,时间自然不会辜负你。 何谓学习?博主所理解的学习,它是一个过程,是一个不断累积、不断沉淀、不断总结、善于传达自己的个人见解以及乐于分享的过程。
程序员必须掌握的核心算法有哪些?
由于我之前一直强调数据结构以及算法学习的重要性,所以就有一些读者经常问我,数据结构与算法应该要学习到哪个程度呢?,说实话,这个问题我不知道要怎么回答你,主要取决于你想学习到哪些程度,不过针对这个问题,我稍微总结一下我学过的算法知识点,以及我觉得值得学习的算法。这些算法与数据结构的学习大多数是零散的,并没有一本把他们全部覆盖的书籍。下面是我觉得值得学习的一些算法以及数据结构,当然,我也会整理一些看过...
有哪些让程序员受益终生的建议
从业五年多,辗转两个大厂,出过书,创过业,从技术小白成长为基层管理,联合几个业内大牛回答下这个问题,希望能帮到大家,记得帮我点赞哦。 敲黑板!!!读了这篇文章,你将知道如何才能进大厂,如何实现财务自由,如何在工作中游刃有余,这篇文章很长,但绝对是精品,记得帮我点赞哦!!!! 一腔肺腑之言,能看进去多少,就看你自己了!!! 目录: 在校生篇: 为什么要尽量进大厂? 如何选择语言及方...
大学四年自学走来,这些私藏的实用工具/学习网站我贡献出来了
大学四年,看课本是不可能一直看课本的了,对于学习,特别是自学,善于搜索网上的一些资源来辅助,还是非常有必要的,下面我就把这几年私藏的各种资源,网站贡献出来给你们。主要有:电子书搜索、实用工具、在线视频学习网站、非视频学习网站、软件下载、面试/求职必备网站。 注意:文中提到的所有资源,文末我都给你整理好了,你们只管拿去,如果觉得不错,转发、分享就是最大的支持了。 一、电子书搜索 对于大部分程序员...
linux系列之常用运维命令整理笔录
本博客记录工作中需要的linux运维命令,大学时候开始接触linux,会一些基本操作,可是都没有整理起来,加上是做开发,不做运维,有些命令忘记了,所以现在整理成博客,当然vi,文件操作等就不介绍了,慢慢积累一些其它拓展的命令,博客不定时更新 free -m 其中:m表示兆,也可以用g,注意都要小写 Men:表示物理内存统计 total:表示物理内存总数(total=used+free) use...
比特币原理详解
一、什么是比特币 比特币是一种电子货币,是一种基于密码学的货币,在2008年11月1日由中本聪发表比特币白皮书,文中提出了一种去中心化的电子记账系统,我们平时的电子现金是银行来记账,因为银行的背后是国家信用。去中心化电子记账系统是参与者共同记账。比特币可以防止主权危机、信用风险。其好处不多做赘述,这一层面介绍的文章很多,本文主要从更深层的技术原理角度进行介绍。 二、问题引入 假设现有4个人...
程序员接私活怎样防止做完了不给钱?
首先跟大家说明一点,我们做 IT 类的外包开发,是非标品开发,所以很有可能在开发过程中会有这样那样的需求修改,而这种需求修改很容易造成扯皮,进而影响到费用支付,甚至出现做完了项目收不到钱的情况。 那么,怎么保证自己的薪酬安全呢? 我们在开工前,一定要做好一些证据方面的准备(也就是“讨薪”的理论依据),这其中最重要的就是需求文档和验收标准。一定要让需求方提供这两个文档资料作为开发的基础。之后开发...
网页实现一个简单的音乐播放器(大佬别看。(⊙﹏⊙))
今天闲着无事,就想写点东西。然后听了下歌,就打算写个播放器。 于是乎用h5 audio的加上js简单的播放器完工了。 演示地点演示 html代码如下` music 这个年纪 七月的风 音乐 ` 然后就是css`*{ margin: 0; padding: 0; text-decoration: none; list-...
Python十大装B语法
Python 是一种代表简单思想的语言,其语法相对简单,很容易上手。不过,如果就此小视 Python 语法的精妙和深邃,那就大错特错了。本文精心筛选了最能展现 Python 语法之精妙的十个知识点,并附上详细的实例代码。如能在实战中融会贯通、灵活使用,必将使代码更为精炼、高效,同时也会极大提升代码B格,使之看上去更老练,读起来更优雅。
数据库优化 - SQL优化
以实际SQL入手,带你一步一步走上SQL优化之路!
2019年11月中国大陆编程语言排行榜
2019年11月2日,我统计了某招聘网站,获得有效程序员招聘数据9万条。针对招聘信息,提取编程语言关键字,并统计如下: 编程语言比例 rank pl_ percentage 1 java 33.62% 2 cpp 16.42% 3 c_sharp 12.82% 4 javascript 12.31% 5 python 7.93% 6 go 7.25% 7 p...
通俗易懂地给女朋友讲:线程池的内部原理
餐盘在灯光的照耀下格外晶莹洁白,女朋友拿起红酒杯轻轻地抿了一小口,对我说:“经常听你说线程池,到底线程池到底是个什么原理?”
《奇巧淫技》系列-python!!每天早上八点自动发送天气预报邮件到QQ邮箱
将代码部署服务器,每日早上定时获取到天气数据,并发送到邮箱。 也可以说是一个小型人工智障。 知识可以运用在不同地方,不一定非是天气预报。
经典算法(5)杨辉三角
杨辉三角 是经典算法,这篇博客对它的算法思想进行了讲解,并有完整的代码实现。
英特尔不为人知的 B 面
从 PC 时代至今,众人只知在 CPU、GPU、XPU、制程、工艺等战场中,英特尔在与同行硬件芯片制造商们的竞争中杀出重围,且在不断的成长进化中,成为全球知名的半导体公司。殊不知,在「刚硬」的背后,英特尔「柔性」的软件早已经做到了全方位的支持与支撑,并持续发挥独特的生态价值,推动产业合作共赢。 而对于这一不知人知的 B 面,很多人将其称之为英特尔隐形的翅膀,虽低调,但是影响力却不容小觑。 那么,在...
腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹?
昨天,有网友私信我,说去阿里面试,彻底的被打击到了。问了为什么网上大量使用ThreadLocal的源码都会加上private static?他被难住了,因为他从来都没有考虑过这个问题。无独有偶,今天笔者又发现有网友吐槽了一道腾讯的面试题,我们一起来看看。 腾讯算法面试题:64匹马8个跑道需要多少轮才能选出最快的四匹? 在互联网职场论坛,一名程序员发帖求助到。二面腾讯,其中一个算法题:64匹...
面试官:你连RESTful都不知道我怎么敢要你?
干货,2019 RESTful最贱实践
为啥国人偏爱Mybatis,而老外喜欢Hibernate/JPA呢?
关于SQL和ORM的争论,永远都不会终止,我也一直在思考这个问题。昨天又跟群里的小伙伴进行了一番讨论,感触还是有一些,于是就有了今天这篇文。 声明:本文不会下关于Mybatis和JPA两个持久层框架哪个更好这样的结论。只是摆事实,讲道理,所以,请各位看官勿喷。 一、事件起因 关于Mybatis和JPA孰优孰劣的问题,争论已经很多年了。一直也没有结论,毕竟每个人的喜好和习惯是大不相同的。我也看...
白话阿里巴巴Java开发手册高级篇
不久前,阿里巴巴发布了《阿里巴巴Java开发手册》,总结了阿里巴巴内部实际项目开发过程中开发人员应该遵守的研发流程规范,这些流程规范在一定程度上能够保证最终的项目交付质量,通过在时间中总结模式,并推广给广大开发人员,来避免研发人员在实践中容易犯的错误,确保最终在大规模协作的项目中达成既定目标。 无独有偶,笔者去年在公司里负责升级和制定研发流程、设计模板、设计标准、代码标准等规范,并在实际工作中进行...
SQL-小白最佳入门sql查询一
不要偷偷的查询我的个人资料,即使你再喜欢我,也不要这样,真的不好;
redis分布式锁,面试官请随便问,我都会
文章有点长并且绕,先来个图片缓冲下! 前言 现在的业务场景越来越复杂,使用的架构也就越来越复杂,分布式、高并发已经是业务要求的常态。像腾讯系的不少服务,还有CDN优化、异地多备份等处理。 说到分布式,就必然涉及到分布式锁的概念,如何保证不同机器不同线程的分布式锁同步呢? 实现要点 互斥性,同一时刻,智能有一个客户端持有锁。 防止死锁发生,如果持有锁的客户端崩溃没有主动释放锁,也要保证锁可以正常释...
项目中的if else太多了,该怎么重构?
介绍 最近跟着公司的大佬开发了一款IM系统,类似QQ和微信哈,就是聊天软件。我们有一部分业务逻辑是这样的 if (msgType = "文本") { // dosomething } else if(msgType = "图片") { // doshomething } else if(msgType = "视频") { // doshomething } else { // doshom...
Nginx 原理和架构
Nginx 是一个免费的,开源的,高性能的 HTTP 服务器和反向代理,以及 IMAP / POP3 代理服务器。Nginx 以其高性能,稳定性,丰富的功能,简单的配置和低资源消耗而闻名。 Nginx 的整体架构 Nginx 里有一个 master 进程和多个 worker 进程。master 进程并不处理网络请求,主要负责调度工作进程:加载配置、启动工作进程及非停升级。worker 进程负责处...
Python 编程开发 实用经验和技巧
Python是一门很灵活的语言,也有很多实用的方法,有时候实现一个功能可以用多种方法实现,我这里总结了一些常用的方法和技巧,包括小数保留指定位小数、判断变量的数据类型、类方法@classmethod、制表符中文对齐、遍历字典、datetime.timedelta的使用等,会持续更新......
YouTube排名第一的励志英文演讲《Dream(梦想)》
Idon’t know what that dream is that you have, I don't care how disappointing it might have been as you've been working toward that dream,but that dream that you’re holding in your mind, that it’s po...
“狗屁不通文章生成器”登顶GitHub热榜,分分钟写出万字形式主义大作
一、垃圾文字生成器介绍 最近在浏览GitHub的时候,发现了这样一个骨骼清奇的雷人项目,而且热度还特别高。 项目中文名:狗屁不通文章生成器 项目英文名:BullshitGenerator 根据作者的介绍,他是偶尔需要一些中文文字用于GUI开发时测试文本渲染,因此开发了这个废话生成器。但由于生成的废话实在是太过富于哲理,所以最近已经被小伙伴们给玩坏了。 他的文风可能是这样的: 你发现,...
程序员:我终于知道post和get的区别
是一个老生常谈的话题,然而随着不断的学习,对于以前的认识有很多误区,所以还是需要不断地总结的,学而时习之,不亦说乎
《程序人生》系列-这个程序员只用了20行代码就拿了冠军
你知道的越多,你不知道的越多 点赞再看,养成习惯GitHub上已经开源https://github.com/JavaFamily,有一线大厂面试点脑图,欢迎Star和完善 前言 这一期不算《吊打面试官》系列的,所有没前言我直接开始。 絮叨 本来应该是没有这期的,看过我上期的小伙伴应该是知道的嘛,双十一比较忙嘛,要值班又要去帮忙拍摄年会的视频素材,还得搞个程序员一天的Vlog,还要写BU...
加快推动区块链技术和产业创新发展,2019可信区块链峰会在京召开
11月8日,由中国信息通信研究院、中国通信标准化协会、中国互联网协会、可信区块链推进计划联合主办,科技行者协办的2019可信区块链峰会将在北京悠唐皇冠假日酒店开幕。   区块链技术被认为是继蒸汽机、电力、互联网之后,下一代颠覆性的核心技术。如果说蒸汽机释放了人类的生产力,电力解决了人类基本的生活需求,互联网彻底改变了信息传递的方式,区块链作为构造信任的技术有重要的价值。   1...
Java世界最常用的工具类库
Apache Commons Apache Commons有很多子项目 Google Guava 参考博客
相关热词 c# 图片上传 c# gdi 占用内存 c#中遍历字典 c#控制台模拟dos c# 斜率 最小二乘法 c#进程延迟 c# mysql完整项目 c# grid 总行数 c# web浏览器插件 c# xml 生成xsd
立即提问